Skip to content

Commit

Permalink
fix deprecated issues
Browse files Browse the repository at this point in the history
  • Loading branch information
dangfan committed Aug 29, 2024
1 parent 592b11a commit 35b9f65
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 76 deletions.
62 changes: 33 additions & 29 deletions lib/helper/theme/app_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ class AppTheme {

/// -------------------------- Light Theme -------------------------------------------- ///
static final ThemeData lightTheme = ThemeData(
useMaterial3: false,

/// Brightness
brightness: Brightness.light,

Expand Down Expand Up @@ -103,35 +105,35 @@ class AppTheme {

/// CheckBox theme
checkboxTheme: CheckboxThemeData(
checkColor: MaterialStateProperty.all(Color(0xffeeeeee)),
fillColor: MaterialStateProperty.all(Color(0xff009678)),
checkColor: WidgetStateProperty.all(Color(0xffeeeeee)),
fillColor: WidgetStateProperty.all(Color(0xff009678)),
),

/// Radio theme
radioTheme: RadioThemeData(
fillColor: MaterialStateProperty.all(Color(0xff009678)),
fillColor: WidgetStateProperty.all(Color(0xff009678)),
),

///Switch Theme
switchTheme: SwitchThemeData(
trackColor: MaterialStateProperty.resolveWith((state) {
const Set<MaterialState> interactiveStates = <MaterialState>{
MaterialState.pressed,
MaterialState.hovered,
MaterialState.focused,
MaterialState.selected,
trackColor: WidgetStateProperty.resolveWith((state) {
const Set<WidgetState> interactiveStates = <WidgetState>{
WidgetState.pressed,
WidgetState.hovered,
WidgetState.focused,
WidgetState.selected,
};
if (state.any(interactiveStates.contains)) {
return Color(0xffabb3ea);
}
return null;
}),
thumbColor: MaterialStateProperty.resolveWith((state) {
const Set<MaterialState> interactiveStates = <MaterialState>{
MaterialState.pressed,
MaterialState.hovered,
MaterialState.focused,
MaterialState.selected,
thumbColor: WidgetStateProperty.resolveWith((state) {
const Set<WidgetState> interactiveStates = <WidgetState>{
WidgetState.pressed,
WidgetState.hovered,
WidgetState.focused,
WidgetState.selected,
};
if (state.any(interactiveStates.contains)) {
return Color(0xff009678);
Expand Down Expand Up @@ -162,12 +164,14 @@ class AppTheme {
indicatorColor: Color(0xffeeeeee),
highlightColor: Color(0xffeeeeee),
colorScheme: ColorScheme.fromSeed(seedColor: Color(0xff009678), brightness: Brightness.light, surfaceTint: Colors.transparent)
.copyWith(background: Color(0xffffffff))
.copyWith(surface: Color(0xffffffff))
.copyWith(error: Color(0xfff0323c)),
);

/// -------------------------- Dark Theme -------------------------------------------- ///
static final ThemeData darkTheme = ThemeData(
useMaterial3: false,

/// Brightness
brightness: Brightness.dark,

Expand Down Expand Up @@ -227,24 +231,24 @@ class AppTheme {

///Switch Theme
switchTheme: SwitchThemeData(
trackColor: MaterialStateProperty.resolveWith((state) {
const Set<MaterialState> interactiveStates = <MaterialState>{
MaterialState.pressed,
MaterialState.hovered,
MaterialState.focused,
MaterialState.selected,
trackColor: WidgetStateProperty.resolveWith((state) {
const Set<WidgetState> interactiveStates = <WidgetState>{
WidgetState.pressed,
WidgetState.hovered,
WidgetState.focused,
WidgetState.selected,
};
if (state.any(interactiveStates.contains)) {
return Color(0xffabb3ea);
}
return null;
}),
thumbColor: MaterialStateProperty.resolveWith((state) {
const Set<MaterialState> interactiveStates = <MaterialState>{
MaterialState.pressed,
MaterialState.hovered,
MaterialState.focused,
MaterialState.selected,
thumbColor: WidgetStateProperty.resolveWith((state) {
const Set<WidgetState> interactiveStates = <WidgetState>{
WidgetState.pressed,
WidgetState.hovered,
WidgetState.focused,
WidgetState.selected,
};
if (state.any(interactiveStates.contains)) {
return Color(0xff009678);
Expand Down Expand Up @@ -276,6 +280,6 @@ class AppTheme {
highlightColor: Colors.white.withAlpha(28),
splashColor: Colors.white.withAlpha(56),
colorScheme:
ColorScheme.fromSeed(seedColor: Color(0xff009678), brightness: Brightness.dark).copyWith(background: Color(0xff161616)).copyWith(error: Colors.orange),
ColorScheme.fromSeed(seedColor: Color(0xff009678), brightness: Brightness.dark).copyWith(surface: Color(0xff161616)).copyWith(error: Colors.orange),
);
}
8 changes: 4 additions & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ dependencies:
provider: ^6.0.5
google_fonts: ^6.2.1
lucide_icons: ^0.257.0
url_strategy: ^0.2.0
url_strategy: ^0.3.0
url_launcher: ^6.2.6
file_picker: ^8.0.3
file_picker: ^8.0.7
font_awesome_flutter: ^10.7.0
intl: ^0.19.0
flutter_nfc_kit: ^3.4.2
Expand All @@ -44,14 +44,14 @@ dependencies:
device_info_plus: ^10.1.0
dart_des: ^1.0.2
pem: ^2.0.5
file_saver: ^0.2.12
file_saver: ^0.2.13
basic_utils: ^5.7.0
pointycastle: ^3.9.1

dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0
flutter_lints: ^4.0.0

flutter:
uses-material-design: true
Expand Down
45 changes: 2 additions & 43 deletions web/index.html
Original file line number Diff line number Diff line change
@@ -1,44 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<!--
If you are serving your web app in a path other than the root, change the
href value below to reflect the base path you are serving from.
The path provided below has to start and end with a slash "/" in order for
it to work correctly.
For more details:
* https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base
This is a placeholder for base href that will be replaced by the value of
the `--base-href` argument provided to `flutter build`.
build command: flutter build web --base-href=/
-->
<base href="$FLUTTER_BASE_HREF">

<meta charset="UTF-8">
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
<meta name="description" content="A new Flutter project.">

<!-- iOS meta tags & icons -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="CanoKey Console">
<link rel="apple-touch-icon" href="icons/Icon-192.png">

<!-- Favicon -->
<link rel="icon" type="image/png" href="favicon.png"/>

<title>CanoKey Console</title>
<link rel="manifest" href="manifest.json">

<script>
// The value below is injected by flutter build, do not touch.
const serviceWorkerVersion = null;
</script>
<!-- This script adds the flutter initialization JS code -->
<script src="flutter.js" defer></script>
<style>
.center {
position: absolute;
Expand All @@ -50,21 +22,8 @@
</style>
</head>
<body>
<script>
window.addEventListener('load', function (ev) {
// Download main.dart.js
_flutter.loader.loadEntrypoint({
serviceWorker: {
serviceWorkerVersion: serviceWorkerVersion,
},
onEntrypointLoaded: function (engineInitializer) {
engineInitializer.initializeEngine().then(function (appRunner) {
appRunner.runApp();
});
}
});
});
</script>
<script src="flutter_bootstrap.js" async></script>
<script src="flutter.js" defer></script>
<div id="loader" class="container">
<img src="img/splash.png" class="center" alt="Splash"/>
</div>
Expand Down

0 comments on commit 35b9f65

Please sign in to comment.