90 lines
2.4 KiB
Dart
90 lines
2.4 KiB
Dart
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:provider/provider.dart';
|
|
|
|
import 'widgets/avatar_card.dart';
|
|
import 'widgets/coach_message.dart';
|
|
import 'widgets/plan_list.dart';
|
|
import 'widgets/scroll_box.dart';
|
|
import 'widgets/suggested.dart';
|
|
|
|
class PlanDetailPage extends StatefulWidget {
|
|
final String? id;
|
|
final String? planName;
|
|
|
|
const PlanDetailPage({
|
|
super.key,
|
|
this.id,
|
|
this.planName,
|
|
});
|
|
|
|
@override
|
|
State<PlanDetailPage> createState() => _PlanDetailPageState();
|
|
}
|
|
|
|
class _PlanDetailPageState extends State<PlanDetailPage> {
|
|
final ScrollController scrollController = ScrollController();
|
|
|
|
///store对象
|
|
late PlanDetailStore store;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
store = PlanDetailStore(
|
|
planId: widget.id.toString(),
|
|
planContent: widget.planName ?? "",
|
|
scrollController: scrollController,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ChangeNotifierProvider<PlanDetailStore>(
|
|
create: (_) {
|
|
return store;
|
|
},
|
|
child: Consumer<PlanDetailStore>(
|
|
child: SafeArea(
|
|
child: Column(
|
|
children: [
|
|
AvatarCard(),
|
|
Expanded(
|
|
child: Padding(
|
|
padding: EdgeInsets.all(15),
|
|
child: ScrollBox(
|
|
child: Container(
|
|
decoration: shadowDecoration,
|
|
child: Column(
|
|
children: [
|
|
CoachMessage(),
|
|
PlanList(),
|
|
SuggestedTitle(),
|
|
SuggestedList(),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
builder: (context, store, child) {
|
|
return CupertinoPageScaffold(
|
|
backgroundColor: Colors.white,
|
|
navigationBar: CupertinoNavigationBar(
|
|
middle: Text(store.planDetail.summary ?? ""),
|
|
trailing: BarActions(store: store),
|
|
),
|
|
child: child!,
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
}
|