1.修复一个小bug

2.当前donelist的样式算是敲定了吧
This commit is contained in:
oldchen
2019-07-21 14:51:52 +08:00
parent 6a5ec7e5ba
commit c69eb866e5
16 changed files with 436 additions and 172 deletions

View File

@ -22,24 +22,33 @@ class DBProvider {
initDB() async {
var dataBasePath = await getDatabasesPath();
String path = join(dataBasePath, "todo.db");
return await openDatabase(path, version: 1, onOpen: (db) {},
onCreate: (Database db, int version) async {
await db.execute("CREATE TABLE TodoList ("
"id INTEGER PRIMARY KEY AUTOINCREMENT,"
"account TEXT,"
"taskName TEXT,"
"taskType TEXT,"
"taskStatus INTEGER,"
"taskDetailNum INTEGER,"
"overallProgress TEXT,"
"createDate TEXT,"
"finishDate TEXT,"
"startDate TEXT,"
"deadLine TEXT,"
"detailList TEXT,"
"taskIconBean TEXT"
")");
});
return await openDatabase(
path,
version: 2,
onOpen: (db) {},
onCreate: (Database db, int version) async {
await db.execute("CREATE TABLE TodoList ("
"id INTEGER PRIMARY KEY AUTOINCREMENT,"
"account TEXT,"
"taskName TEXT,"
"taskType TEXT,"
"taskStatus INTEGER,"
"taskDetailNum INTEGER,"
"overallProgress TEXT,"
"createDate TEXT,"
"finishDate TEXT,"
"startDate TEXT,"
"deadLine TEXT,"
"detailList TEXT,"
"taskIconBean TEXT"
")");
},
onUpgrade: (Database db, int oldVersion, int newVersion) async{
if(oldVersion < 2){
await db.execute("ALTER TABLE TodoList ADD COLUMN changeTimes INTEGER DEFAULT 0");
}
},
);
//注意,上面创建表的时候最后一行不能带逗号
}
@ -54,8 +63,10 @@ class DBProvider {
final db = await database;
final account =
await SharedUtil.instance.getString(Keys.account) ?? "default";
var list =
await db.query("TodoList", where: "account = ?" + (isDone ? " AND overallProgress = ?" : " AND overallProgress != ?"), whereArgs: [account, "1.0"]);
var list = await db.query("TodoList",
where: "account = ?" +
(isDone ? " AND overallProgress >= ?" : " AND overallProgress < ?"),
whereArgs: [account, "1.0"]);
List<TaskBean> beans = [];
beans.clear();
beans.addAll(TaskBean.fromMapList(list));
@ -81,11 +92,10 @@ class DBProvider {
final account =
await SharedUtil.instance.getString(Keys.account) ?? "default";
var list = await db.query("TodoList",
where:
"account = ? AND (taskName LIKE ? "
"OR detailList LIKE ? "
"OR startDate LIKE ? "
"OR deadLine LIKE ?)",
where: "account = ? AND (taskName LIKE ? "
"OR detailList LIKE ? "
"OR startDate LIKE ? "
"OR deadLine LIKE ?)",
whereArgs: [
account,
"%$query%",

View File

@ -24,6 +24,33 @@ class DemoLocalizations {
String get doneList => Intl.message('Done List', name: 'doneList', desc: '完成列表',);
String get toFinishTask => Intl.message('Try to complete a task!', name: 'toFinishTask', desc: '努力去完成一项任务吧!',);
String get taskNum => Intl.message('Task Number', name: 'taskNum', desc: '任务数',);
String get createDate => Intl.message('Create Date', name: 'createDate', desc: '创建日期',);
String get completeDate => Intl.message('Complete Date', name: 'completeDate', desc: '完成日期',);
String get spendTime => Intl.message('Spend Time', name: 'spendTime', desc: '用时',);
String get changedTimes => Intl.message('Changed Times', name: 'changedTimes', desc: '修改次数',);
String hours(int hours){
return Intl.plural(
hours,
zero: "Too Fast",
one: "1 hour",
many: "$hours hours",
other:"$hours hours",
args: [hours],
name: "hours"
);
}
String days(int days){
return Intl.plural(
days,
zero: "Too Fast",
one: "1 day",
many: "$days days",
other:"$days days",
args: [days],
name: "days"
);
}
String get languageTitle {
@ -116,10 +143,6 @@ class DemoLocalizations {
String get openSystemSetting => Intl.message('Open System Setting', name: 'openSystemSetting', desc: '打开系统设置',);
String get checkUpdate {
return Intl.message(
'Check Update',

View File

@ -20,9 +20,13 @@ typedef MessageIfAbsent(String message_str, List args);
class MessageLookup extends MessageLookupByLibrary {
get localeName => 'en_US';
static m0(number) => "${Intl.plural(number, zero: 'There is No items ', one: '1 item ', other: '${number} items ')}";
static m0(days) => "${Intl.plural(days, zero: 'Too Fast', one: '1 day', many: '${days} days', other: '${days} days')}";
static m1(taskNumbers) => "${Intl.plural(taskNumbers, zero: 'You have never written a list of tasks.\nLet\'s get started soon.', one: 'This is your todo-list,\nToday, you have 1 task to complete. ', many: 'This is your todo-list,\nToday, you have ${taskNumbers} tasks to complete. ', other: 'This is your todo-list,\nToday, you have ${taskNumbers} tasks to complete. ')}";
static m1(hours) => "${Intl.plural(hours, zero: 'Too Fast', one: '1 hour', many: '${hours} hours', other: '${hours} hours')}";
static m2(number) => "${Intl.plural(number, zero: 'There is No items ', one: '1 item ', other: '${number} items ')}";
static m3(taskNumbers) => "${Intl.plural(taskNumbers, zero: 'You have never written a list of tasks.\nLet\'s get started soon.', one: 'This is your todo-list,\nToday, you have 1 task to complete. ', many: 'This is your todo-list,\nToday, you have ${taskNumbers} tasks to complete. ', other: 'This is your todo-list,\nToday, you have ${taskNumbers} tasks to complete. ')}";
final messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => <String, Function> {
@ -43,14 +47,18 @@ class MessageLookup extends MessageLookupByLibrary {
"cancel" : MessageLookupByLibrary.simpleMessage("cancel"),
"cardChangeWithBg" : MessageLookupByLibrary.simpleMessage("Task icon color follow background"),
"changeTheme" : MessageLookupByLibrary.simpleMessage("Change Theme"),
"changedTimes" : MessageLookupByLibrary.simpleMessage("Changed Times"),
"checkUpdate" : MessageLookupByLibrary.simpleMessage("Check Update"),
"coffee" : MessageLookupByLibrary.simpleMessage("coffee"),
"completeDate" : MessageLookupByLibrary.simpleMessage("Finish Date"),
"createDate" : MessageLookupByLibrary.simpleMessage("Create Date"),
"currentIcons" : MessageLookupByLibrary.simpleMessage("Current Icons"),
"customIcon" : MessageLookupByLibrary.simpleMessage("Custom Icon"),
"customTheme" : MessageLookupByLibrary.simpleMessage("Custom Theme"),
"cyan" : MessageLookupByLibrary.simpleMessage("cyan"),
"dailyPic" : MessageLookupByLibrary.simpleMessage("Daily wallpaper"),
"dark" : MessageLookupByLibrary.simpleMessage("dark"),
"days" : m0,
"deadline" : MessageLookupByLibrary.simpleMessage("deadline"),
"defaultIconName" : MessageLookupByLibrary.simpleMessage("default"),
"defaultTitle" : MessageLookupByLibrary.simpleMessage("Default title"),
@ -64,8 +72,9 @@ class MessageLookup extends MessageLookupByLibrary {
"game" : MessageLookupByLibrary.simpleMessage("Game"),
"green" : MessageLookupByLibrary.simpleMessage("green"),
"history" : MessageLookupByLibrary.simpleMessage("history"),
"hours" : m1,
"iconSetting" : MessageLookupByLibrary.simpleMessage("Icon Setting"),
"itemNumber" : m0,
"itemNumber" : m2,
"languageTitle" : MessageLookupByLibrary.simpleMessage("Change Language"),
"loading" : MessageLookupByLibrary.simpleMessage("loading..."),
"loadingEmpty" : MessageLookupByLibrary.simpleMessage("nothing at all"),
@ -88,11 +97,13 @@ class MessageLookup extends MessageLookupByLibrary {
"repeat" : MessageLookupByLibrary.simpleMessage("repeat"),
"restrictedDes" : MessageLookupByLibrary.simpleMessage("Permission is restricted"),
"setIconName" : MessageLookupByLibrary.simpleMessage("icon name"),
"spendTime" : MessageLookupByLibrary.simpleMessage("Spend Time"),
"sports" : MessageLookupByLibrary.simpleMessage("Sports"),
"startAfterEnd" : MessageLookupByLibrary.simpleMessage("The start date need be smaller than the end date."),
"startDate" : MessageLookupByLibrary.simpleMessage("start date"),
"submit" : MessageLookupByLibrary.simpleMessage("Submit"),
"taskItems" : m1,
"taskItems" : m3,
"taskNum" : MessageLookupByLibrary.simpleMessage("Task Number"),
"toFinishTask" : MessageLookupByLibrary.simpleMessage("Try to complete a task!"),
"travel" : MessageLookupByLibrary.simpleMessage("Travel"),
"unknownDes" : MessageLookupByLibrary.simpleMessage("Unknown permission"),

View File

@ -20,9 +20,13 @@ typedef MessageIfAbsent(String message_str, List args);
class MessageLookup extends MessageLookupByLibrary {
get localeName => 'zh_CN';
static m0(number) => "${Intl.plural(number, zero: '还没有任务详情哦 ', one: '1 ', other: '${number} ')}";
static m0(days) => "${Intl.plural(days, zero: '太快了!', one: '1 ', many: '${days} 天', other: '${days} ')}";
static m1(taskNumbers) => "${Intl.plural(taskNumbers, zero: '你还没有写过任务清单呢.\n快快开始吧.', one: '下面你的任务清单,\n今天, 你有 1 项任务尚未完成. ', many: '下面是你的任务清单,\n今天, 你有 ${taskNumbers} 份任务尚未完成. ', other: '下面是你的任务清单,\n今天, 你有 ${taskNumbers} 份任务尚未完成. ')}";
static m1(hours) => "${Intl.plural(hours, zero: '太快了!', one: '1 小时', many: '${hours} 小时', other: '${hours} 小时')}";
static m2(number) => "${Intl.plural(number, zero: '还没有任务详情哦 ', one: '1 项 ', other: '${number} 项 ')}";
static m3(taskNumbers) => "${Intl.plural(taskNumbers, zero: '你还没有写过任务清单呢.\n快快开始吧.', one: '下面你的任务清单,\n今天, 你有 1 项任务尚未完成. ', many: '下面是你的任务清单,\n今天, 你有 ${taskNumbers} 份任务尚未完成. ', other: '下面是你的任务清单,\n今天, 你有 ${taskNumbers} 份任务尚未完成. ')}";
final messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => <String, Function> {
@ -43,14 +47,18 @@ class MessageLookup extends MessageLookupByLibrary {
"cancel" : MessageLookupByLibrary.simpleMessage("取消"),
"cardChangeWithBg" : MessageLookupByLibrary.simpleMessage("任务图标颜色跟随背景"),
"changeTheme" : MessageLookupByLibrary.simpleMessage("切换主题"),
"changedTimes" : MessageLookupByLibrary.simpleMessage("修改次数"),
"checkUpdate" : MessageLookupByLibrary.simpleMessage("检查更新"),
"coffee" : MessageLookupByLibrary.simpleMessage("想入啡啡"),
"completeDate" : MessageLookupByLibrary.simpleMessage("完成日期"),
"createDate" : MessageLookupByLibrary.simpleMessage("创建日期"),
"currentIcons" : MessageLookupByLibrary.simpleMessage("当前图标"),
"customIcon" : MessageLookupByLibrary.simpleMessage("自定义图标"),
"customTheme" : MessageLookupByLibrary.simpleMessage("自定义主题"),
"cyan" : MessageLookupByLibrary.simpleMessage("蓝天白云"),
"dailyPic" : MessageLookupByLibrary.simpleMessage("每日壁纸"),
"dark" : MessageLookupByLibrary.simpleMessage("不见五指"),
"days" : m0,
"deadline" : MessageLookupByLibrary.simpleMessage("截止日期"),
"defaultIconName" : MessageLookupByLibrary.simpleMessage("默认"),
"defaultTitle" : MessageLookupByLibrary.simpleMessage("默认标题"),
@ -64,8 +72,9 @@ class MessageLookup extends MessageLookupByLibrary {
"game" : MessageLookupByLibrary.simpleMessage("打游戏"),
"green" : MessageLookupByLibrary.simpleMessage("青青草原"),
"history" : MessageLookupByLibrary.simpleMessage("历史"),
"hours" : m1,
"iconSetting" : MessageLookupByLibrary.simpleMessage("图标设置"),
"itemNumber" : m0,
"itemNumber" : m2,
"languageTitle" : MessageLookupByLibrary.simpleMessage("切换语言"),
"loading" : MessageLookupByLibrary.simpleMessage("加载中..."),
"loadingEmpty" : MessageLookupByLibrary.simpleMessage("什么都没有哦"),
@ -88,11 +97,13 @@ class MessageLookup extends MessageLookupByLibrary {
"repeat" : MessageLookupByLibrary.simpleMessage("重复"),
"restrictedDes" : MessageLookupByLibrary.simpleMessage("权限被限制"),
"setIconName" : MessageLookupByLibrary.simpleMessage("图标名"),
"spendTime" : MessageLookupByLibrary.simpleMessage("用时"),
"sports" : MessageLookupByLibrary.simpleMessage("运动"),
"startAfterEnd" : MessageLookupByLibrary.simpleMessage("开始日期要比结束日期小才行哦"),
"startDate" : MessageLookupByLibrary.simpleMessage("开始日期"),
"submit" : MessageLookupByLibrary.simpleMessage("提交"),
"taskItems" : m1,
"taskItems" : m3,
"taskNum" : MessageLookupByLibrary.simpleMessage("任务数"),
"toFinishTask" : MessageLookupByLibrary.simpleMessage("努力去完成一项任务吧"),
"travel" : MessageLookupByLibrary.simpleMessage("旅行"),
"unknownDes" : MessageLookupByLibrary.simpleMessage("未知权限"),

View File

@ -24,7 +24,7 @@ class TaskItem extends StatelessWidget {
final widget = TaskInfoWidget(
index,
space: (minSize - 100) / 4,
space: 21,
taskBean: taskBean,
onDelete: onDelete,
onEdit: onEdit,
@ -38,7 +38,6 @@ class TaskItem extends StatelessWidget {
Hero(
tag: "task_bg${index}",
child: Container(
height: minSize,
decoration: BoxDecoration(
color: globalModel.logic.getBgInDark(),
borderRadius: BorderRadius.circular(15.0),
@ -46,7 +45,6 @@ class TaskItem extends StatelessWidget {
),
),
Container(
height: minSize,
child: Card(
margin: EdgeInsets.all(0),
shape: RoundedRectangleBorder(
@ -54,11 +52,7 @@ class TaskItem extends StatelessWidget {
),
child: Container(
margin: EdgeInsets.only(left: 16, right: 16),
child: minSize < 600
? SingleChildScrollView(
child: widget,
)
: widget,
child: widget,
),
),
),

View File

@ -12,6 +12,9 @@ class TaskBean {
int taskDetailNum = 0;
double overallProgress;
//任务修改次数
int changeTimes;
//创建任务的时间
String createDate;
@ -34,6 +37,7 @@ class TaskBean {
this.taskStatus = TaskStatus.todo,
this.taskDetailNum,
this.overallProgress = 0.0,
this.changeTimes = 0,
this.createDate = "",
this.finishDate = "",
this.account = "default",
@ -50,6 +54,7 @@ class TaskBean {
taskBean.taskDetailNum = map['taskDetailNum'];
taskBean.taskStatus = map['taskStatus'];
taskBean.account = map['account'];
taskBean.changeTimes = map['changeTimes'] ?? 0;
taskBean.overallProgress = double.parse(map['overallProgress']);
taskBean.createDate = map['createDate'];
taskBean.finishDate = map['finishDate'];
@ -84,9 +89,10 @@ class TaskBean {
'taskType': taskType,
'taskStatus': taskStatus,
'taskDetailNum': taskDetailNum,
'overallProgress': overallProgress.toString(),
'overallProgress': (overallProgress >= 1.0 ? 1.0 : overallProgress).toString(),
'createDate': createDate,
'account': account,
'changeTimes': changeTimes ?? 0,
'finishDate': finishDate,
'startDate': startDate,
'deadLine': deadLine,

View File

@ -1,6 +1,7 @@
import 'package:flutter/cupertino.dart';
import 'package:todo_list/config/provider_config.dart';
import 'package:todo_list/database/database.dart';
import 'package:todo_list/i10n/localization_intl.dart';
import 'package:todo_list/json/task_bean.dart';
import 'package:todo_list/model/all_model.dart';
@ -37,11 +38,14 @@ class DoneTaskPageLogic {
return "${time.year}-${time.month}-${time.day}";
}
String getDiffTimeText(String dateStart, String dateEnd){
String getDiffTimeText(String dateStart, String dateEnd) {
DateTime timeStart = DateTime.parse(dateStart);
DateTime timeEnd = DateTime.parse(dateEnd);
Duration diff = timeStart.difference(timeEnd);
Duration diff = timeStart.difference(timeEnd);
final context = _model.context;
return diff.inDays == 0 ? "${diff.inHours} 小时" : "${diff.inDays}";
return diff.inDays == 0
? "${DemoLocalizations.of(context).hours(diff.inHours)}"
: "${DemoLocalizations.of(context).days(diff.inDays)}";
}
}

View File

@ -229,6 +229,7 @@ class EditTaskPageLogic {
return;
}
TaskBean taskBean = await transformDataToBean(id: _model.oldTaskBean.id,overallProgress: _getOverallProgress());
taskBean.changeTimes++;
DBProvider.db.updateTask(taskBean);
await _model.mainPageModel.logic.getTasks();
_model.mainPageModel.refresh();

View File

@ -33,10 +33,11 @@ class TaskDetailPageLogic {
final mainPageModel = _model.globalModel.mainPageModel;
bool needUpdate = needUpdateDatabase();
if (needUpdate && !isDeleting) {
if (_model.taskBean.overallProgress == 1.0) {
if (_model.taskBean.overallProgress >= 1.0) {
_model.taskBean.finishDate = DateTime.now().toIso8601String();
mainPageModel.tasks.removeAt(mainPageModel.currentTapIndex);
}
_model.taskBean.changeTimes++;
DBProvider.db.updateTask(_model.taskBean).then((value){
if (_model.doneTaskPageModel != null) {
mainPageModel.logic.getTasks();

View File

@ -1,5 +1,6 @@
import 'dart:math';
import 'package:circle_list/circle_list.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
@ -13,10 +14,15 @@ import 'package:todo_list/utils/theme_util.dart';
class DoneTaskPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final model = Provider.of<DoneTaskPageModel>(context)..setContext(context);
final model = Provider.of<DoneTaskPageModel>(context)
..setContext(context);
final globalModel = Provider.of<GlobalModel>(context);
final size = MediaQuery.of(context).size;
final size = MediaQuery
.of(context)
.size;
final minSize = min(size.width, size.height);
final itemHeight = minSize / 4;
final textSize = itemHeight / 10;
final textColor = globalModel.logic.getWhiteInDark();
@ -24,14 +30,18 @@ class DoneTaskPage extends StatelessWidget {
globalModel.currentThemeBean.themeType == MyTheme.darkTheme;
final bgColor = isDartNow
? ColorBean.fromBean(globalModel.currentThemeBean.colorBean)
: Theme.of(context).primaryColor;
: Theme
.of(context)
.primaryColor;
return Scaffold(
appBar: AppBar(
elevation: 0,
backgroundColor: globalModel.logic.getBgInDark(),
title: Text(
DemoLocalizations.of(context).doneList,
DemoLocalizations
.of(context)
.doneList,
style: TextStyle(
color: bgColor,
),
@ -45,126 +55,185 @@ class DoneTaskPage extends StatelessWidget {
alignment: Alignment.center,
child: model.doneTasks.length > 0
? ListView.builder(
itemCount: model.doneTasks.length,
itemBuilder: (ctx, index) {
final task = model.doneTasks[index];
final colorBean = task.taskIconBean.colorBean;
final iconBean = task.taskIconBean.iconBean;
final color = isDartNow
? Colors.black.withOpacity(0.2)
: ColorBean.fromBean(colorBean);
return Row(
children: <Widget>[
SizedBox(width: 20,),
Column(
children: <Widget>[
index == 0
? SizedBox(
height: 50,
)
: Container(
color: color,
width: 2,
height: 50,
),
Container(
width: 40,
height: 40,
decoration: BoxDecoration(
border: Border.all(
color: color,
),
shape: BoxShape.circle),
child: Icon(
IconBean.fromBean(iconBean),
color: color,
),
),
index == model.doneTasks.length - 1
? SizedBox(
height: 50,
)
: Container(
color: color,
width: 2,
height: 50,
),
],
),
Container(
height: 1,
width: 20,
color: color,
),
Column(
children: <Widget>[
InkWell(
onTap: () => model.logic.onTaskTap(index, task),
child: Container(
height: 120,
child: ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30),
bottomRight: Radius.circular(30)),
child: Container(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Text(
task.taskName,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: textColor,
),
),
Text(
"任务数:${task.taskDetailNum}",
style: TextStyle(
fontSize: 12,
color: textColor,
),
),
Text(
"创建日期:${model.logic.getTimeText(task.createDate)}",
style: TextStyle(
fontSize: 12,
color: textColor,
),
),
Text(
"完成日期:${model.logic.getTimeText(task.finishDate)}",
style: TextStyle(
fontSize: 12,
color: textColor,
),
),
Text(
"用时:${model.logic.getDiffTimeText(task.finishDate, task.createDate)}",
style: TextStyle(
fontSize: 12,
color: textColor,
),
),
],
itemCount: model.doneTasks.length,
itemBuilder: (ctx, index) {
final task = model.doneTasks[index];
final colorBean = task.taskIconBean.colorBean;
final iconBean = task.taskIconBean.iconBean;
final color = isDartNow
? Colors.black.withOpacity(0.2)
: ColorBean.fromBean(colorBean);
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
InkWell(
onTap: () => model.logic.onTaskTap(index, task),
child: Container(
height: itemHeight,
width: itemHeight * 1.3,
child: ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(30),
bottomRight: Radius.circular(30)),
child: Container(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
width: itemHeight,
child: Text(
task.taskName,
maxLines: 3,
style: TextStyle(
fontSize: textSize + 8,
fontWeight: FontWeight.bold,
color: textColor,
),
color: color,
overflow: TextOverflow.ellipsis,
),
),
),
Text(
"${DemoLocalizations
.of(context)
.taskNum}:${task.taskDetailNum}",
style: TextStyle(
fontSize: textSize,
color: textColor,
),
overflow: TextOverflow.ellipsis,
),
Text(
"${DemoLocalizations
.of(context)
.createDate}:${model.logic.getTimeText(
task.createDate)}",
style: TextStyle(
fontSize: textSize,
color: textColor,
),
overflow: TextOverflow.ellipsis,
),
],
),
],
color: color,
),
),
),
),
Container(
height: 1,
width: 20,
color: color,
),
Column(
children: <Widget>[
index == 0
? SizedBox(
height: itemHeight / 2,
)
: Container(
color: color,
width: 2,
height: itemHeight / 2,
),
Container(
width: itemHeight / 3,
height: itemHeight / 3,
decoration: BoxDecoration(
border: Border.all(
color: color,
),
shape: BoxShape.circle),
child: Icon(
IconBean.fromBean(iconBean),
color: color,
),
),
index == model.doneTasks.length - 1
? SizedBox(
height: itemHeight / 2,
)
: Container(
color: color,
width: 2,
height: itemHeight / 2,
),
],
);
})
),
Container(
height: 1,
width: 20,
color: color,
),
InkWell(
onTap: () => model.logic.onTaskTap(index, task),
child: Container(
height: itemHeight,
width: itemHeight * 1.3,
child: ClipRRect(
borderRadius: BorderRadius.only(
topRight: Radius.circular(30),
bottomLeft: Radius.circular(30)),
child: Container(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
width: itemHeight,
child: Text(
"${DemoLocalizations
.of(context)
.spendTime}:${model.logic.getDiffTimeText(
task.finishDate, task.createDate)}",
maxLines: 3,
style: TextStyle(
fontSize: textSize,
color: textColor,
fontWeight: FontWeight.bold
),
overflow: TextOverflow.ellipsis,
),
),
Text(
"${DemoLocalizations
.of(context)
.changedTimes}:${task.changeTimes}",
style: TextStyle(
fontSize: textSize,
color: textColor,
),
overflow: TextOverflow.ellipsis,
),
Text(
"${DemoLocalizations
.of(context)
.completeDate}:${model.logic.getTimeText(
task.finishDate)}",
style: TextStyle(
fontSize: textSize,
color: textColor,
),
overflow: TextOverflow.ellipsis,
),
],
),
color: color,
),
),
),
),
],
);
})
: LoadingWidget(
flag: model.loadingFlag,
errorCallBack: () {},
emptyText: DemoLocalizations.of(context).toFinishTask,
),
flag: model.loadingFlag,
errorCallBack: () {},
emptyText: DemoLocalizations
.of(context)
.toFinishTask,
),
),
);
}

View File

@ -108,7 +108,7 @@ class MainPage extends StatelessWidget {
margin: EdgeInsets.only(top: 40,bottom: 40),
child: CarouselSlider(
items: model.logic.getCards(context),
aspectRatio: 1,
aspectRatio: 16 / 9,
height: min(size.width, size.height) - 100,
viewportFraction: size.height >= size.width ? 0.8 : 0.5,
initialPage: 0,

View File

@ -75,17 +75,18 @@ class NavPage extends StatelessWidget {
return NavHead();
} else {
final url = model.currentNetPicUrl;
bool isDailyPic = model.currentNavHeader == NavHeadType.dailyPic;
return GestureDetector(
onTap: () {
Navigator.of(context).push(new CupertinoPageRoute(builder: (ctx) {
return ImagePage(
imageUrls: [url],
imageUrls: [isDailyPic ?NavHeadType.dailyPicUrl : url],
);
}));
},
child: Hero(
tag: "tag_0",
child: model.currentNavHeader == NavHeadType.dailyPic
child: isDailyPic
? Image.network(NavHeadType.dailyPicUrl)
: CachedNetworkImage(
fit: BoxFit.cover,

View File

@ -31,6 +31,7 @@ class TaskInfoWidget extends StatelessWidget {
? Theme.of(context).primaryColor
: ColorBean.fromBean(taskBean.taskIconBean.colorBean);
final taskIconData = IconBean.fromBean(taskBean.taskIconBean.iconBean);
debugPrint("进度:${taskBean.overallProgress}");
return Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
@ -106,7 +107,7 @@ class TaskInfoWidget extends StatelessWidget {
),
),
),
taskBean.overallProgress == 1.0 && !isExisting
taskBean.overallProgress >= 1.0 && !isExisting
? Expanded(
flex: 1,
child: Container(

View File

@ -18,6 +18,50 @@
"type": "text",
"placeholders": {}
},
"taskNum": "Task Number",
"@taskNum": {
"description": "任务数",
"type": "text",
"placeholders": {}
},
"createDate": "Create Date",
"@createDate": {
"description": "创建日期",
"type": "text",
"placeholders": {}
},
"completeDate": "Finish Date",
"@completeDate": {
"description": "完成日期",
"type": "text",
"placeholders": {}
},
"spendTime": "Spend Time",
"@spendTime": {
"description": "用时",
"type": "text",
"placeholders": {}
},
"changedTimes": "Changed Times",
"@changedTimes": {
"description": "修改次数",
"type": "text",
"placeholders": {}
},
"hours": "{hours,plural, =0{Too Fast}=1{1 hour}many{{hours} hours}other{{hours} hours}}",
"@hours": {
"type": "text",
"placeholders": {
"hours": {}
}
},
"days": "{days,plural, =0{Too Fast}=1{1 day}many{{days} days}other{{days} days}}",
"@days": {
"type": "text",
"placeholders": {
"days": {}
}
},
"languageTitle": "Change Language",
"@languageTitle": {
"description": "修改语言",

View File

@ -1,5 +1,5 @@
{
"@@last_modified": "2019-07-20T19:23:09.817787",
"@@last_modified": "2019-07-21T14:32:24.392430",
"appName": "One Day List",
"@appName": {
"description": "app的名字",
@ -18,6 +18,50 @@
"type": "text",
"placeholders": {}
},
"taskNum": "Task Number",
"@taskNum": {
"description": "任务数",
"type": "text",
"placeholders": {}
},
"createDate": "Create Date",
"@createDate": {
"description": "创建日期",
"type": "text",
"placeholders": {}
},
"completeDate": "Complete Date",
"@completeDate": {
"description": "完成日期",
"type": "text",
"placeholders": {}
},
"spendTime": "Spend Time",
"@spendTime": {
"description": "用时",
"type": "text",
"placeholders": {}
},
"changedTimes": "Changed Times",
"@changedTimes": {
"description": "修改次数",
"type": "text",
"placeholders": {}
},
"hours": "{hours,plural, =0{Too Fast}=1{1 hour}many{{hours} hours}other{{hours} hours}}",
"@hours": {
"type": "text",
"placeholders": {
"hours": {}
}
},
"days": "{days,plural, =0{Too Fast}=1{1 day}many{{days} days}other{{days} days}}",
"@days": {
"type": "text",
"placeholders": {
"days": {}
}
},
"languageTitle": "Change Language",
"@languageTitle": {
"description": "修改语言",

View File

@ -18,6 +18,50 @@
"type": "text",
"placeholders": {}
},
"taskNum": "任务数",
"@taskNum": {
"description": "任务数",
"type": "text",
"placeholders": {}
},
"createDate": "创建日期",
"@createDate": {
"description": "创建日期",
"type": "text",
"placeholders": {}
},
"completeDate": "完成日期",
"@completeDate": {
"description": "完成日期",
"type": "text",
"placeholders": {}
},
"spendTime": "用时",
"@spendTime": {
"description": "用时",
"type": "text",
"placeholders": {}
},
"changedTimes": "修改次数",
"@changedTimes": {
"description": "修改次数",
"type": "text",
"placeholders": {}
},
"hours": "{hours,plural, =0{太快了!}=1{1 小时}many{{hours} 小时}other{{hours} 小时}}",
"@hours": {
"type": "text",
"placeholders": {
"hours": {}
}
},
"days": "{days,plural, =0{太快了!}=1{1 天}many{{days} 天}other{{days} 天}}",
"@days": {
"type": "text",
"placeholders": {
"days": {}
}
},
"languageTitle": "切换语言",
"@languageTitle": {
"description": "Change Language",