mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 15:24:35 +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/locator.dart';
|
||||||
import 'package:toolbox/view/page/home.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 {
|
class MyApp extends StatelessWidget {
|
||||||
const MyApp({Key? key}) : super(key: key);
|
const MyApp({Key? key}) : super(key: key);
|
||||||
|
|
||||||
MaterialStateProperty<Color?> getMaterialStateColor(Color primaryColor) {
|
MaterialStateProperty<Color?> getMaterialStateColor(Color primaryColor) {
|
||||||
return MaterialStateProperty.resolveWith((states) {
|
return MaterialStateProperty.resolveWith((states) {
|
||||||
const Set<MaterialState> interactiveStates = <MaterialState>{
|
|
||||||
MaterialState.pressed,
|
|
||||||
MaterialState.hovered,
|
|
||||||
MaterialState.focused,
|
|
||||||
MaterialState.selected
|
|
||||||
};
|
|
||||||
if (states.any(interactiveStates.contains)) {
|
if (states.any(interactiveStates.contains)) {
|
||||||
return primaryColor;
|
return primaryColor;
|
||||||
}
|
}
|
||||||
@@ -38,11 +39,9 @@ class MyApp extends StatelessWidget {
|
|||||||
S.delegate,
|
S.delegate,
|
||||||
GlobalMaterialLocalizations.delegate,
|
GlobalMaterialLocalizations.delegate,
|
||||||
GlobalWidgetsLocalizations.delegate,
|
GlobalWidgetsLocalizations.delegate,
|
||||||
GlobalCupertinoLocalizations.delegate,
|
|
||||||
],
|
],
|
||||||
supportedLocales: S.delegate.supportedLocales,
|
supportedLocales: S.delegate.supportedLocales,
|
||||||
title: BuildData.name,
|
title: BuildData.name,
|
||||||
debugShowCheckedModeBanner: false,
|
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
primaryColor: primaryColor,
|
primaryColor: primaryColor,
|
||||||
appBarTheme: AppBarTheme(backgroundColor: primaryColor),
|
appBarTheme: AppBarTheme(backgroundColor: primaryColor),
|
||||||
@@ -52,36 +51,44 @@ class MyApp extends StatelessWidget {
|
|||||||
primaryIconTheme: IconThemeData(color: primaryColor),
|
primaryIconTheme: IconThemeData(color: primaryColor),
|
||||||
switchTheme: SwitchThemeData(
|
switchTheme: SwitchThemeData(
|
||||||
thumbColor: getMaterialStateColor(primaryColor),
|
thumbColor: getMaterialStateColor(primaryColor),
|
||||||
trackColor:
|
trackColor: getMaterialStateColor(
|
||||||
getMaterialStateColor(primaryColor.withOpacity(0.7)),
|
primaryColor.withOpacity(0.7),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
buttonTheme: ButtonThemeData(splashColor: primaryColor),
|
buttonTheme: ButtonThemeData(splashColor: primaryColor),
|
||||||
inputDecorationTheme: InputDecorationTheme(
|
inputDecorationTheme: InputDecorationTheme(
|
||||||
labelStyle: textStyle,
|
labelStyle: textStyle,
|
||||||
focusedBorder: UnderlineInputBorder(
|
focusedBorder: UnderlineInputBorder(
|
||||||
borderSide: BorderSide(color: primaryColor))),
|
borderSide: BorderSide(color: primaryColor),
|
||||||
|
),
|
||||||
|
),
|
||||||
radioTheme: RadioThemeData(
|
radioTheme: RadioThemeData(
|
||||||
fillColor: getMaterialStateColor(primaryColor),
|
fillColor: getMaterialStateColor(primaryColor),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
darkTheme: ThemeData.dark().copyWith(
|
darkTheme: ThemeData.dark().copyWith(
|
||||||
primaryColor: primaryColor,
|
primaryColor: primaryColor,
|
||||||
floatingActionButtonTheme: FloatingActionButtonThemeData(
|
floatingActionButtonTheme:
|
||||||
backgroundColor: primaryColor),
|
FloatingActionButtonThemeData(backgroundColor: primaryColor),
|
||||||
iconTheme: IconThemeData(color: primaryColor),
|
iconTheme: IconThemeData(color: primaryColor),
|
||||||
primaryIconTheme: IconThemeData(color: primaryColor),
|
primaryIconTheme: IconThemeData(color: primaryColor),
|
||||||
switchTheme: SwitchThemeData(
|
switchTheme: SwitchThemeData(
|
||||||
thumbColor: getMaterialStateColor(primaryColor),
|
thumbColor: getMaterialStateColor(primaryColor),
|
||||||
trackColor:
|
trackColor: getMaterialStateColor(
|
||||||
getMaterialStateColor(primaryColor.withOpacity(0.7)),
|
primaryColor.withOpacity(0.7),
|
||||||
),
|
),
|
||||||
buttonTheme: ButtonThemeData(splashColor: primaryColor),
|
),
|
||||||
inputDecorationTheme: InputDecorationTheme(
|
buttonTheme: ButtonThemeData(splashColor: primaryColor),
|
||||||
labelStyle: textStyle,
|
inputDecorationTheme: InputDecorationTheme(
|
||||||
focusedBorder: UnderlineInputBorder(
|
labelStyle: textStyle,
|
||||||
borderSide: BorderSide(color: primaryColor))),
|
focusedBorder: UnderlineInputBorder(
|
||||||
radioTheme: RadioThemeData(
|
borderSide: BorderSide(color: primaryColor),
|
||||||
fillColor: getMaterialStateColor(primaryColor))),
|
),
|
||||||
|
),
|
||||||
|
radioTheme: RadioThemeData(
|
||||||
|
fillColor: getMaterialStateColor(primaryColor),
|
||||||
|
),
|
||||||
|
),
|
||||||
home: MyHomePage(primaryColor: primaryColor),
|
home: MyHomePage(primaryColor: primaryColor),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
class BuildData {
|
class BuildData {
|
||||||
static const String name = "ServerBox";
|
static const String name = "ServerBox";
|
||||||
static const int build = 160;
|
static const int build = 162;
|
||||||
static const String engine =
|
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";
|
"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-11-21 20:31:38.507008";
|
static const String buildAt = "2022-12-04 15:36:33.518958";
|
||||||
static const int modifications = 8;
|
static const int modifications = 4;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ class _ConvertPageState extends State<ConvertPage>
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
tooltip: s.convert,
|
tooltip: s.convert,
|
||||||
|
heroTag: 'convert fab',
|
||||||
child: const Icon(Icons.send),
|
child: const Icon(Icons.send),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -87,15 +87,16 @@ class _MyHomePageState extends State<MyHomePage>
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
super.build(context);
|
super.build(context);
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
child: _buildMain(context),
|
child: _buildMain(context),
|
||||||
onWillPop: () {
|
onWillPop: () {
|
||||||
final scaffold = Scaffold.of(context);
|
final scaffold = Scaffold.of(context);
|
||||||
if (scaffold.isDrawerOpen) {
|
if (scaffold.isDrawerOpen) {
|
||||||
scaffold.closeDrawer();
|
scaffold.closeDrawer();
|
||||||
return Future.value(false);
|
return Future.value(false);
|
||||||
}
|
}
|
||||||
return Future.value(true);
|
return Future.value(true);
|
||||||
});
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildMain(BuildContext context) {
|
Widget _buildMain(BuildContext context) {
|
||||||
@@ -116,7 +117,7 @@ class _MyHomePageState extends State<MyHomePage>
|
|||||||
physics: const ClampingScrollPhysics(),
|
physics: const ClampingScrollPhysics(),
|
||||||
controller: _pageController,
|
controller: _pageController,
|
||||||
onPageChanged: (i) {
|
onPageChanged: (i) {
|
||||||
FocusScope.of(context).unfocus();
|
FocusScope.of(context).requestFocus(FocusNode());
|
||||||
_selectIndex = i;
|
_selectIndex = i;
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ class _PingPageState extends State<PingPage>
|
|||||||
),
|
),
|
||||||
])),
|
])),
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
child: const Icon(Icons.play_arrow),
|
heroTag: 'ping fab',
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
try {
|
try {
|
||||||
doPing();
|
doPing();
|
||||||
@@ -79,6 +79,7 @@ class _PingPageState extends State<PingPage>
|
|||||||
showSnackBar(context, Text('Error: \n$e'));
|
showSnackBar(context, Text('Error: \n$e'));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
child: const Icon(Icons.play_arrow),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user