mirror of
https://github.com/asjqkkkk/flutter-todos.git
synced 2025-08-06 14:19:24 +08:00
解决一个小bug,同时详情页面不会出现边框遮拦动画的事件了
This commit is contained in:
@ -32,32 +32,41 @@ class ProviderConfig {
|
||||
}
|
||||
|
||||
ChangeNotifierProvider<TaskDetailPageModel> getTaskDetailPage(
|
||||
int index, TaskBean taskBean,) {
|
||||
int index,
|
||||
TaskBean taskBean,
|
||||
) {
|
||||
return ChangeNotifierProvider<TaskDetailPageModel>(
|
||||
builder: (context) => TaskDetailPageModel(taskBean),
|
||||
child: TaskDetailPage(index,),
|
||||
child: TaskDetailPage(
|
||||
index,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
ChangeNotifierProvider<EditTaskPageModel> getEditTaskPage(TaskIconBean taskIcon,{MainPageModel mainPageModel, TaskBean taskBean}){
|
||||
ChangeNotifierProvider<EditTaskPageModel> getEditTaskPage(
|
||||
TaskIconBean taskIcon,
|
||||
{MainPageModel mainPageModel,
|
||||
TaskBean taskBean}) {
|
||||
return ChangeNotifierProvider<EditTaskPageModel>(
|
||||
builder:(context) => EditTaskPageModel(oldTaskBean: taskBean),
|
||||
child: EditTaskPage(taskIcon,mainPageModel: mainPageModel,),
|
||||
builder: (context) => EditTaskPageModel(oldTaskBean: taskBean),
|
||||
child: EditTaskPage(
|
||||
taskIcon,
|
||||
mainPageModel: mainPageModel,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
ChangeNotifierProvider<IconSettingPageModel> getIconSettingPage(){
|
||||
ChangeNotifierProvider<IconSettingPageModel> getIconSettingPage() {
|
||||
return ChangeNotifierProvider<IconSettingPageModel>(
|
||||
builder:(context) => IconSettingPageModel(),
|
||||
builder: (context) => IconSettingPageModel(),
|
||||
child: IconSettingPage(),
|
||||
);
|
||||
}
|
||||
|
||||
ChangeNotifierProvider<ThemePageModel> getThemePage(){
|
||||
ChangeNotifierProvider<ThemePageModel> getThemePage() {
|
||||
return ChangeNotifierProvider<ThemePageModel>(
|
||||
builder:(context) => ThemePageModel(),
|
||||
builder: (context) => ThemePageModel(),
|
||||
child: ThemePage(),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import 'package:flutter/services.dart';
|
||||
import 'package:todo_list/json/color_bean.dart';
|
||||
export 'package:todo_list/json/color_bean.dart';
|
||||
|
||||
|
||||
class TaskIconBean {
|
||||
String taskName;
|
||||
IconBean iconBean;
|
||||
@ -30,7 +29,6 @@ class TaskIconBean {
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
Map<dynamic, dynamic> toMap() {
|
||||
return {
|
||||
'taskName': taskName,
|
||||
@ -40,7 +38,6 @@ class TaskIconBean {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class IconBean {
|
||||
int codePoint;
|
||||
String fontFamily;
|
||||
@ -55,8 +52,8 @@ class IconBean {
|
||||
this.iconName,
|
||||
this.matchTextDirection});
|
||||
|
||||
static IconData fromBean(IconBean bean) =>
|
||||
IconData(bean.codePoint, fontFamily: bean.fontFamily, fontPackage: bean.fontPackage == "null" ? null : bean.fontPackage);
|
||||
static IconData fromBean(IconBean bean) => IconData(bean.codePoint,
|
||||
fontFamily: bean.fontFamily,);
|
||||
|
||||
static IconBean fromMap(Map<String, dynamic> map) {
|
||||
IconBean bean = new IconBean();
|
||||
@ -64,7 +61,7 @@ class IconBean {
|
||||
bean.fontFamily = map['fontFamily'];
|
||||
bean.fontPackage = map['fontPackage'];
|
||||
bean.iconName = map['iconName'];
|
||||
bean.matchTextDirection = map['taskStatus'] == 'ture';
|
||||
bean.matchTextDirection = map['matchTextDirection'] == 'ture';
|
||||
return bean;
|
||||
}
|
||||
|
||||
@ -93,9 +90,9 @@ class IconBean {
|
||||
Map<dynamic, dynamic> toMap() {
|
||||
return {
|
||||
'codePoint': codePoint.toString(),
|
||||
'fontFamily': fontFamily??"",
|
||||
'fontPackage': fontPackage??"",
|
||||
'iconName': iconName??"",
|
||||
'fontFamily': fontFamily ?? "",
|
||||
'fontPackage': fontPackage ?? "",
|
||||
'iconName': iconName ?? "",
|
||||
'matchTextDirection': matchTextDirection.toString()
|
||||
};
|
||||
}
|
||||
|
@ -197,13 +197,22 @@ class EditTaskPageLogic {
|
||||
|
||||
//修改旧的任务
|
||||
void submitOldTask() async{
|
||||
TaskBean taskBean = await transformDataToBean(id: _model.oldTaskBean.id);
|
||||
TaskBean taskBean = await transformDataToBean(id: _model.oldTaskBean.id,overallProgress: _getOverallProgress());
|
||||
DBProvider.db.updateTask(taskBean);
|
||||
_model.mainPageModel.logic.getTasks();
|
||||
Navigator.of(_model.context).popUntil((route) => route.isFirst);
|
||||
}
|
||||
|
||||
Future<TaskBean> transformDataToBean({int id}) async {
|
||||
double _getOverallProgress(){
|
||||
int length = _model.taskDetails.length;
|
||||
double overallProgress = 0.0;
|
||||
for(int i = 0; i < length;i++){
|
||||
overallProgress += _model.taskDetails[i].itemProgress / length;
|
||||
}
|
||||
return overallProgress;
|
||||
}
|
||||
|
||||
Future<TaskBean> transformDataToBean({int id, double overallProgress = 0.0}) async {
|
||||
final account = await SharedUtil.instance.getString(Keys.account) ?? "default";
|
||||
final taskName = _model.currentTaskName.isEmpty ? _model.taskIcon.taskName : _model.currentTaskName;
|
||||
TaskBean taskBean = TaskBean(
|
||||
@ -216,6 +225,7 @@ class EditTaskPageLogic {
|
||||
deadLine: _model.deadLine?.toIso8601String(),
|
||||
detailList: _model.taskDetails,
|
||||
taskIconBean: _model.taskIcon,
|
||||
overallProgress: overallProgress,
|
||||
);
|
||||
if(id != null){
|
||||
taskBean.id = id;
|
||||
|
@ -23,10 +23,12 @@ class TaskDetailPage extends StatelessWidget {
|
||||
final globalModel = Provider.of<GlobalModel>(context);
|
||||
final mainPageModel = globalModel.mainPageModel;
|
||||
model.setContext(context);
|
||||
final taskColor = globalModel.isCardChangeWithBg ? Theme.of(context).primaryColor : ColorBean.fromBean(model.taskBean.taskIconBean.colorBean);
|
||||
final taskColor = globalModel.isCardChangeWithBg
|
||||
? Theme.of(context).primaryColor
|
||||
: ColorBean.fromBean(model.taskBean.taskIconBean.colorBean);
|
||||
|
||||
return WillPopScope(
|
||||
onWillPop: (){
|
||||
onWillPop: () {
|
||||
model.logic.exitPage();
|
||||
},
|
||||
child: Stack(
|
||||
@ -45,8 +47,11 @@ class TaskDetailPage extends StatelessWidget {
|
||||
iconTheme: IconThemeData(color: taskColor),
|
||||
leading: model.isAnimationComplete && !model.isExiting
|
||||
? IconButton(
|
||||
icon: Icon(Platform.isAndroid ? Icons.arrow_back : Icons.arrow_back_ios),
|
||||
onPressed: model.logic.exitPage,)
|
||||
icon: Icon(Platform.isAndroid
|
||||
? Icons.arrow_back
|
||||
: Icons.arrow_back_ios),
|
||||
onPressed: model.logic.exitPage,
|
||||
)
|
||||
: SizedBox(),
|
||||
elevation: 0,
|
||||
backgroundColor: Colors.transparent,
|
||||
@ -73,32 +78,55 @@ class TaskDetailPage extends StatelessWidget {
|
||||
)),
|
||||
Expanded(
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(
|
||||
left: 50, top: 20, right: 50, bottom: 20),
|
||||
margin: EdgeInsets.only(top: 20),
|
||||
child: !model.isExiting
|
||||
? ListView(
|
||||
? NotificationListener<
|
||||
OverscrollIndicatorNotification>(
|
||||
onNotification: (overScroll) {
|
||||
overScroll.disallowGlow();
|
||||
},
|
||||
child: ListView(
|
||||
children: List.generate(
|
||||
model?.taskBean?.detailList?.length ?? 0,
|
||||
(index) {
|
||||
TaskDetailBean taskDetailBean =
|
||||
model.taskBean.detailList[index];
|
||||
return TaskDetailItem(
|
||||
return Container(
|
||||
margin: EdgeInsets.only(
|
||||
bottom: index ==
|
||||
model.taskBean.detailList
|
||||
.length -
|
||||
1
|
||||
? 20
|
||||
: 0,
|
||||
left: 50,right: 50
|
||||
),
|
||||
child: TaskDetailItem(
|
||||
index: index,
|
||||
itemProgress: taskDetailBean.itemProgress,
|
||||
itemName: taskDetailBean.taskDetailName,
|
||||
itemProgress:
|
||||
taskDetailBean.itemProgress,
|
||||
itemName:
|
||||
taskDetailBean.taskDetailName,
|
||||
iconColor: taskColor,
|
||||
onProgressChanged: (progress) {
|
||||
model.logic.refreshProgress(
|
||||
taskDetailBean, progress, mainPageModel);
|
||||
taskDetailBean,
|
||||
progress,
|
||||
mainPageModel);
|
||||
model.refresh();
|
||||
},
|
||||
onChecked: (progress) {
|
||||
model.logic.refreshProgress(
|
||||
taskDetailBean, progress, mainPageModel);
|
||||
taskDetailBean,
|
||||
progress,
|
||||
mainPageModel);
|
||||
model.refresh();
|
||||
},
|
||||
),
|
||||
);
|
||||
}))
|
||||
},
|
||||
),
|
||||
))
|
||||
: SizedBox(),
|
||||
),
|
||||
)
|
||||
|
@ -16,7 +16,7 @@ class IconUtil {
|
||||
List<IconData> get icons => _icons;
|
||||
|
||||
|
||||
|
||||
List<String> get iconNames => _iconNames;
|
||||
|
||||
|
||||
List<IconData> _icons = [
|
||||
@ -1007,7 +1007,7 @@ class IconUtil {
|
||||
Icons.zoom_out_map
|
||||
];
|
||||
|
||||
List<String> iconNames = [
|
||||
List<String> _iconNames = [
|
||||
"threesixty",
|
||||
"threed_rotation",
|
||||
"four_k",
|
||||
|
Reference in New Issue
Block a user