1
This commit is contained in:
@@ -1,29 +1,148 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:plan/page/plan/detail/viewmodel/plan_detail_store.dart';
|
||||
import 'package:plan/theme/decorations/app_shadows.dart';
|
||||
import 'package:plan/widgets/ui_kit/popup/popup_action.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:remixicon/remixicon.dart';
|
||||
|
||||
import '../widgets/edit_desc_dialog.dart';
|
||||
import 'widgets/avatar_card.dart';
|
||||
import 'widgets/plan_item.dart';
|
||||
import 'widgets/scroll_box.dart';
|
||||
import 'widgets/suggested.dart';
|
||||
|
||||
class PlanDetailPage extends StatefulWidget {
|
||||
const PlanDetailPage({super.key});
|
||||
final String? id;
|
||||
final String? planName;
|
||||
|
||||
const PlanDetailPage({
|
||||
super.key,
|
||||
this.id,
|
||||
this.planName,
|
||||
});
|
||||
|
||||
@override
|
||||
State<PlanDetailPage> createState() => _PlanDetailPageState();
|
||||
}
|
||||
|
||||
class _PlanDetailPageState extends State<PlanDetailPage> {
|
||||
bool _isEdit = false;
|
||||
|
||||
///popup菜单
|
||||
void _onPopupActionSelected(String value) {
|
||||
if (value == 'edit_step') {
|
||||
setState(() {
|
||||
_isEdit = true;
|
||||
});
|
||||
} else if (value == 'edit_desc') {
|
||||
showEditDescDialog(
|
||||
context,
|
||||
value: "你好",
|
||||
onConfirm: (value) {},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
///取消编辑
|
||||
void _cancelEdit() {
|
||||
setState(() {
|
||||
_isEdit = false;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CupertinoPageScaffold(
|
||||
backgroundColor: Colors.white,
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
middle: Text('计划详情'),
|
||||
trailing: Row(
|
||||
mainAxisSize: MainAxisSize.min, // 关键:Row 只占实际内容宽度
|
||||
children: [
|
||||
Icon(RemixIcons.more_fill),
|
||||
],
|
||||
return ChangeNotifierProvider<PlanDetailStore>(
|
||||
create: (_) {
|
||||
return PlanDetailStore();
|
||||
},
|
||||
child: CupertinoPageScaffold(
|
||||
backgroundColor: Colors.white,
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
middle: Text('计划详情'),
|
||||
trailing: Row(
|
||||
mainAxisSize: MainAxisSize.min, // 关键:Row 只占实际内容宽度
|
||||
children: [
|
||||
AnimatedSwitcher(
|
||||
duration: Duration(milliseconds: 300),
|
||||
transitionBuilder: (child, animation) {
|
||||
// 仅使用渐变动画
|
||||
return FadeTransition(
|
||||
opacity: animation,
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
child: _isEdit
|
||||
? InkWell(
|
||||
onTap: _cancelEdit,
|
||||
child: Icon(RemixIcons.check_fill),
|
||||
)
|
||||
: PopupAction(
|
||||
onSelected: _onPopupActionSelected,
|
||||
items: [
|
||||
PopupMenuItem(
|
||||
value: 'edit_step',
|
||||
child: Text("编辑步骤"),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: 'edit_desc',
|
||||
child: Text("编辑摘要"),
|
||||
),
|
||||
],
|
||||
child: Icon(RemixIcons.more_fill),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
child: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
AvatarCard(),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(15),
|
||||
child: ScrollBox(
|
||||
child: Container(
|
||||
decoration: shadowDecoration,
|
||||
child: CustomScrollView(
|
||||
slivers: [
|
||||
SliverToBoxAdapter(
|
||||
child: SizedBox(height: 20),
|
||||
),
|
||||
SliverList.builder(
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return PlanItem(
|
||||
showEdit: _isEdit,
|
||||
title: "测试 ${index + 1}",
|
||||
desc: "测测 ${index + 1}",
|
||||
onDelete: (id) {},
|
||||
);
|
||||
},
|
||||
itemCount: 10,
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: SuggestedTitle(),
|
||||
),
|
||||
SliverList.builder(
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return SuggestedItem(
|
||||
title: "测试",
|
||||
);
|
||||
},
|
||||
itemCount: 5,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Column(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
13
lib/page/plan/detail/viewmodel/plan_detail_store.dart
Normal file
13
lib/page/plan/detail/viewmodel/plan_detail_store.dart
Normal file
@@ -0,0 +1,13 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
class PlanDetailStore extends ChangeNotifier {
|
||||
///角色话语是否显示
|
||||
bool _showRoleTalk = true;
|
||||
|
||||
bool get showRoleTalk => _showRoleTalk;
|
||||
|
||||
set showRoleTalk(bool value) {
|
||||
_showRoleTalk = value;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
137
lib/page/plan/detail/widgets/avatar_card.dart
Normal file
137
lib/page/plan/detail/widgets/avatar_card.dart
Normal file
@@ -0,0 +1,137 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:remixicon/remixicon.dart';
|
||||
|
||||
class AvatarCard extends StatefulWidget {
|
||||
const AvatarCard({super.key});
|
||||
|
||||
@override
|
||||
State<AvatarCard> createState() => _AvatarCardState();
|
||||
}
|
||||
|
||||
class _AvatarCardState extends State<AvatarCard> with SingleTickerProviderStateMixin {
|
||||
bool _isShow = false;
|
||||
|
||||
late AnimationController _controller;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_controller = AnimationController(
|
||||
vsync: this,
|
||||
duration: Duration(milliseconds: 400),
|
||||
);
|
||||
}
|
||||
|
||||
void _toggleShow() {
|
||||
setState(() {
|
||||
_isShow = !_isShow;
|
||||
if (_isShow) {
|
||||
_controller.forward();
|
||||
} else {
|
||||
_controller.reverse();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 30),
|
||||
child: Transform.translate(
|
||||
offset: Offset(0, 50),
|
||||
child: Column(
|
||||
children: [
|
||||
Transform(
|
||||
alignment: Alignment.center,
|
||||
transform: Matrix4.identity()..translate(40.0, 40.0)..scale(0.2),
|
||||
child: Container(
|
||||
color: Colors.red,
|
||||
padding: EdgeInsets.only(bottom: 10),
|
||||
child: InkWell(
|
||||
onTap: _toggleShow,
|
||||
child: Stack(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.all(4),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(3),
|
||||
border: Border.all(color: Colors.black, width: 1),
|
||||
),
|
||||
child: Text(
|
||||
"好的,让我们把学习软件开发这个目标分解成最简单的小步骤,这样你明天就能轻松开始行动",
|
||||
style: TextStyle(fontSize: 12),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: CustomPaint(
|
||||
painter: BubblePainter(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: Stack(
|
||||
alignment: Alignment.bottomCenter,
|
||||
children: [
|
||||
Image.asset("assets/image/xiaozhi.png", height: 100),
|
||||
Positioned(
|
||||
top: 20,
|
||||
child: Transform.translate(
|
||||
offset: Offset(50, -10),
|
||||
child: GestureDetector(
|
||||
onTap: _toggleShow,
|
||||
child: Icon(RemixIcons.message_2_line, size: 26),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class BubblePainter extends CustomPainter {
|
||||
@override
|
||||
void paint(Canvas canvas, Size size) {
|
||||
var bottomWidth = 10;
|
||||
//点坐标
|
||||
var start = Offset((size.width - bottomWidth) / 2, 0);
|
||||
//底线
|
||||
final bottomLinePaint = Paint()
|
||||
..color = Colors.white
|
||||
..strokeWidth = 2
|
||||
..style = PaintingStyle.stroke;
|
||||
final bottomLinePath = Path()
|
||||
..moveTo(start.dx, 0)
|
||||
..lineTo(start.dx + bottomWidth, 0);
|
||||
canvas.drawPath(bottomLinePath, bottomLinePaint);
|
||||
|
||||
//边线
|
||||
final sideLinePaint = Paint()
|
||||
..color = Colors.black
|
||||
..strokeWidth = 1
|
||||
..style = bottomLinePaint.style;
|
||||
|
||||
final sideLinePath = Path()
|
||||
..moveTo(start.dx, 0)
|
||||
..lineTo(start.dx + bottomWidth / 2, 5)
|
||||
..lineTo(start.dx + bottomWidth, 0);
|
||||
canvas.drawPath(sideLinePath, sideLinePaint);
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldRepaint(covariant CustomPainter oldDelegate) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
71
lib/page/plan/detail/widgets/plan_item.dart
Normal file
71
lib/page/plan/detail/widgets/plan_item.dart
Normal file
@@ -0,0 +1,71 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:plan/widgets/business/delete_row_item.dart';
|
||||
import 'package:remixicon/remixicon.dart';
|
||||
|
||||
class PlanItem extends StatefulWidget {
|
||||
final String title;
|
||||
final String desc;
|
||||
final bool showEdit;
|
||||
final Function(int) onDelete;
|
||||
|
||||
const PlanItem({
|
||||
super.key,
|
||||
required this.title,
|
||||
required this.desc,
|
||||
this.showEdit = false,
|
||||
required this.onDelete,
|
||||
});
|
||||
|
||||
@override
|
||||
State<PlanItem> createState() => _PlanItemState();
|
||||
}
|
||||
|
||||
class _PlanItemState extends State<PlanItem> with AutomaticKeepAliveClientMixin {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||
child: DeleteRowItem(
|
||||
showDelete: widget.showEdit,
|
||||
onDelete: () {},
|
||||
builder: (_, animate) {
|
||||
return [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(bottom: 3),
|
||||
child: Text(
|
||||
"完成以上步骤后,给自己倒杯水休息一下。",
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
"就从这里开始,写下基本信息只需要2分钟,这是最简单的一部",
|
||||
style: Theme.of(context).textTheme.labelSmall,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizeTransition(
|
||||
axis: Axis.horizontal,
|
||||
sizeFactor: animate,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(left: 10),
|
||||
child: Opacity(
|
||||
opacity: 0.4,
|
||||
child: Icon(RemixIcons.menu_line),
|
||||
),
|
||||
),
|
||||
),
|
||||
];
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
}
|
||||
23
lib/page/plan/detail/widgets/scroll_box.dart
Normal file
23
lib/page/plan/detail/widgets/scroll_box.dart
Normal file
@@ -0,0 +1,23 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ScrollBox extends StatelessWidget {
|
||||
final Widget child;
|
||||
|
||||
const ScrollBox({super.key, required this.child});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ScrollbarTheme(
|
||||
data: ScrollbarThemeData(
|
||||
thumbColor: WidgetStateProperty.all(Theme.of(context).colorScheme.surfaceContainerHigh),
|
||||
thickness: WidgetStateProperty.all(3),
|
||||
crossAxisMargin: 3,
|
||||
mainAxisMargin: 2,
|
||||
radius: const Radius.circular(5),
|
||||
),
|
||||
child: Scrollbar(
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
73
lib/page/plan/detail/widgets/suggested.dart
Normal file
73
lib/page/plan/detail/widgets/suggested.dart
Normal file
@@ -0,0 +1,73 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:remixicon/remixicon.dart';
|
||||
|
||||
///模块标题
|
||||
class SuggestedTitle extends StatelessWidget {
|
||||
const SuggestedTitle({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(top: 20, bottom: 5),
|
||||
child: Opacity(
|
||||
opacity: 0.6,
|
||||
child: Row(
|
||||
spacing: 20,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width: 15,
|
||||
height: 1,
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
||||
),
|
||||
Text(
|
||||
"额外建议",
|
||||
style: Theme.of(context).textTheme.titleSmall,
|
||||
),
|
||||
Container(
|
||||
width: 15,
|
||||
height: 1,
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHigh,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class SuggestedItem extends StatelessWidget {
|
||||
final String title;
|
||||
|
||||
const SuggestedItem({super.key, required this.title});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 10,
|
||||
children: [
|
||||
Transform.translate(
|
||||
offset: const Offset(0, 5),
|
||||
child: Icon(
|
||||
RemixIcons.lightbulb_flash_fill,
|
||||
color: Color(0xfff2a529),
|
||||
size: 18,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Opacity(
|
||||
opacity: 0.5,
|
||||
child: Text(
|
||||
title,
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:remixicon/remixicon.dart';
|
||||
|
||||
import 'widgets/history_item.dart';
|
||||
import 'widgets/popup_action.dart';
|
||||
import '../../../widgets/ui_kit/popup/popup_action.dart';
|
||||
|
||||
class PlanHistoryPage extends StatefulWidget {
|
||||
const PlanHistoryPage({super.key});
|
||||
@@ -42,22 +43,19 @@ class _PlanHistoryPageState extends State<PlanHistoryPage> {
|
||||
return CupertinoPageScaffold(
|
||||
backgroundColor: Theme.of(context).colorScheme.surfaceContainer,
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
middle: Text("计划历史"),
|
||||
trailing: CupertinoNavigationBar(
|
||||
transitionBetweenRoutes: false,
|
||||
middle: const Text("计划历史"),
|
||||
trailing: PopupAction(
|
||||
onSelected: _onPopupActionSelected,
|
||||
items: [
|
||||
PopupMenuItem(
|
||||
value: 'edit',
|
||||
child: Text(
|
||||
_isDelete ? "完成" : "编辑",
|
||||
style: TextStyle(color: Colors.black),
|
||||
),
|
||||
middle: const Text("计划历史"),
|
||||
trailing: PopupAction(
|
||||
onSelected: _onPopupActionSelected,
|
||||
items: [
|
||||
PopupMenuItem(
|
||||
value: 'edit',
|
||||
child: Text(
|
||||
_isDelete ? "完成" : "编辑",
|
||||
style: TextStyle(color: Colors.black),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
child: Icon(RemixIcons.more_fill),
|
||||
),
|
||||
),
|
||||
child: SafeArea(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:plan/router/config/route_paths.dart';
|
||||
import 'package:plan/widgets/business/delete_row_item.dart';
|
||||
import 'package:remixicon/remixicon.dart';
|
||||
|
||||
class HistoryItem extends StatefulWidget {
|
||||
@@ -18,76 +18,15 @@ class HistoryItem extends StatefulWidget {
|
||||
State<HistoryItem> createState() => _HistoryItemState();
|
||||
}
|
||||
|
||||
class _HistoryItemState extends State<HistoryItem> with TickerProviderStateMixin {
|
||||
late AnimationController _controller;
|
||||
late Animation<double> _animation;
|
||||
|
||||
class _HistoryItemState extends State<HistoryItem> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_controller = AnimationController(
|
||||
vsync: this,
|
||||
duration: Duration(milliseconds: 300),
|
||||
);
|
||||
_animation = CurvedAnimation(
|
||||
parent: _controller,
|
||||
curve: Curves.easeInOut,
|
||||
);
|
||||
|
||||
if (widget.showDelete) {
|
||||
_controller.forward();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant HistoryItem oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (oldWidget.showDelete != widget.showDelete) {
|
||||
if (widget.showDelete) {
|
||||
_controller.forward();
|
||||
} else {
|
||||
_controller.reverse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
///点击删除
|
||||
void _handleDelete() {
|
||||
showCupertinoDialog(
|
||||
context: context,
|
||||
builder: (_) {
|
||||
return CupertinoAlertDialog(
|
||||
title: Text("删除计划"),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text("取消"),
|
||||
onPressed: () {
|
||||
context.pop();
|
||||
},
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
isDestructiveAction: true,
|
||||
onPressed: () {
|
||||
context.pop();
|
||||
widget.onDelete(0);
|
||||
},
|
||||
child: Text("确定"),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
///跳转详情
|
||||
void _goDetail() {
|
||||
context.push(RoutePaths.planDetail);
|
||||
context.push(RoutePaths.planDetail(1));
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -98,62 +37,53 @@ class _HistoryItemState extends State<HistoryItem> with TickerProviderStateMixin
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.symmetric(vertical: 15),
|
||||
color: Colors.white,
|
||||
child: Row(
|
||||
children: [
|
||||
SizeTransition(
|
||||
axis: Axis.horizontal,
|
||||
sizeFactor: _animation,
|
||||
axisAlignment: -1, // 从左向右展开
|
||||
child: InkWell(
|
||||
onTap: _handleDelete,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(right: 10),
|
||||
child: Icon(
|
||||
RemixIcons.indeterminate_circle_fill,
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(bottom: 5),
|
||||
child: Text("开始学习软件开发"),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(bottom: 5),
|
||||
child: Text(
|
||||
"创建于 2025/9/3 9:40:51 教练:W教练",
|
||||
style: Theme.of(context).textTheme.labelSmall,
|
||||
child: DeleteRowItem(
|
||||
showDelete: widget.showDelete,
|
||||
onDelete: () {
|
||||
widget.onDelete(0);
|
||||
},
|
||||
builder: (_, __) {
|
||||
return [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(bottom: 5),
|
||||
child: Text("开始学习软件开发"),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
spacing: 10,
|
||||
children: [
|
||||
Expanded(
|
||||
child: LinearProgressIndicator(
|
||||
value: 0.5,
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
"0/7",
|
||||
Container(
|
||||
margin: EdgeInsets.only(bottom: 5),
|
||||
child: Text(
|
||||
"创建于 2025/9/3 9:40:51 教练:W教练",
|
||||
style: Theme.of(context).textTheme.labelSmall,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
spacing: 10,
|
||||
children: [
|
||||
Expanded(
|
||||
child: LinearProgressIndicator(
|
||||
value: 0.5,
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
"0/7",
|
||||
style: Theme.of(context).textTheme.labelSmall,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
RemixIcons.arrow_right_s_line,
|
||||
size: 30,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
],
|
||||
Icon(
|
||||
RemixIcons.arrow_right_s_line,
|
||||
size: 30,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
];
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:remixicon/remixicon.dart';
|
||||
|
||||
class PopupAction extends StatelessWidget {
|
||||
final List<PopupMenuEntry<String>> items;
|
||||
final Function(String) onSelected;
|
||||
|
||||
const PopupAction({
|
||||
super.key,
|
||||
required this.items,
|
||||
required this.onSelected,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return PopupMenuButton<String>(
|
||||
color: Colors.white,
|
||||
offset: Offset(0, 30),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12), // 圆角
|
||||
),
|
||||
constraints: BoxConstraints(
|
||||
minWidth: 200,
|
||||
),
|
||||
elevation: 6,
|
||||
shadowColor: Colors.black87,
|
||||
onSelected:onSelected,
|
||||
itemBuilder: (context) => items,
|
||||
child: const Icon(RemixIcons.more_fill),
|
||||
);
|
||||
}
|
||||
}
|
||||
48
lib/page/plan/widgets/edit_desc_dialog.dart
Normal file
48
lib/page/plan/widgets/edit_desc_dialog.dart
Normal file
@@ -0,0 +1,48 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
void showEditDescDialog(
|
||||
BuildContext context, {
|
||||
String value = "",
|
||||
required void Function(String) onConfirm,
|
||||
}) {
|
||||
final controller = TextEditingController(text: value);
|
||||
final focusNode = FocusNode();
|
||||
showCupertinoDialog(
|
||||
context: context,
|
||||
builder: (_) {
|
||||
// 确保弹窗显示后再获取焦点
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
focusNode.requestFocus();
|
||||
});
|
||||
|
||||
return CupertinoAlertDialog(
|
||||
title: Text("编辑摘要"),
|
||||
content: Padding(
|
||||
padding: EdgeInsets.only(top: 15),
|
||||
child: CupertinoTextField(
|
||||
controller: controller,
|
||||
focusNode: focusNode,
|
||||
placeholder: "edit...",
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
onPressed: () {
|
||||
context.pop();
|
||||
},
|
||||
child: Text('取消'),
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
isDefaultAction: true,
|
||||
onPressed: () {
|
||||
context.pop();
|
||||
onConfirm(controller.text);
|
||||
},
|
||||
child: Text('确认'),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user