1.列表,筛选完成和未完成
2.详情,增加checkout
This commit is contained in:
@@ -47,11 +47,13 @@ class PlanDetailDto {
|
|||||||
String? dialog;
|
String? dialog;
|
||||||
List<PlanStepDto> stepsList;
|
List<PlanStepDto> stepsList;
|
||||||
List<String> suggestionsList;
|
List<String> suggestionsList;
|
||||||
|
String? planEndTime;
|
||||||
|
|
||||||
PlanDetailDto({
|
PlanDetailDto({
|
||||||
this.agentName,
|
this.agentName,
|
||||||
this.summary,
|
this.summary,
|
||||||
this.dialog,
|
this.dialog,
|
||||||
|
this.planEndTime,
|
||||||
List<PlanStepDto>? stepsList,
|
List<PlanStepDto>? stepsList,
|
||||||
List<String>? suggestionsList,
|
List<String>? suggestionsList,
|
||||||
}) : stepsList = stepsList ?? [],
|
}) : stepsList = stepsList ?? [],
|
||||||
@@ -68,6 +70,7 @@ class PlanDetailDto {
|
|||||||
suggestionsList: json["suggestions"] != null
|
suggestionsList: json["suggestions"] != null
|
||||||
? List<String>.from(json["suggestions"])
|
? List<String>.from(json["suggestions"])
|
||||||
: [],
|
: [],
|
||||||
|
planEndTime: json["plan_end_time"],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,6 +81,7 @@ class PlanDetailDto {
|
|||||||
"dialog": dialog,
|
"dialog": dialog,
|
||||||
"steps": stepsList.map((v) => v.toJson()).toList(),
|
"steps": stepsList.map((v) => v.toJson()).toList(),
|
||||||
"suggestions": suggestionsList,
|
"suggestions": suggestionsList,
|
||||||
|
"plan_end_time": planEndTime,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:plan/page/plan/detail/viewmodel/plan_detail_store.dart';
|
import 'package:plan/page/plan/detail/viewmodel/plan_detail_store.dart';
|
||||||
|
import 'package:plan/utils/common.dart';
|
||||||
|
import 'package:plan/utils/format.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class DoneStamp extends StatefulWidget {
|
class DoneStamp extends StatefulWidget {
|
||||||
@@ -38,6 +40,13 @@ class _DoneStampState extends State<DoneStamp> {
|
|||||||
"Completed",
|
"Completed",
|
||||||
style: TextStyle(fontWeight: FontWeight.w700),
|
style: TextStyle(fontWeight: FontWeight.w700),
|
||||||
),
|
),
|
||||||
|
Visibility(
|
||||||
|
visible: getNotEmpty(store.planDetail.planEndTime) != null,
|
||||||
|
child: Text(
|
||||||
|
formatDateUS(store.planDetail.planEndTime!),
|
||||||
|
style: TextStyle(fontSize: 12),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import 'package:plan/api/endpoints/plan_api.dart';
|
|||||||
import 'package:plan/data/models/plan_acttion_type.dart';
|
import 'package:plan/data/models/plan_acttion_type.dart';
|
||||||
import 'package:plan/page/plan/detail/viewmodel/plan_detail_store.dart';
|
import 'package:plan/page/plan/detail/viewmodel/plan_detail_store.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:remixicon/remixicon.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
class FooterBtn extends StatefulWidget {
|
class FooterBtn extends StatefulWidget {
|
||||||
const FooterBtn({super.key});
|
const FooterBtn({super.key});
|
||||||
@@ -30,6 +30,17 @@ class _FooterBtnState extends State<FooterBtn> {
|
|||||||
return item.copyWith(stepStatus: allDone ? 0 : 2);
|
return item.copyWith(stepStatus: allDone ? 0 : 2);
|
||||||
}).toList();
|
}).toList();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//如果是全部完成
|
||||||
|
if (!allDone) {
|
||||||
|
store.updatePlanDetail((dto) {
|
||||||
|
final now = DateTime.now();
|
||||||
|
final formatted = DateFormat('yyyy-MM-dd HH:mm:ss').format(now);
|
||||||
|
print(formatted);
|
||||||
|
dto.planEndTime = formatted;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
//接口
|
//接口
|
||||||
editPlanStepApi(
|
editPlanStepApi(
|
||||||
store.planId,
|
store.planId,
|
||||||
|
|||||||
@@ -152,80 +152,105 @@ class PlanItem extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return GestureDetector(
|
return Selector<PlanDetailStore, String>(
|
||||||
onTap: () {
|
selector: (_, store) => store.planContent,
|
||||||
if (!isEdit) {
|
builder: (context, planContent, _) {
|
||||||
onComplete(step);
|
return GestureDetector(
|
||||||
}
|
onTap: () {
|
||||||
},
|
if (!isEdit && planContent == "") {
|
||||||
child: Container(
|
onComplete(step);
|
||||||
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
}
|
||||||
color: Colors.white,
|
|
||||||
child: DeleteRowItem(
|
|
||||||
showDelete: isEdit,
|
|
||||||
onDelete: () {
|
|
||||||
onDelete(step.id!);
|
|
||||||
},
|
},
|
||||||
builder: (_, animate) {
|
child: Container(
|
||||||
return [
|
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||||
Expanded(
|
color: Colors.white,
|
||||||
child: Column(
|
child: DeleteRowItem(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
showDelete: isEdit,
|
||||||
children: [
|
onDelete: () {
|
||||||
Container(
|
onDelete(step.id!);
|
||||||
margin: EdgeInsets.only(bottom: 3),
|
},
|
||||||
child: Text(
|
builder: (_, animate) {
|
||||||
step.stepContent ?? "",
|
return [
|
||||||
style: stepTextStyle(context, Theme.of(context).textTheme.bodyMedium),
|
Visibility(
|
||||||
|
visible: !isEdit && planContent == "",
|
||||||
|
child: Transform.translate(
|
||||||
|
offset: Offset(0, -10),
|
||||||
|
child: Container(
|
||||||
|
width: 24,
|
||||||
|
height: 24,
|
||||||
|
margin: EdgeInsets.only(right: 10),
|
||||||
|
child: Checkbox(
|
||||||
|
value: step.stepStatus == 2,
|
||||||
|
onChanged: (value) {
|
||||||
|
onComplete(step);
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
AnimatedSwitcher(
|
),
|
||||||
duration: Duration(milliseconds: 300),
|
Expanded(
|
||||||
transitionBuilder: (child, animation) {
|
child: Column(
|
||||||
return FadeTransition(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
opacity: animation,
|
children: [
|
||||||
child: SizeTransition(
|
Container(
|
||||||
sizeFactor: animation,
|
margin: EdgeInsets.only(bottom: 3),
|
||||||
axis: Axis.vertical,
|
child: Text(
|
||||||
child: child,
|
step.stepContent ?? "",
|
||||||
),
|
style: stepTextStyle(
|
||||||
);
|
context,
|
||||||
},
|
Theme.of(context).textTheme.bodyMedium,
|
||||||
child: getNotEmpty(step.stepExplain) == null
|
|
||||||
? SizedBox.shrink(key: ValueKey("empty"))
|
|
||||||
: Text(
|
|
||||||
step.stepExplain!,
|
|
||||||
style: stepTextStyle(
|
|
||||||
context,
|
|
||||||
Theme.of(context).textTheme.labelSmall,
|
|
||||||
),
|
|
||||||
key: ValueKey(step.stepExplain),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
AnimatedSwitcher(
|
||||||
),
|
duration: Duration(milliseconds: 300),
|
||||||
SizeTransition(
|
transitionBuilder: (child, animation) {
|
||||||
axis: Axis.horizontal,
|
return FadeTransition(
|
||||||
sizeFactor: animate,
|
opacity: animation,
|
||||||
child: GestureDetector(
|
child: SizeTransition(
|
||||||
onTap: () {
|
sizeFactor: animation,
|
||||||
onEdit(step);
|
axis: Axis.vertical,
|
||||||
},
|
child: child,
|
||||||
child: Container(
|
),
|
||||||
alignment: Alignment.center,
|
);
|
||||||
margin: EdgeInsets.only(left: 10),
|
},
|
||||||
child: Opacity(
|
child: getNotEmpty(step.stepExplain) == null
|
||||||
opacity: 0.4,
|
? SizedBox.shrink(key: ValueKey("empty"))
|
||||||
child: Icon(RemixIcons.edit_box_line),
|
: Text(
|
||||||
|
step.stepExplain!,
|
||||||
|
style: stepTextStyle(
|
||||||
|
context,
|
||||||
|
Theme.of(context).textTheme.labelSmall,
|
||||||
|
),
|
||||||
|
key: ValueKey(step.stepExplain),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
SizeTransition(
|
||||||
),
|
axis: Axis.horizontal,
|
||||||
];
|
sizeFactor: animate,
|
||||||
},
|
child: GestureDetector(
|
||||||
),
|
onTap: () {
|
||||||
),
|
onEdit(step);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
margin: EdgeInsets.only(left: 10),
|
||||||
|
child: Opacity(
|
||||||
|
opacity: 0.4,
|
||||||
|
child: Icon(RemixIcons.edit_box_line),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:plan/api/dto/plan_item_dto.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:plan/api/endpoints/plan_api.dart';
|
|
||||||
|
|
||||||
import 'widgets/history_item.dart';
|
import 'viewmodel/plan_list_store.dart';
|
||||||
import 'widgets/loading_box.dart';
|
import 'widgets/custom_indicator.dart';
|
||||||
|
import 'widgets/history_list.dart';
|
||||||
|
import 'widgets/bar_actions.dart';
|
||||||
|
|
||||||
class PlanHistoryPage extends StatefulWidget {
|
class PlanHistoryPage extends StatefulWidget {
|
||||||
const PlanHistoryPage({super.key});
|
const PlanHistoryPage({super.key});
|
||||||
@@ -14,81 +15,43 @@ class PlanHistoryPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _PlanHistoryPageState extends State<PlanHistoryPage> {
|
class _PlanHistoryPageState extends State<PlanHistoryPage> {
|
||||||
///是否显示删除
|
|
||||||
bool _isDelete = false;
|
|
||||||
|
|
||||||
///数据
|
|
||||||
List<PlanItemDto> _record = [];
|
|
||||||
bool _isInit = true;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_onRefresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
///刷新
|
|
||||||
Future<void> _onRefresh() async {
|
|
||||||
var list = await getPlanListApi();
|
|
||||||
setState(() {
|
|
||||||
_record = list;
|
|
||||||
_isInit = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
///确认删除
|
|
||||||
void _confirmDelete(int id) {
|
|
||||||
setState(() {
|
|
||||||
_record.removeWhere((element) => element.id == id);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return CupertinoPageScaffold(
|
return ChangeNotifierProvider<PlanListStore>(
|
||||||
backgroundColor: Theme.of(context).colorScheme.surfaceContainer,
|
create: (_) {
|
||||||
navigationBar: CupertinoNavigationBar(
|
return PlanListStore();
|
||||||
middle: const Text("Plan History"),
|
},
|
||||||
),
|
child: Consumer<PlanListStore>(
|
||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
child: CustomScrollView(
|
child: CustomScrollView(
|
||||||
physics: AlwaysScrollableScrollPhysics(
|
physics: AlwaysScrollableScrollPhysics(
|
||||||
parent: BouncingScrollPhysics(),
|
parent: BouncingScrollPhysics(),
|
||||||
),
|
|
||||||
slivers: <Widget>[
|
|
||||||
//下拉刷新组件
|
|
||||||
CupertinoSliverRefreshControl(
|
|
||||||
onRefresh: _onRefresh,
|
|
||||||
),
|
),
|
||||||
//列表
|
slivers: <Widget>[
|
||||||
LoadingBox(
|
//下拉刷新组件
|
||||||
loading: _isInit,
|
CustomIndicator(),
|
||||||
isEmpty: _record.isEmpty,
|
//列表
|
||||||
child: ClipRRect(
|
HistoryList(),
|
||||||
child: CustomScrollView(
|
],
|
||||||
shrinkWrap: true,
|
),
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
),
|
||||||
slivers: [
|
builder: (context, store, child) {
|
||||||
SliverList.separated(
|
return CupertinoPageScaffold(
|
||||||
itemBuilder: (BuildContext context, int index) {
|
backgroundColor: Theme.of(context).colorScheme.surfaceContainer,
|
||||||
return HistoryItem(
|
navigationBar: CupertinoNavigationBar(
|
||||||
item: _record[index],
|
middle: const Text("Plan History"),
|
||||||
showDelete: _isDelete,
|
trailing: BarActions(
|
||||||
onDelete: _confirmDelete,
|
store: store,
|
||||||
onInit: _onRefresh,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
separatorBuilder: (BuildContext context, int index) {
|
|
||||||
return SizedBox(height: 15);
|
|
||||||
},
|
|
||||||
itemCount: _record.length,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
child: child!,
|
||||||
),
|
);
|
||||||
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
63
lib/page/plan/history/viewmodel/plan_list_store.dart
Normal file
63
lib/page/plan/history/viewmodel/plan_list_store.dart
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:plan/api/dto/plan_item_dto.dart';
|
||||||
|
import 'package:plan/api/endpoints/plan_api.dart';
|
||||||
|
|
||||||
|
///筛选已完成和没完成
|
||||||
|
class PlanStatusFilter {
|
||||||
|
bool archived;
|
||||||
|
bool unarchived;
|
||||||
|
|
||||||
|
PlanStatusFilter({required this.archived, required this.unarchived});
|
||||||
|
|
||||||
|
PlanStatusFilter copyWith({
|
||||||
|
bool? archived,
|
||||||
|
bool? unarchived,
|
||||||
|
}) {
|
||||||
|
return PlanStatusFilter(
|
||||||
|
archived: archived ?? this.archived,
|
||||||
|
unarchived: unarchived ?? this.unarchived,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class PlanListStore extends ChangeNotifier {
|
||||||
|
bool isInit = true;
|
||||||
|
|
||||||
|
///原始数据
|
||||||
|
List<PlanItemDto> _originList = [];
|
||||||
|
|
||||||
|
List<PlanItemDto> get planList => _originList;
|
||||||
|
|
||||||
|
///显示已完成和未完成
|
||||||
|
PlanStatusFilter planStatus = PlanStatusFilter(archived: true, unarchived: true);
|
||||||
|
|
||||||
|
PlanListStore() {
|
||||||
|
getPlanList();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> getPlanList() async {
|
||||||
|
_originList = await getPlanListApi();
|
||||||
|
isInit = false;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
///修改状态
|
||||||
|
void setPlanStatus(PlanStatusFilter planStatus) {
|
||||||
|
this.planStatus = planStatus;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
///更新子项
|
||||||
|
void updateStep(PlanItemDto newStep) {
|
||||||
|
final int index = _originList.indexWhere((e) => e.id == newStep.id);
|
||||||
|
if (index != -1) {
|
||||||
|
_originList[index] = newStep; // 引用变了 → 框架感知
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
///移除子项
|
||||||
|
void removeStep(PlanItemDto step) {
|
||||||
|
_originList.removeWhere((e) => e.id == step.id);
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
75
lib/page/plan/history/widgets/bar_actions.dart
Normal file
75
lib/page/plan/history/widgets/bar_actions.dart
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:plan/widgets/ui_kit/popup/popup_action.dart';
|
||||||
|
import 'package:remixicon/remixicon.dart';
|
||||||
|
|
||||||
|
import '../viewmodel/plan_list_store.dart';
|
||||||
|
|
||||||
|
class BarActions extends StatefulWidget {
|
||||||
|
final PlanListStore store;
|
||||||
|
const BarActions({super.key, required this.store});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<BarActions> createState() => _BarActionsState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _BarActionsState extends State<BarActions> {
|
||||||
|
void _onSelected(String value) {
|
||||||
|
switch (value) {
|
||||||
|
case "Unarchived":
|
||||||
|
widget.store.setPlanStatus(
|
||||||
|
widget.store.planStatus.copyWith(
|
||||||
|
unarchived: !widget.store.planStatus.unarchived,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case "Archived":
|
||||||
|
widget.store.setPlanStatus(
|
||||||
|
widget.store.planStatus.copyWith(
|
||||||
|
archived: !widget.store.planStatus.archived,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
PopupAction(
|
||||||
|
onSelected: _onSelected,
|
||||||
|
items: [
|
||||||
|
PopupMenuItem(
|
||||||
|
value: "Unarchived",
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text("Unarchived"),
|
||||||
|
Visibility(
|
||||||
|
visible: widget.store.planStatus.unarchived,
|
||||||
|
child: Icon(RemixIcons.check_fill, size: 20),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
PopupMenuItem(
|
||||||
|
value: "Archived",
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text("Archived"),
|
||||||
|
Visibility(
|
||||||
|
visible: widget.store.planStatus.archived,
|
||||||
|
child: Icon(RemixIcons.check_fill, size: 20),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
child: Icon(RemixIcons.more_fill),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
25
lib/page/plan/history/widgets/custom_indicator.dart
Normal file
25
lib/page/plan/history/widgets/custom_indicator.dart
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../viewmodel/plan_list_store.dart';
|
||||||
|
|
||||||
|
class CustomIndicator extends StatefulWidget {
|
||||||
|
const CustomIndicator({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<CustomIndicator> createState() => _CustomIndicatorState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _CustomIndicatorState extends State<CustomIndicator> {
|
||||||
|
Future<void> _onRefresh() async {
|
||||||
|
PlanListStore store = context.read<PlanListStore>();
|
||||||
|
await store.getPlanList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return CupertinoSliverRefreshControl(
|
||||||
|
onRefresh: _onRefresh,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,86 +3,105 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:plan/api/dto/plan_item_dto.dart';
|
import 'package:plan/api/dto/plan_item_dto.dart';
|
||||||
import 'package:plan/api/endpoints/plan_api.dart';
|
import 'package:plan/api/endpoints/plan_api.dart';
|
||||||
|
import 'package:plan/page/plan/history/viewmodel/plan_list_store.dart';
|
||||||
import 'package:plan/router/config/route_paths.dart';
|
import 'package:plan/router/config/route_paths.dart';
|
||||||
import 'package:plan/utils/format.dart';
|
import 'package:plan/utils/format.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
import 'package:remixicon/remixicon.dart';
|
import 'package:remixicon/remixicon.dart';
|
||||||
|
|
||||||
import '../../widgets/edit_desc_dialog.dart';
|
import '../../widgets/edit_desc_dialog.dart';
|
||||||
|
import 'loading_box.dart';
|
||||||
|
|
||||||
class HistoryItem extends StatefulWidget {
|
class HistoryList extends StatefulWidget {
|
||||||
final PlanItemDto item;
|
const HistoryList({super.key});
|
||||||
final bool showDelete;
|
|
||||||
final Function(int) onDelete;
|
|
||||||
final Function() onInit;
|
|
||||||
|
|
||||||
const HistoryItem({
|
|
||||||
super.key,
|
|
||||||
required this.item,
|
|
||||||
this.showDelete = false,
|
|
||||||
required this.onDelete,
|
|
||||||
required this.onInit,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<HistoryItem> createState() => _HistoryItemState();
|
State<HistoryList> createState() => _HistoryListState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _HistoryItemState extends State<HistoryItem> {
|
class _HistoryListState extends State<HistoryList> {
|
||||||
late PlanItemDto _data;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
_data = widget.item;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void didUpdateWidget(covariant HistoryItem oldWidget) {
|
|
||||||
super.didUpdateWidget(oldWidget);
|
|
||||||
if (oldWidget.item != widget.item) {
|
|
||||||
setState(() {
|
|
||||||
_data = widget.item;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
///跳转详情
|
///跳转详情
|
||||||
void _goDetail() async {
|
void _goDetail(PlanItemDto data) async {
|
||||||
await context.push(RoutePaths.planDetail(_data.id));
|
PlanListStore store = context.read<PlanListStore>();
|
||||||
widget.onInit();
|
await context.push(RoutePaths.planDetail(data.id));
|
||||||
|
store.getPlanList();
|
||||||
}
|
}
|
||||||
|
|
||||||
///编辑摘要
|
///编辑摘要
|
||||||
void _handEdit() {
|
void _handEdit(PlanItemDto data) {
|
||||||
context.pop();
|
context.pop();
|
||||||
|
PlanListStore store = context.read<PlanListStore>();
|
||||||
showEditDescDialog(
|
showEditDescDialog(
|
||||||
context,
|
context,
|
||||||
value: _data.summary ?? "",
|
value: data.summary ?? "",
|
||||||
onConfirm: (value) async {
|
onConfirm: (value) async {
|
||||||
setState(() {
|
data.summary = value;
|
||||||
_data.summary = value;
|
store.updateStep(data);
|
||||||
});
|
await editPlanSummaryApi(data.id!, value);
|
||||||
await editPlanSummaryApi(_data.id!, value);
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
///删除计划
|
///删除计划
|
||||||
void _handDelete() async {
|
void _handDelete(PlanItemDto data) async {
|
||||||
context.pop();
|
context.pop();
|
||||||
widget.onDelete(_data.id!);
|
PlanListStore store = context.read<PlanListStore>();
|
||||||
await deletePlanApi(_data.id!);
|
store.removeStep(data);
|
||||||
|
await deletePlanApi(data.id!);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var progress = (_data.completedSteps! / _data.totalSteps!);
|
return Consumer<PlanListStore>(
|
||||||
|
builder: (context, store, _) {
|
||||||
|
var record = store.planList.where((item) {
|
||||||
|
var progress = (item.completedSteps! / item.totalSteps!);
|
||||||
|
//不显示已完成
|
||||||
|
if (!store.planStatus.archived && progress == 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//不显示未完成
|
||||||
|
if (!store.planStatus.unarchived && progress < 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}).toList();
|
||||||
|
|
||||||
|
return LoadingBox(
|
||||||
|
loading: store.isInit,
|
||||||
|
isEmpty: record.isEmpty,
|
||||||
|
child: CustomScrollView(
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
|
slivers: [
|
||||||
|
SliverList.separated(
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
return _buildItem(
|
||||||
|
item: record[index],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
separatorBuilder: (BuildContext context, int index) {
|
||||||
|
return SizedBox(height: 15);
|
||||||
|
},
|
||||||
|
itemCount: record.length,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildItem({required PlanItemDto item}) {
|
||||||
|
var progress = (item.completedSteps! / item.totalSteps!);
|
||||||
return CupertinoContextMenu(
|
return CupertinoContextMenu(
|
||||||
enableHapticFeedback: true,
|
enableHapticFeedback: true,
|
||||||
actions: [
|
actions: [
|
||||||
// 编辑摘要
|
// 编辑摘要
|
||||||
CupertinoContextMenuAction(
|
CupertinoContextMenuAction(
|
||||||
onPressed: _handEdit,
|
onPressed: () {
|
||||||
|
_handEdit(item);
|
||||||
|
},
|
||||||
child: _actionItem(
|
child: _actionItem(
|
||||||
"Edit Summary",
|
"Edit Summary",
|
||||||
CupertinoIcons.pencil,
|
CupertinoIcons.pencil,
|
||||||
@@ -90,7 +109,9 @@ class _HistoryItemState extends State<HistoryItem> {
|
|||||||
),
|
),
|
||||||
CupertinoContextMenuAction(
|
CupertinoContextMenuAction(
|
||||||
isDestructiveAction: true,
|
isDestructiveAction: true,
|
||||||
onPressed: _handDelete,
|
onPressed: () {
|
||||||
|
_handDelete(item);
|
||||||
|
},
|
||||||
child: _actionItem(
|
child: _actionItem(
|
||||||
"Delete Summary",
|
"Delete Summary",
|
||||||
CupertinoIcons.delete,
|
CupertinoIcons.delete,
|
||||||
@@ -98,7 +119,9 @@ class _HistoryItemState extends State<HistoryItem> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: _goDetail,
|
onTap: () {
|
||||||
|
_goDetail(item);
|
||||||
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
width: 400,
|
width: 400,
|
||||||
margin: EdgeInsets.symmetric(horizontal: 15),
|
margin: EdgeInsets.symmetric(horizontal: 15),
|
||||||
@@ -117,7 +140,7 @@ class _HistoryItemState extends State<HistoryItem> {
|
|||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(child: Text(_data.summary ?? "")),
|
Expanded(child: Text(item.summary ?? "")),
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: progress == 1,
|
visible: progress == 1,
|
||||||
child: Container(
|
child: Container(
|
||||||
@@ -140,7 +163,7 @@ class _HistoryItemState extends State<HistoryItem> {
|
|||||||
Container(
|
Container(
|
||||||
margin: const EdgeInsets.only(bottom: 5, top: 5),
|
margin: const EdgeInsets.only(bottom: 5, top: 5),
|
||||||
child: Text(
|
child: Text(
|
||||||
"${formatDateUS(_data.createdAt!, withTime: true)} · Coach ${_data.agentName ?? ""}",
|
"${formatDateUS(item.createdAt!, withTime: true)} · Coach ${item.agentName ?? ""}",
|
||||||
style: Theme.of(context).textTheme.labelSmall, // 小号文字
|
style: Theme.of(context).textTheme.labelSmall, // 小号文字
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -154,7 +177,7 @@ class _HistoryItemState extends State<HistoryItem> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
"${_data.completedSteps}/${_data.totalSteps}",
|
"${item.completedSteps}/${item.totalSteps}",
|
||||||
style: Theme.of(context).textTheme.labelSmall,
|
style: Theme.of(context).textTheme.labelSmall,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
228
lib/page/system/code/login_code_page.dart
Normal file
228
lib/page/system/code/login_code_page.dart
Normal file
@@ -0,0 +1,228 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||||
|
import 'package:go_router/go_router.dart';
|
||||||
|
import 'package:plan/api/endpoints/user_api.dart';
|
||||||
|
import 'package:plan/api/network/safe.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../../../providers/app_store.dart';
|
||||||
|
import '../../../router/config/route_paths.dart';
|
||||||
|
|
||||||
|
class LoginCodePage extends StatefulWidget {
|
||||||
|
final String email;
|
||||||
|
final String password;
|
||||||
|
|
||||||
|
const LoginCodePage({super.key, required this.email, required this.password});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<LoginCodePage> createState() => _LoginCodePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _LoginCodePageState extends State<LoginCodePage> {
|
||||||
|
final List<FocusNode> _focusNodes = List.generate(4, (_) => FocusNode());
|
||||||
|
final List<TextEditingController> _controllers = List.generate(
|
||||||
|
4,
|
||||||
|
(_) => TextEditingController(),
|
||||||
|
);
|
||||||
|
|
||||||
|
//倒计时
|
||||||
|
int _count = 60;
|
||||||
|
Timer? _timer;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_handSendCode();
|
||||||
|
_handClear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_timer?.cancel();
|
||||||
|
_handClear();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
///小输入框改变时
|
||||||
|
void _onChanged(String value, int index) async {
|
||||||
|
//一键复制
|
||||||
|
if (value.length == 4) {
|
||||||
|
_handlePaste(value);
|
||||||
|
}
|
||||||
|
//提交
|
||||||
|
if (value.isNotEmpty && index == 3) {
|
||||||
|
_handSubmit();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 自动跳到下一格
|
||||||
|
if (value.length == 1 && index < 3) {
|
||||||
|
_focusNodes[index + 1].requestFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _handlePaste(String pastedText) {
|
||||||
|
// 只取前4位数字
|
||||||
|
final digits = pastedText.replaceAll(RegExp(r'[^0-9]'), '');
|
||||||
|
for (int i = 0; i < 4; i++) {
|
||||||
|
_controllers[i].text = i < digits.length ? digits[i] : '';
|
||||||
|
}
|
||||||
|
if (digits.length >= 4) {
|
||||||
|
_focusNodes[3].requestFocus();
|
||||||
|
_handSubmit();
|
||||||
|
} else if (digits.isNotEmpty) {
|
||||||
|
_focusNodes[digits.length].requestFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///删除键
|
||||||
|
void _onDelete(KeyEvent event, int index) {
|
||||||
|
if (event is KeyDownEvent && event.logicalKey == LogicalKeyboardKey.backspace) {
|
||||||
|
final currentController = _controllers[index];
|
||||||
|
if (currentController.text.isEmpty && index > 0) {
|
||||||
|
_focusNodes[index - 1].requestFocus();
|
||||||
|
_controllers[index - 1].clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///发送验证码
|
||||||
|
void _handSendCode() {
|
||||||
|
if (_count != 60) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_timer = Timer.periodic(Duration(seconds: 1), (timer) {
|
||||||
|
setState(() {
|
||||||
|
_count--;
|
||||||
|
});
|
||||||
|
if (_count == 0) {
|
||||||
|
setState(() {
|
||||||
|
_count = 60;
|
||||||
|
});
|
||||||
|
timer.cancel();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
sendEmailCodeApi(widget.email);
|
||||||
|
EasyLoading.showToast("Send success");
|
||||||
|
}
|
||||||
|
|
||||||
|
///提交
|
||||||
|
void _handSubmit() async {
|
||||||
|
String code = _controllers.map((controller) => controller.text).join();
|
||||||
|
if (code.length == 4) {
|
||||||
|
EasyLoading.show();
|
||||||
|
var res = await safeRequest(
|
||||||
|
registerApi(
|
||||||
|
widget.email,
|
||||||
|
widget.password,
|
||||||
|
code,
|
||||||
|
),
|
||||||
|
onError: (error) {
|
||||||
|
_handClear();
|
||||||
|
EasyLoading.showToast("Login Error");
|
||||||
|
},
|
||||||
|
);
|
||||||
|
var appStore = context.read<AppStore>();
|
||||||
|
await appStore.setInfo(res);
|
||||||
|
context.go(RoutePaths.layout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///清空
|
||||||
|
void _handClear() {
|
||||||
|
for (var controller in _controllers) {
|
||||||
|
controller.clear();
|
||||||
|
}
|
||||||
|
_focusNodes.first.requestFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: Colors.white,
|
||||||
|
appBar: AppBar(),
|
||||||
|
body: ListView(
|
||||||
|
physics: NeverScrollableScrollPhysics(),
|
||||||
|
padding: EdgeInsets.all(20),
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(bottom: 20),
|
||||||
|
child: Text(
|
||||||
|
"Check your inbox",
|
||||||
|
style: Theme.of(context).textTheme.titleLarge,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(bottom: 60),
|
||||||
|
child: Text(
|
||||||
|
"Verification code has been sent to ${widget.email}",
|
||||||
|
style: Theme.of(context).textTheme.labelLarge,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
spacing: 20,
|
||||||
|
children: List.generate(4, (index) {
|
||||||
|
return Expanded(
|
||||||
|
child: AspectRatio(
|
||||||
|
aspectRatio: 1,
|
||||||
|
child: Container(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
),
|
||||||
|
child: KeyboardListener(
|
||||||
|
focusNode: FocusNode(),
|
||||||
|
onKeyEvent: (event) {
|
||||||
|
_onDelete(event, index);
|
||||||
|
},
|
||||||
|
child: TextField(
|
||||||
|
controller: _controllers[index],
|
||||||
|
focusNode: _focusNodes[index],
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
keyboardType: TextInputType.number,
|
||||||
|
maxLength: 4,
|
||||||
|
style: TextStyle(fontSize: 32),
|
||||||
|
decoration: InputDecoration(
|
||||||
|
counterText: "",
|
||||||
|
border: InputBorder.none,
|
||||||
|
isCollapsed: true,
|
||||||
|
),
|
||||||
|
onChanged: (value) {
|
||||||
|
_onChanged(value, index);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
margin: EdgeInsets.only(top: 30),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
GestureDetector(
|
||||||
|
onTap: _handSendCode,
|
||||||
|
child: Visibility(
|
||||||
|
visible: _count != 60,
|
||||||
|
replacement: Text(
|
||||||
|
"Resend Code",
|
||||||
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
"Resend Code(${_count}s)",
|
||||||
|
style: Theme.of(context).textTheme.labelMedium,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,115 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
|
||||||
import 'package:go_router/go_router.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
|
|
||||||
import '../../../api/endpoints/user_api.dart';
|
|
||||||
import '../../../api/network/safe.dart';
|
|
||||||
import '../../../providers/app_store.dart';
|
|
||||||
import '../../../router/config/route_paths.dart';
|
|
||||||
import '../../../widgets/ui_kit/button/custom_button.dart';
|
|
||||||
import 'widget/widget.dart';
|
|
||||||
|
|
||||||
class LoginCodePage extends StatefulWidget {
|
|
||||||
final String email;
|
|
||||||
final String password;
|
|
||||||
|
|
||||||
const LoginCodePage({super.key, required this.email, required this.password});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<LoginCodePage> createState() => _LoginCodePageState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _LoginCodePageState extends State<LoginCodePage> {
|
|
||||||
final _codeController = TextEditingController();
|
|
||||||
var _subLoading = false;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
_handSendCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
///发送验证码
|
|
||||||
void _handSendCode() {
|
|
||||||
sendEmailCodeApi(widget.email);
|
|
||||||
EasyLoading.showSuccess("Send success");
|
|
||||||
}
|
|
||||||
|
|
||||||
///提交
|
|
||||||
void _handSubmit() async {
|
|
||||||
if (_codeController.text.isNotEmpty) {
|
|
||||||
setState(() {
|
|
||||||
_subLoading = true;
|
|
||||||
});
|
|
||||||
var res = await safeRequest(
|
|
||||||
registerApi(
|
|
||||||
widget.email,
|
|
||||||
widget.password,
|
|
||||||
_codeController.text,
|
|
||||||
),
|
|
||||||
onError: (error) {
|
|
||||||
setState(() {
|
|
||||||
_subLoading = false;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
);
|
|
||||||
var appStore = context.read<AppStore>();
|
|
||||||
await appStore.setInfo(res);
|
|
||||||
context.go(RoutePaths.layout);
|
|
||||||
setState(() {
|
|
||||||
_subLoading = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
body: SafeArea(
|
|
||||||
child: Container(
|
|
||||||
width: double.infinity,
|
|
||||||
padding: EdgeInsets.only(left: 20, right: 20, top: 40),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Check your inbox",
|
|
||||||
style: Theme.of(context).textTheme.titleLarge,
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
margin: EdgeInsets.only(top: 20, bottom: 40),
|
|
||||||
child: Text(
|
|
||||||
"Enter the verification code we just sent to ${widget.email}.",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: Theme.of(context).textTheme.labelMedium,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
InputBox(hintText: "Code", controller: _codeController),
|
|
||||||
Container(
|
|
||||||
margin: EdgeInsets.only(top: 20),
|
|
||||||
child: CustomButton(
|
|
||||||
loading: _subLoading,
|
|
||||||
onPressed: _handSubmit,
|
|
||||||
child: Text("Continue"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
margin: EdgeInsets.only(top: 20),
|
|
||||||
child: TextButton(
|
|
||||||
onPressed: () {
|
|
||||||
_handSendCode();
|
|
||||||
},
|
|
||||||
child: Text(
|
|
||||||
"Resend code",
|
|
||||||
style: Theme.of(context).textTheme.labelSmall,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -14,7 +14,9 @@ import '../../../router/config/route_paths.dart';
|
|||||||
import '../../../utils/common.dart';
|
import '../../../utils/common.dart';
|
||||||
import '../../../widgets/ui_kit/button/custom_button.dart';
|
import '../../../widgets/ui_kit/button/custom_button.dart';
|
||||||
import 'widget/agreement_box.dart';
|
import 'widget/agreement_box.dart';
|
||||||
import 'widget/widget.dart';
|
import 'widget/login_input.dart';
|
||||||
|
import 'widget/login_header.dart';
|
||||||
|
import 'widget/login_other.dart';
|
||||||
|
|
||||||
class LoginPage extends StatefulWidget {
|
class LoginPage extends StatefulWidget {
|
||||||
const LoginPage({super.key});
|
const LoginPage({super.key});
|
||||||
@@ -48,7 +50,11 @@ class _LoginPageState extends State<LoginPage> {
|
|||||||
try {
|
try {
|
||||||
await Dio().get(
|
await Dio().get(
|
||||||
'https://captive.apple.com/hotspot-detect.html',
|
'https://captive.apple.com/hotspot-detect.html',
|
||||||
options: Options(sendTimeout: const Duration(seconds: 3), receiveTimeout: const Duration(seconds: 3), headers: {'Cache-Control': 'no-cache'}),
|
options: Options(
|
||||||
|
sendTimeout: const Duration(seconds: 3),
|
||||||
|
receiveTimeout: const Duration(seconds: 3),
|
||||||
|
headers: {'Cache-Control': 'no-cache'},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
} catch (_) {
|
} catch (_) {
|
||||||
@@ -58,11 +64,16 @@ class _LoginPageState extends State<LoginPage> {
|
|||||||
|
|
||||||
void _initGoogleSign() {
|
void _initGoogleSign() {
|
||||||
if (isAndroid()) {
|
if (isAndroid()) {
|
||||||
_googleSignIn.initialize(clientId: null, serverClientId: "512878764950-0bsl98c4q4p695mlmfn35qhmr2ld5n0o.apps.googleusercontent.com");
|
_googleSignIn.initialize(
|
||||||
|
clientId: null,
|
||||||
|
serverClientId:
|
||||||
|
"512878764950-0bsl98c4q4p695mlmfn35qhmr2ld5n0o.apps.googleusercontent.com",
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
_googleSignIn.initialize(
|
_googleSignIn.initialize(
|
||||||
clientId: "512878764950-4hpppthg6c8p98mkfcro99echkftbbmo.apps.googleusercontent.com",
|
clientId: "512878764950-4hpppthg6c8p98mkfcro99echkftbbmo.apps.googleusercontent.com",
|
||||||
serverClientId: "512878764950-0bsl98c4q4p695mlmfn35qhmr2ld5n0o.apps.googleusercontent.com",
|
serverClientId:
|
||||||
|
"512878764950-0bsl98c4q4p695mlmfn35qhmr2ld5n0o.apps.googleusercontent.com",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,7 +87,7 @@ class _LoginPageState extends State<LoginPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
///谷歌登录
|
///谷歌登录
|
||||||
void _handleGoogleSignIn() async {
|
void _handGoogleSignIn() async {
|
||||||
try {
|
try {
|
||||||
// 如果用户未登录,则启动标准的 Google 登录
|
// 如果用户未登录,则启动标准的 Google 登录
|
||||||
if (_googleSignIn.supportsAuthenticate()) {
|
if (_googleSignIn.supportsAuthenticate()) {
|
||||||
@@ -112,7 +123,9 @@ class _LoginPageState extends State<LoginPage> {
|
|||||||
///apple登录
|
///apple登录
|
||||||
void _handAppleSignIn() async {
|
void _handAppleSignIn() async {
|
||||||
try {
|
try {
|
||||||
final credential = await SignInWithApple.getAppleIDCredential(scopes: [AppleIDAuthorizationScopes.email, AppleIDAuthorizationScopes.fullName]);
|
final credential = await SignInWithApple.getAppleIDCredential(
|
||||||
|
scopes: [AppleIDAuthorizationScopes.email, AppleIDAuthorizationScopes.fullName],
|
||||||
|
);
|
||||||
EasyLoading.show(status: "Logging in...");
|
EasyLoading.show(status: "Logging in...");
|
||||||
var res = await thirdLoginApi(credential.identityToken!, OtherLoginType.apple);
|
var res = await thirdLoginApi(credential.identityToken!, OtherLoginType.apple);
|
||||||
EasyLoading.dismiss();
|
EasyLoading.dismiss();
|
||||||
@@ -138,7 +151,10 @@ class _LoginPageState extends State<LoginPage> {
|
|||||||
});
|
});
|
||||||
var isRegister = await checkRegisterApi(_emailController.text);
|
var isRegister = await checkRegisterApi(_emailController.text);
|
||||||
if (!isRegister) {
|
if (!isRegister) {
|
||||||
context.push(RoutePaths.loginCode, extra: {"email": _emailController.text, "password": _passwordController.text});
|
context.push(
|
||||||
|
RoutePaths.loginCode,
|
||||||
|
extra: {"email": _emailController.text, "password": _passwordController.text},
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
var res = await loginApi(_emailController.text, _passwordController.text);
|
var res = await loginApi(_emailController.text, _passwordController.text);
|
||||||
_onLogin(res);
|
_onLogin(res);
|
||||||
@@ -174,9 +190,9 @@ class _LoginPageState extends State<LoginPage> {
|
|||||||
children: [
|
children: [
|
||||||
LogoBox(),
|
LogoBox(),
|
||||||
PageHeader(),
|
PageHeader(),
|
||||||
InputBox(hintText: "Email", controller: _emailController),
|
LoginInput(hintText: "Email", controller: _emailController),
|
||||||
SizedBox(height: 15),
|
SizedBox(height: 15),
|
||||||
InputBox(
|
LoginInput(
|
||||||
obscureText: _hidePassword,
|
obscureText: _hidePassword,
|
||||||
hintText: "Password",
|
hintText: "Password",
|
||||||
controller: _passwordController,
|
controller: _passwordController,
|
||||||
@@ -196,23 +212,12 @@ class _LoginPageState extends State<LoginPage> {
|
|||||||
Container(
|
Container(
|
||||||
margin: EdgeInsets.only(top: 20),
|
margin: EdgeInsets.only(top: 20),
|
||||||
height: 45,
|
height: 45,
|
||||||
child: CustomButton(loading: _subLoading, round: false, onPressed: _handSubmit, child: Text("Continue")),
|
child: CustomButton(
|
||||||
),
|
loading: _subLoading,
|
||||||
LoginDivider(),
|
round: false,
|
||||||
OtherButton(
|
onPressed: _handSubmit,
|
||||||
title: "Continue with Google",
|
child: Text("Continue"),
|
||||||
icon: "assets/image/google.png",
|
),
|
||||||
onTap: () {
|
|
||||||
_handleGoogleSignIn();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
SizedBox(height: 15),
|
|
||||||
OtherButton(
|
|
||||||
title: "Continue with Apple",
|
|
||||||
icon: "assets/image/apple.png",
|
|
||||||
onTap: () {
|
|
||||||
_handAppleSignIn();
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
@@ -220,6 +225,26 @@ class _LoginPageState extends State<LoginPage> {
|
|||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
child: AgreementBox(),
|
child: AgreementBox(),
|
||||||
),
|
),
|
||||||
|
LoginDivider(),
|
||||||
|
Row(
|
||||||
|
spacing: 20,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
OtherButton(
|
||||||
|
onTap: () {
|
||||||
|
_handGoogleSignIn();
|
||||||
|
},
|
||||||
|
icon: "assets/image/google.png",
|
||||||
|
),
|
||||||
|
OtherButton(
|
||||||
|
onTap: () {
|
||||||
|
_handAppleSignIn();
|
||||||
|
},
|
||||||
|
icon: "assets/image/apple.png",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
53
lib/page/system/login/widget/login_header.dart
Normal file
53
lib/page/system/login/widget/login_header.dart
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
///登陆Box
|
||||||
|
class LogoBox extends StatelessWidget {
|
||||||
|
const LogoBox({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
margin: EdgeInsets.only(bottom: 40),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
ClipRRect(
|
||||||
|
borderRadius: BorderRadius.circular(5),
|
||||||
|
child: Image.asset(
|
||||||
|
"assets/image/logo.png",
|
||||||
|
width: 43,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"PlanCura",
|
||||||
|
style: Theme.of(context).textTheme.titleSmall,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///头部文案
|
||||||
|
class PageHeader extends StatelessWidget {
|
||||||
|
const PageHeader({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
margin: EdgeInsets.only(bottom: 30),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Create an account",
|
||||||
|
style: TextStyle(fontWeight: FontWeight.w700),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"Use your email to get started",
|
||||||
|
style: Theme.of(context).textTheme.bodySmall,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
46
lib/page/system/login/widget/login_input.dart
Normal file
46
lib/page/system/login/widget/login_input.dart
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
///输入框
|
||||||
|
class LoginInput extends StatelessWidget {
|
||||||
|
final bool obscureText;
|
||||||
|
final String hintText;
|
||||||
|
final TextEditingController controller;
|
||||||
|
final Widget? suffix;
|
||||||
|
|
||||||
|
const LoginInput({
|
||||||
|
super.key,
|
||||||
|
this.obscureText = false,
|
||||||
|
required this.hintText,
|
||||||
|
required this.controller,
|
||||||
|
this.suffix,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
//边框
|
||||||
|
var inputBorder = OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return TextField(
|
||||||
|
controller: controller,
|
||||||
|
maxLength: 100,
|
||||||
|
obscureText: obscureText,
|
||||||
|
style: Theme.of(context).textTheme.bodyMedium,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
hintText: hintText,
|
||||||
|
hintStyle: Theme.of(context).textTheme.labelMedium,
|
||||||
|
counterText: '',
|
||||||
|
border: inputBorder,
|
||||||
|
enabledBorder: inputBorder,
|
||||||
|
suffix: suffix,
|
||||||
|
suffixIconConstraints: BoxConstraints(
|
||||||
|
minWidth: 0,
|
||||||
|
minHeight: 0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
66
lib/page/system/login/widget/login_other.dart
Normal file
66
lib/page/system/login/widget/login_other.dart
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
///分割线
|
||||||
|
class LoginDivider extends StatelessWidget {
|
||||||
|
const LoginDivider({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
margin: EdgeInsets.only(top: 20, bottom: 20),
|
||||||
|
child: Row(
|
||||||
|
spacing: 8,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
height: 1,
|
||||||
|
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"or",
|
||||||
|
style: Theme.of(context).textTheme.labelMedium,
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
height: 1,
|
||||||
|
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class OtherButton extends StatelessWidget {
|
||||||
|
final Function() onTap;
|
||||||
|
final String icon;
|
||||||
|
|
||||||
|
const OtherButton({
|
||||||
|
super.key,
|
||||||
|
required this.onTap,
|
||||||
|
required this.icon,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: onTap,
|
||||||
|
child: Container(
|
||||||
|
width: 45,
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
border: Border.all(
|
||||||
|
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: AspectRatio(
|
||||||
|
aspectRatio: 1,
|
||||||
|
child: Image.asset(icon),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,169 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
///登陆Box
|
|
||||||
class LogoBox extends StatelessWidget {
|
|
||||||
const LogoBox({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Container(
|
|
||||||
margin: EdgeInsets.only(bottom: 40),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
ClipRRect(
|
|
||||||
borderRadius: BorderRadius.circular(5),
|
|
||||||
child: Image.asset(
|
|
||||||
"assets/image/logo.png",
|
|
||||||
width: 43,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"PlanCura",
|
|
||||||
style: Theme.of(context).textTheme.titleSmall,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
///头部文案
|
|
||||||
class PageHeader extends StatelessWidget {
|
|
||||||
const PageHeader({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Container(
|
|
||||||
margin: EdgeInsets.only(bottom: 30),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Create an account",
|
|
||||||
style: TextStyle(fontWeight: FontWeight.w700),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"Use your email to get started",
|
|
||||||
style: Theme.of(context).textTheme.bodySmall,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
///输入框
|
|
||||||
class InputBox extends StatelessWidget {
|
|
||||||
final bool obscureText;
|
|
||||||
final String hintText;
|
|
||||||
final TextEditingController controller;
|
|
||||||
final Widget? suffix;
|
|
||||||
|
|
||||||
const InputBox({
|
|
||||||
super.key,
|
|
||||||
this.obscureText = false,
|
|
||||||
required this.hintText,
|
|
||||||
required this.controller,
|
|
||||||
this.suffix,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
//边框
|
|
||||||
var inputBorder = OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.circular(10),
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
return TextField(
|
|
||||||
controller: controller,
|
|
||||||
maxLength: 100,
|
|
||||||
obscureText: obscureText,
|
|
||||||
style: Theme.of(context).textTheme.bodyMedium,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
hintText: hintText,
|
|
||||||
hintStyle: Theme.of(context).textTheme.labelMedium,
|
|
||||||
counterText: '',
|
|
||||||
border: inputBorder,
|
|
||||||
enabledBorder: inputBorder,
|
|
||||||
suffix: suffix,
|
|
||||||
suffixIconConstraints: BoxConstraints(
|
|
||||||
minWidth: 0,
|
|
||||||
minHeight: 0,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
///分割线
|
|
||||||
class LoginDivider extends StatelessWidget {
|
|
||||||
const LoginDivider({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Container(
|
|
||||||
margin: EdgeInsets.only(top: 20, bottom: 20),
|
|
||||||
child: Row(
|
|
||||||
spacing: 8,
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: Container(
|
|
||||||
height: 1,
|
|
||||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"or",
|
|
||||||
style: Theme.of(context).textTheme.labelMedium,
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: Container(
|
|
||||||
height: 1,
|
|
||||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
///其他登陆按钮
|
|
||||||
class OtherButton extends StatelessWidget {
|
|
||||||
final Function() onTap;
|
|
||||||
final String title;
|
|
||||||
final String icon;
|
|
||||||
|
|
||||||
const OtherButton({
|
|
||||||
super.key,
|
|
||||||
required this.onTap,
|
|
||||||
required this.title,
|
|
||||||
required this.icon,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return InkWell(
|
|
||||||
onTap: onTap,
|
|
||||||
child: Container(
|
|
||||||
padding: EdgeInsets.all(15),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(10),
|
|
||||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
spacing: 10,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Image.asset(icon, width: 20),
|
|
||||||
Text(
|
|
||||||
title,
|
|
||||||
style: Theme.of(context).textTheme.bodySmall,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
import 'package:plan/page/home/home_page.dart';
|
import 'package:plan/page/home/home_page.dart';
|
||||||
|
import 'package:plan/page/system/code/login_code_page.dart';
|
||||||
import 'package:plan/page/test/test_page.dart';
|
import 'package:plan/page/test/test_page.dart';
|
||||||
|
|
||||||
import '../../page/system/agree/agree_page.dart';
|
import '../../page/system/agree/agree_page.dart';
|
||||||
import '../../page/system/login/login_code_page.dart';
|
|
||||||
import '../../page/system/login/login_page.dart';
|
import '../../page/system/login/login_page.dart';
|
||||||
import '../../page/system/splash/splash_page.dart';
|
import '../../page/system/splash/splash_page.dart';
|
||||||
import '../config/route_paths.dart';
|
import '../config/route_paths.dart';
|
||||||
@@ -32,7 +32,10 @@ List<RouteType> baseRoutes = [
|
|||||||
path: RoutePaths.loginCode,
|
path: RoutePaths.loginCode,
|
||||||
child: (state) {
|
child: (state) {
|
||||||
final args = state.extra as Map;
|
final args = state.extra as Map;
|
||||||
return LoginCodePage(email: args['email'], password: args['password']);
|
return LoginCodePage(
|
||||||
|
email: args['email'],
|
||||||
|
password: args['password'],
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
RouteType(
|
RouteType(
|
||||||
|
|||||||
@@ -1,42 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
// /// 格式化日期时间
|
|
||||||
// String formatDateUS(dynamic date, [String format = 'MM/DD/YYYY hh:mm:ss a']) {
|
|
||||||
// DateTime dateTime;
|
|
||||||
//
|
|
||||||
// if (date is String) {
|
|
||||||
// dateTime = DateTime.tryParse(date) ?? DateTime.now();
|
|
||||||
// } else if (date is DateTime) {
|
|
||||||
// dateTime = date;
|
|
||||||
// } else {
|
|
||||||
// dateTime = DateTime.now();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// final yyyy = dateTime.year.toString();
|
|
||||||
// final MM = dateTime.month.toString().padLeft(2, '0');
|
|
||||||
// final dd = dateTime.day.toString().padLeft(2, '0');
|
|
||||||
//
|
|
||||||
// // 12小时制
|
|
||||||
// final hour12 = (dateTime.hour % 12 == 0 ? 12 : dateTime.hour % 12).toString().padLeft(2, '0');
|
|
||||||
// final HH = dateTime.hour.toString().padLeft(2, '0'); // 24小时制备用
|
|
||||||
// final mm = dateTime.minute.toString().padLeft(2, '0');
|
|
||||||
// final ss = dateTime.second.toString().padLeft(2, '0');
|
|
||||||
// final ampm = dateTime.hour >= 12 ? 'PM' : 'AM';
|
|
||||||
//
|
|
||||||
// String result = format
|
|
||||||
// .replaceFirst(RegExp('YYYY'), yyyy)
|
|
||||||
// .replaceFirst(RegExp('MM'), MM)
|
|
||||||
// .replaceFirst(RegExp('DD'), dd)
|
|
||||||
// .replaceFirst(RegExp('hh'), hour12)
|
|
||||||
// .replaceFirst(RegExp('HH'), HH)
|
|
||||||
// .replaceFirst(RegExp('mm'), mm)
|
|
||||||
// .replaceFirst(RegExp('ss'), ss)
|
|
||||||
// .replaceFirst(RegExp('a'), ampm);
|
|
||||||
//
|
|
||||||
// return result;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
String formatDateUS(String dateStr, {bool withTime = false}) {
|
String formatDateUS(String dateStr, {bool withTime = false}) {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ name: plan
|
|||||||
description: "A new Flutter project."
|
description: "A new Flutter project."
|
||||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||||
|
|
||||||
version: 1.0.0
|
version: 1.0.2
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.8.1
|
sdk: ^3.8.1
|
||||||
|
|||||||
Reference in New Issue
Block a user