1
This commit is contained in:
@@ -1,12 +1,10 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:plan/page/plan/detail/navigation/bar_actions.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/coach_message.dart';
|
||||
import 'widgets/plan_list.dart';
|
||||
@@ -28,7 +26,6 @@ class PlanDetailPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _PlanDetailPageState extends State<PlanDetailPage> {
|
||||
bool _isEdit = false;
|
||||
final ScrollController scrollController = ScrollController();
|
||||
|
||||
///store对象
|
||||
@@ -44,28 +41,6 @@ class _PlanDetailPageState extends State<PlanDetailPage> {
|
||||
);
|
||||
}
|
||||
|
||||
///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 ChangeNotifierProvider<PlanDetailStore>(
|
||||
@@ -83,9 +58,8 @@ class _PlanDetailPageState extends State<PlanDetailPage> {
|
||||
child: ScrollBox(
|
||||
child: Container(
|
||||
decoration: shadowDecoration,
|
||||
child: CustomScrollView(
|
||||
controller: scrollController,
|
||||
slivers: [
|
||||
child: Column(
|
||||
children: [
|
||||
CoachMessage(),
|
||||
PlanList(),
|
||||
SuggestedTitle(),
|
||||
@@ -104,40 +78,7 @@ class _PlanDetailPageState extends State<PlanDetailPage> {
|
||||
backgroundColor: Colors.white,
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
middle: Text(store.planDetail.summary ?? ""),
|
||||
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),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
trailing: BarActions(store: store),
|
||||
),
|
||||
child: child!,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user