mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
fix: IME awayls float
This commit is contained in:
65
lib/app.dart
65
lib/app.dart
@@ -7,17 +7,18 @@ import 'package:toolbox/generated/l10n.dart';
|
||||
import 'package:toolbox/locator.dart';
|
||||
import 'package:toolbox/view/page/home.dart';
|
||||
|
||||
const Set<MaterialState> interactiveStates = <MaterialState>{
|
||||
MaterialState.pressed,
|
||||
MaterialState.hovered,
|
||||
MaterialState.focused,
|
||||
MaterialState.selected
|
||||
};
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({Key? key}) : super(key: key);
|
||||
|
||||
MaterialStateProperty<Color?> getMaterialStateColor(Color primaryColor) {
|
||||
return MaterialStateProperty.resolveWith((states) {
|
||||
const Set<MaterialState> interactiveStates = <MaterialState>{
|
||||
MaterialState.pressed,
|
||||
MaterialState.hovered,
|
||||
MaterialState.focused,
|
||||
MaterialState.selected
|
||||
};
|
||||
if (states.any(interactiveStates.contains)) {
|
||||
return primaryColor;
|
||||
}
|
||||
@@ -38,11 +39,9 @@ class MyApp extends StatelessWidget {
|
||||
S.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: S.delegate.supportedLocales,
|
||||
title: BuildData.name,
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: ThemeData(
|
||||
primaryColor: primaryColor,
|
||||
appBarTheme: AppBarTheme(backgroundColor: primaryColor),
|
||||
@@ -52,36 +51,44 @@ class MyApp extends StatelessWidget {
|
||||
primaryIconTheme: IconThemeData(color: primaryColor),
|
||||
switchTheme: SwitchThemeData(
|
||||
thumbColor: getMaterialStateColor(primaryColor),
|
||||
trackColor:
|
||||
getMaterialStateColor(primaryColor.withOpacity(0.7)),
|
||||
trackColor: getMaterialStateColor(
|
||||
primaryColor.withOpacity(0.7),
|
||||
),
|
||||
),
|
||||
buttonTheme: ButtonThemeData(splashColor: primaryColor),
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
labelStyle: textStyle,
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor))),
|
||||
labelStyle: textStyle,
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor),
|
||||
),
|
||||
),
|
||||
radioTheme: RadioThemeData(
|
||||
fillColor: getMaterialStateColor(primaryColor),
|
||||
),
|
||||
),
|
||||
darkTheme: ThemeData.dark().copyWith(
|
||||
primaryColor: primaryColor,
|
||||
floatingActionButtonTheme: FloatingActionButtonThemeData(
|
||||
backgroundColor: primaryColor),
|
||||
iconTheme: IconThemeData(color: primaryColor),
|
||||
primaryIconTheme: IconThemeData(color: primaryColor),
|
||||
switchTheme: SwitchThemeData(
|
||||
thumbColor: getMaterialStateColor(primaryColor),
|
||||
trackColor:
|
||||
getMaterialStateColor(primaryColor.withOpacity(0.7)),
|
||||
primaryColor: primaryColor,
|
||||
floatingActionButtonTheme:
|
||||
FloatingActionButtonThemeData(backgroundColor: primaryColor),
|
||||
iconTheme: IconThemeData(color: primaryColor),
|
||||
primaryIconTheme: IconThemeData(color: primaryColor),
|
||||
switchTheme: SwitchThemeData(
|
||||
thumbColor: getMaterialStateColor(primaryColor),
|
||||
trackColor: getMaterialStateColor(
|
||||
primaryColor.withOpacity(0.7),
|
||||
),
|
||||
buttonTheme: ButtonThemeData(splashColor: primaryColor),
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
labelStyle: textStyle,
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor))),
|
||||
radioTheme: RadioThemeData(
|
||||
fillColor: getMaterialStateColor(primaryColor))),
|
||||
),
|
||||
buttonTheme: ButtonThemeData(splashColor: primaryColor),
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
labelStyle: textStyle,
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor),
|
||||
),
|
||||
),
|
||||
radioTheme: RadioThemeData(
|
||||
fillColor: getMaterialStateColor(primaryColor),
|
||||
),
|
||||
),
|
||||
home: MyHomePage(primaryColor: primaryColor),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ServerBox";
|
||||
static const int build = 160;
|
||||
static const int build = 162;
|
||||
static const String engine =
|
||||
"Flutter 3.3.4 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision eb6d86ee27 (7 weeks ago) • 2022-10-04 22:31:45 -0700\nEngine • revision c08d7d5efc\nTools • Dart 2.18.2 • DevTools 2.15.0\n";
|
||||
static const String buildAt = "2022-11-21 20:31:38.507008";
|
||||
static const int modifications = 8;
|
||||
"Flutter 3.3.9 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision b8f7f1f986 (11 days ago) • 2022-11-23 06:43:51 +0900\nEngine • revision 8f2221fbef\nTools • Dart 2.18.5 • DevTools 2.15.0\n";
|
||||
static const String buildAt = "2022-12-04 15:36:33.518958";
|
||||
static const int modifications = 4;
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ class _ConvertPageState extends State<ConvertPage>
|
||||
}
|
||||
},
|
||||
tooltip: s.convert,
|
||||
heroTag: 'convert fab',
|
||||
child: const Icon(Icons.send),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -87,15 +87,16 @@ class _MyHomePageState extends State<MyHomePage>
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
return WillPopScope(
|
||||
child: _buildMain(context),
|
||||
onWillPop: () {
|
||||
final scaffold = Scaffold.of(context);
|
||||
if (scaffold.isDrawerOpen) {
|
||||
scaffold.closeDrawer();
|
||||
return Future.value(false);
|
||||
}
|
||||
return Future.value(true);
|
||||
});
|
||||
child: _buildMain(context),
|
||||
onWillPop: () {
|
||||
final scaffold = Scaffold.of(context);
|
||||
if (scaffold.isDrawerOpen) {
|
||||
scaffold.closeDrawer();
|
||||
return Future.value(false);
|
||||
}
|
||||
return Future.value(true);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMain(BuildContext context) {
|
||||
@@ -116,7 +117,7 @@ class _MyHomePageState extends State<MyHomePage>
|
||||
physics: const ClampingScrollPhysics(),
|
||||
controller: _pageController,
|
||||
onPageChanged: (i) {
|
||||
FocusScope.of(context).unfocus();
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
_selectIndex = i;
|
||||
setState(() {});
|
||||
},
|
||||
|
||||
@@ -71,7 +71,7 @@ class _PingPageState extends State<PingPage>
|
||||
),
|
||||
])),
|
||||
floatingActionButton: FloatingActionButton(
|
||||
child: const Icon(Icons.play_arrow),
|
||||
heroTag: 'ping fab',
|
||||
onPressed: () {
|
||||
try {
|
||||
doPing();
|
||||
@@ -79,6 +79,7 @@ class _PingPageState extends State<PingPage>
|
||||
showSnackBar(context, Text('Error: \n$e'));
|
||||
}
|
||||
},
|
||||
child: const Icon(Icons.play_arrow),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user