Skip to content

Commit

Permalink
add update
Browse files Browse the repository at this point in the history
  • Loading branch information
kidozh committed Dec 1, 2024
1 parent d640a49 commit e8ea141
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 14 deletions.
42 changes: 29 additions & 13 deletions lib/app/MainApp.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ 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.
String platformName = "";
Expand All @@ -56,7 +58,19 @@ class MyApp extends StatelessWidget {

_loadPreference(BuildContext context) async {
int colorName = await UserPreferencesUtils.getThemeColor();
platformName = await UserPreferencesUtils.getPlatformPreference();
// check the size
// check the screen size
double width = MediaQuery.sizeOf(context).width;
log("Get screen width ${width}");
if(width > mobileScreenSize){
platformName = "android";
//Provider.of<ThemeNotifierProvider>(context, listen: false).setPlatformName("android")
}
else{
platformName = await UserPreferencesUtils.getPlatformPreference();
}


double scale = await UserPreferencesUtils.getTypesettingScalePreference();
Brightness? brightness =
await UserPreferencesUtils.getInterfaceBrightnessPreference();
Expand Down Expand Up @@ -140,6 +154,9 @@ class MyApp extends StatelessWidget {
String platformName =
Provider.of<ThemeNotifierProvider>(context, listen: false)
.platformName;
// if in tablet mode should choose material only


TargetPlatform targetPlatform = TargetPlatform.android;

TypeSettingNotifierProvider typeSetting =
Expand All @@ -162,6 +179,16 @@ class MyApp extends StatelessWidget {
}
}

if(MediaQuery.sizeOf(context).width > mobileScreenSize){
platformName = "android";
initialPlatform = 'android';
targetPlatform = TargetPlatform.android;
//Provider.of<ThemeNotifierProvider>(context, listen: false).setPlatformName("android");
}




switch (typeSetting.typographyTheme) {
case "material2014":
{
Expand Down Expand Up @@ -775,18 +802,7 @@ class MainTwoPaneState extends State<MainTwoPaneStatefulWidget>
void initState() {

super.initState();
changeLayoutToMaterialIfInTablet();
}

Future<void> changeLayoutToMaterialIfInTablet() async{
if(isCupertino(context) && widget.type != TwoPaneType.smallScreen){
// change it to material despite the setting
// if(isCupertino(context))
Future.delayed(const Duration(seconds: 1), (){
PlatformProvider.of(context)?.changeToMaterialPlatform();
});

}
}

@override
Expand All @@ -813,7 +829,7 @@ class MainTwoPaneState extends State<MainTwoPaneStatefulWidget>
return TwoPaneScaffold(
type: widget.type,
child: TwoPane(
padding: EdgeInsets.symmetric(vertical: 0, horizontal: 20),
padding: EdgeInsets.symmetric(vertical: 0, horizontal: 8),
paneProportion: paneProportion,
panePriority: panePriority,
startPane: MyHomePage(
Expand Down
2 changes: 1 addition & 1 deletion lib/page/ViewThreadSliverPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class _ViewThreadSliverState extends State<ViewThreadStatefulSliverWidget> {

void bindFocusNode() {
_focusNode.addListener(() {
debugDumpFocusTree();
//debugDumpFocusTree();
if (_focusNode.hasFocus) {
setState(() {
dialogStatus = SHOW_NONE_DIALOG;
Expand Down

0 comments on commit e8ea141

Please sign in to comment.