forked from lxm_flutter/FlutterUnit
✨ 升级稳定版Flutter 1.20.3
This commit is contained in:
@@ -32,10 +32,10 @@
|
||||
|
||||
```
|
||||
a1@toly ~ % flutter --version
|
||||
Flutter 1.20.1 • channel stable • https://github.com/flutter/flutter.git
|
||||
Framework • revision 2ae34518b8 (2 days ago) • 2020-08-05 19:53:19 -0700
|
||||
Engine • revision c8e3b94853
|
||||
Tools • Dart 2.9.0
|
||||
Flutter 1.20.3 • channel stable • https://github.com/flutter/flutter.git
|
||||
Framework • revision 216dee60c0 (10 days ago) • 2020-09-01 12:24:47 -0700
|
||||
Engine • revision d1bc06f032
|
||||
Tools • Dart 2.9.2
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
@@ -14,14 +14,20 @@ import 'package:flutter_unit/storage/app_storage.dart';
|
||||
|
||||
final storage = AppStorage();
|
||||
|
||||
class BlocWrapper extends StatelessWidget {
|
||||
class BlocWrapper extends StatefulWidget {
|
||||
final Widget child;
|
||||
|
||||
BlocWrapper({this.child});
|
||||
|
||||
final repository = WidgetDbRepository(storage);
|
||||
final categoryRepo = CategoryDbRepository(storage);
|
||||
@override
|
||||
_BlocWrapperState createState() => _BlocWrapperState();
|
||||
}
|
||||
|
||||
class _BlocWrapperState extends State<BlocWrapper> {
|
||||
final repository = WidgetDbRepository(storage);
|
||||
|
||||
final categoryBloc = CategoryBloc(repository: CategoryDbRepository(storage));
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MultiBlocProvider(//使用MultiBlocProvider包裹
|
||||
@@ -38,17 +44,26 @@ class BlocWrapper extends StatelessWidget {
|
||||
create: (_) => DetailBloc(repository: repository)),
|
||||
|
||||
BlocProvider<CategoryBloc>(
|
||||
create: (_) =>
|
||||
CategoryBloc(repository: categoryRepo)..add(EventLoadCategory())),
|
||||
create: (_) => categoryBloc..add(EventLoadCategory())),
|
||||
|
||||
BlocProvider<CollectBloc>(
|
||||
create: (_) =>
|
||||
CollectBloc(repository: repository)..add(EventSetCollectData())),
|
||||
|
||||
BlocProvider<CategoryWidgetBloc>(
|
||||
create: (_) =>
|
||||
CategoryWidgetBloc(categoryBloc: categoryBloc)),
|
||||
|
||||
BlocProvider<SearchBloc>(
|
||||
create: (_) => SearchBloc(repository: repository)),
|
||||
BlocProvider<PointBloc>(create: (_) => PointBloc()),
|
||||
BlocProvider<PointCommentBloc>(create: (_) => PointCommentBloc()),
|
||||
], child: child);
|
||||
], child: widget.child);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
categoryBloc.close();
|
||||
super.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,10 +12,7 @@ class FlutterUnit extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<GlobalBloc, GlobalState>(builder: (_, state) {
|
||||
return BlocProvider<CategoryWidgetBloc>(
|
||||
create: (_) => CategoryWidgetBloc(
|
||||
categoryBloc: BlocProvider.of<CategoryBloc>(context)),
|
||||
child: MaterialApp(
|
||||
return MaterialApp(
|
||||
// debugShowMaterialGrid: true,
|
||||
showPerformanceOverlay: state.showPerformanceOverlay,
|
||||
// showSemanticsDebugger: true,
|
||||
@@ -28,7 +25,7 @@ class FlutterUnit extends StatelessWidget {
|
||||
primarySwatch: state.themeColor,
|
||||
fontFamily: state.fontFamily,
|
||||
),
|
||||
home: UnitSplash()),
|
||||
home: UnitSplash(),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class LoadingPage extends StatelessWidget {
|
||||
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
return Container(
|
||||
height: 300,
|
||||
alignment: Alignment.center,
|
||||
child: CircularProgressIndicator(backgroundColor: Colors.blue,valueColor:AlwaysStoppedAnimation<Color>(Colors.orangeAccent) ,),
|
||||
child: CircularProgressIndicator(
|
||||
backgroundColor: Colors.blue,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(Colors.orangeAccent),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user