过时组件显示优化,数据库结构优化

This commit is contained in:
toly
2021-04-03 16:25:11 +08:00
parent 269f610d18
commit 8a3ab24e8b
27 changed files with 318 additions and 231 deletions

View File

@@ -1,7 +1,8 @@
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_unit/app/res/cons.dart';
import 'package:flutter_unit/app/res/sp.dart';
import 'package:flutter_unit/repositories/app_storage.dart';
import 'package:flutter_unit/repositories/app_start.dart';
import 'package:flutter_unit/repositories/local_storage.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'global_event.dart';
@@ -13,11 +14,11 @@ import 'global_state.dart';
class GlobalBloc extends Bloc<GlobalEvent, GlobalState> {
final AppStorage storage;
final AppStart storage;
GlobalBloc(this.storage):super(GlobalState());
Future<SharedPreferences> get sp => storage.sp;
Future<SharedPreferences> get sp => LocalStorage.sp;
@override
Stream<GlobalState> mapEventToState(GlobalEvent event) async* {
@@ -29,8 +30,7 @@ class GlobalBloc extends Bloc<GlobalEvent, GlobalState> {
// 切换字体事件处理 : 固化索引 + 产出新状态
if (event is EventSwitchFontFamily) {
int familyIndex = Cons.fontFamilySupport.indexOf(event.family);
await sp
..setInt(SP.fontFamily, familyIndex);
await sp..setInt(SP.fontFamily, familyIndex);
yield state.copyWith(fontFamily: event.family);
}