phase3(critical-path): home page chain null-safe
home.dart + desktop/mobile navigation, carousels, index content widgets, customers_logo, appbar_menu, navigation_drawer, MobileBottomNav, double_back. Fixes: Key? params, nullable State fields, Scrollbar thumbVisibility, ModalRoute.of()?, badges hide Badge, cartInfos local promotion.
This commit is contained in:
@@ -34,7 +34,7 @@ import '../widgets/mobile/mobile_navigation_drawer.dart';
|
||||
class Home extends StatefulWidget {
|
||||
final String title;
|
||||
|
||||
Home({Key key, this.title = ''}) : super(key: key);
|
||||
Home({Key? key, this.title = ''}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
@@ -46,11 +46,11 @@ class Home extends StatefulWidget {
|
||||
class HomeState extends State<Home> {
|
||||
final _scaffoldKey = GlobalKey<ScaffoldState>();
|
||||
List<Gallery> galleries = [];
|
||||
String content1Message;
|
||||
Map<String, dynamic> content2;
|
||||
String? content1Message;
|
||||
Map<String, dynamic>? content2;
|
||||
|
||||
StreamSubscription _sub;
|
||||
Uri _latestUri;
|
||||
StreamSubscription? _sub;
|
||||
Uri? _latestUri;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -80,9 +80,9 @@ class HomeState extends State<Home> {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
MobileIndexCarousel(galleries),
|
||||
MobileIndexMainContent1(content1Message),
|
||||
MobileIndexMainContent2(content2),
|
||||
MobileIndexMainContent3(content2),
|
||||
MobileIndexMainContent1(content1Message ?? ''),
|
||||
MobileIndexMainContent2(content2 ?? <String, dynamic>{}),
|
||||
MobileIndexMainContent3(content2 ?? <String, dynamic>{}),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -91,24 +91,24 @@ class HomeState extends State<Home> {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
DesktopIndexCarousel(galleries),
|
||||
DesktopIndexMainContent1(content1Message),
|
||||
DesktopIndexMainContent2(content2),
|
||||
DesktopIndexMainContent1(content1Message ?? ''),
|
||||
DesktopIndexMainContent2(content2 ?? <String, dynamic>{}),
|
||||
CustomersLogo(),
|
||||
DesktopIndexMainContent3(content2),
|
||||
DesktopIndexMainContent3(content2 ?? <String, dynamic>{}),
|
||||
],
|
||||
),
|
||||
),
|
||||
desktop: Scrollbar(
|
||||
isAlwaysShown: true,
|
||||
thumbVisibility: true,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
DesktopIndexCarousel(galleries),
|
||||
DesktopIndexMainContent1(content1Message),
|
||||
DesktopIndexMainContent2(content2),
|
||||
DesktopIndexMainContent1(content1Message ?? ''),
|
||||
DesktopIndexMainContent2(content2 ?? <String, dynamic>{}),
|
||||
CustomersLogo(),
|
||||
DesktopIndexMainContent3(content2),
|
||||
DesktopIndexMainContent3(content2 ?? <String, dynamic>{}),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -136,7 +136,7 @@ class HomeState extends State<Home> {
|
||||
_loadData();
|
||||
eventBus.on<OpenDrawer>().listen((event) {
|
||||
if (mounted) {
|
||||
_scaffoldKey.currentState.openDrawer();
|
||||
_scaffoldKey.currentState?.openDrawer();
|
||||
}
|
||||
});
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||
@@ -163,7 +163,7 @@ class HomeState extends State<Home> {
|
||||
if (!mounted) return;
|
||||
_latestUri = Uri.base;
|
||||
print('uri base $_latestUri');
|
||||
eventBus.fire(OnGotDeepLinkUri(_latestUri));
|
||||
eventBus.fire(OnGotDeepLinkUri(_latestUri!));
|
||||
} else {
|
||||
// _sub = getUriLinksStream().listen((Uri uri) {
|
||||
// print('_sub should get uri $uri');
|
||||
@@ -189,7 +189,7 @@ class HomeState extends State<Home> {
|
||||
//
|
||||
// if (!mounted) return;
|
||||
// _latestUri = initialUri;
|
||||
// eventBus.fire(OnGotDeepLinkUri(_latestUri));
|
||||
// eventBus.fire(OnGotDeepLinkUri(_latestUri!));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user