Add flutter 3+ support. Update dependencies. Fix code style and format issues.

This commit is contained in:
Igor Kulikov
2022-08-12 13:55:27 +03:00
parent 1a07bcd7a0
commit 944c36ce7b
94 changed files with 3167 additions and 3173 deletions

View File

@@ -1,6 +1,5 @@
import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:thingsboard_app/core/auth/auth_routes.dart';
import 'package:thingsboard_app/core/context/tb_context.dart';
import 'package:thingsboard_app/core/init/init_routes.dart';
@@ -20,15 +19,12 @@ class ThingsboardAppRouter {
late final _tbContext = TbContext(router);
ThingsboardAppRouter() {
router.notFoundHandler = Handler(handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
router.notFoundHandler = Handler(
handlerFunc: (BuildContext? context, Map<String, List<String>> params) {
var settings = context!.settings;
return Scaffold(
appBar: AppBar(
title: Text('Not Found')
),
body: Center(
child: Text('Route not defined: ${settings!.name}')
),
appBar: AppBar(title: Text('Not Found')),
body: Center(child: Text('Route not defined: ${settings!.name}')),
);
});
InitRoutes(_tbContext).registerRoutes();
@@ -49,7 +45,6 @@ class ThingsboardAppRouter {
}
abstract class TbRoutes {
final TbContext _tbContext;
TbRoutes(this._tbContext);
@@ -61,5 +56,4 @@ abstract class TbRoutes {
void doRegisterRoutes(FluroRouter router);
TbContext get tbContext => _tbContext;
}

View File

@@ -24,7 +24,8 @@ const tbMatIndigo = MaterialColor(
700: Color(0xFF303F9F),
800: Color(0xFF283593),
900: Color(0xFF1A237E),
},);
},
);
const tbDarkMatIndigo = MaterialColor(
_tbPrimaryColorValue,
@@ -39,44 +40,40 @@ const tbDarkMatIndigo = MaterialColor(
700: Color(0xFF303F9F),
800: _tbPrimaryColor,
900: Color(0xFF1A237E),
},);
},
);
final ThemeData theme = ThemeData();
ThemeData tbTheme = ThemeData(
primarySwatch: tbMatIndigo,
accentColor: Colors.deepOrange,
colorScheme: theme.colorScheme.copyWith(secondary: Colors.deepOrange),
scaffoldBackgroundColor: Color(0xFFFAFAFA),
textTheme: tbTypography.black,
primaryTextTheme: tbTypography.black,
typography: tbTypography,
appBarTheme: AppBarTheme(
backgroundColor: Colors.white,
foregroundColor: _tbTextColor,
/* titleTextStyle: TextStyle(
backgroundColor: Colors.white,
foregroundColor: _tbTextColor,
/* titleTextStyle: TextStyle(
color: _tbTextColor
),
toolbarTextStyle: TextStyle(
color: _tbTextColor
), */
iconTheme: IconThemeData(
color: _tbTextColor
)
),
iconTheme: IconThemeData(color: _tbTextColor)),
bottomNavigationBarTheme: BottomNavigationBarThemeData(
backgroundColor: Colors.white,
selectedItemColor: _tbPrimaryColor,
unselectedItemColor: _tbPrimaryColor.withAlpha((255 * 0.38).ceil()),
showSelectedLabels: true,
showUnselectedLabels: true
),
backgroundColor: Colors.white,
selectedItemColor: _tbPrimaryColor,
unselectedItemColor: _tbPrimaryColor.withAlpha((255 * 0.38).ceil()),
showSelectedLabels: true,
showUnselectedLabels: true),
pageTransitionsTheme: PageTransitionsTheme(builders: {
TargetPlatform.iOS: FadeOpenPageTransitionsBuilder(),
TargetPlatform.android: FadeOpenPageTransitionsBuilder(),
})
);
}));
ThemeData tbDarkTheme = ThemeData(
primarySwatch: tbDarkMatIndigo,
accentColor: Colors.deepOrange,
brightness: Brightness.dark
);
colorScheme: theme.colorScheme.copyWith(secondary: Colors.deepOrange),
brightness: Brightness.dark);