Skip to content

Commit

Permalink
add screen size update
Browse files Browse the repository at this point in the history
  • Loading branch information
kidozh committed Dec 1, 2024
1 parent e8ea141 commit 547bc58
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/app/MainApp.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import '../utility/TwoPaneScaffold.dart';
import '../utility/TwoPaneUtils.dart';
import '../widget/DiscuzNotificationAppbarIconWidget.dart';

double mobileScreenSize = 600;


class MyApp extends StatelessWidget {
// This widget is the root of your application.
Expand All @@ -62,7 +62,7 @@ class MyApp extends StatelessWidget {
// check the screen size
double width = MediaQuery.sizeOf(context).width;
log("Get screen width ${width}");
if(width > mobileScreenSize){
if(width >= TwoPaneUtils.mobileScreenSize){
platformName = "android";
//Provider.of<ThemeNotifierProvider>(context, listen: false).setPlatformName("android")
}
Expand Down Expand Up @@ -179,7 +179,7 @@ class MyApp extends StatelessWidget {
}
}

if(MediaQuery.sizeOf(context).width > mobileScreenSize){
if(MediaQuery.sizeOf(context).width >= TwoPaneUtils.mobileScreenSize){
platformName = "android";
initialPlatform = 'android';
targetPlatform = TargetPlatform.android;
Expand Down
2 changes: 2 additions & 0 deletions lib/utility/AppPlatformIcons.dart
Original file line number Diff line number Diff line change
Expand Up @@ -168,4 +168,6 @@ class AppPlatformIcons{
IconData get deleteSolid => isMaterial(context)? Icons.delete_forever : CupertinoIcons.delete_left_fill;

IconData get clearCircleSolid => isMaterial(context)? Icons.clear : CupertinoIcons.clear_circled;

IconData get clearAtEndSolid => isMaterial(context)? Icons.clear_all : CupertinoIcons.clear_fill;
}
6 changes: 5 additions & 1 deletion lib/utility/TwoPaneUtils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ enum TwoPaneType{
smallScreen
}



class TwoPaneUtils{
static double mobileScreenSize = 650;

static TwoPaneType getTwoPaneType(BoxConstraints constraints){
if(constraints.maxWidth < 650){
if(constraints.maxWidth < mobileScreenSize){
return TwoPaneType.smallScreen;
}
else{
Expand Down
14 changes: 13 additions & 1 deletion lib/widget/SteamGameWidget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class SteamGameState extends State<SteamGameWidget> {
textAlign: TextAlign.start,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Theme.of(context).colorScheme.primary,
//color: Theme.of(context).colorScheme.primary,
fontSize: 24,
),
)),
Expand All @@ -232,6 +232,7 @@ class SteamGameState extends State<SteamGameWidget> {
size: 30,
),
onPressed: () {
VibrationUtils.vibrateWithClickIfPossible();
Navigator.of(context).pop();
},
),
Expand Down Expand Up @@ -490,6 +491,17 @@ class SteamGameState extends State<SteamGameWidget> {
height: 16,
),
Divider(),
PlatformIconButton(
icon: Icon(
AppPlatformIcons(context).clearAtEndSolid,
size: 30,
color: Theme.of(context).textTheme.bodyMedium?.color,
),
onPressed: () {
VibrationUtils.vibrateWithClickIfPossible();
Navigator.of(context).pop();
},
),
SizedBox(
height: 16,
)
Expand Down

0 comments on commit 547bc58

Please sign in to comment.