@@ -2,6 +2,11 @@ import 'package:app_flowy/plugins/grid/application/cell/cell_service/cell_servic
22import 'package:app_flowy/plugins/grid/application/cell/checklist_cell_editor_bloc.dart' ;
33import 'package:app_flowy/plugins/grid/presentation/layout/sizes.dart' ;
44import 'package:app_flowy/plugins/grid/presentation/widgets/cell/checklist_cell/checklist_prograss_bar.dart' ;
5+ import 'package:app_flowy/plugins/grid/presentation/widgets/header/type_option/select_option_editor.dart' ;
6+ import 'package:appflowy_popover/appflowy_popover.dart' ;
7+ import 'package:flowy_infra/image.dart' ;
8+ import 'package:flowy_infra_ui/flowy_infra_ui.dart' ;
9+ import 'package:flowy_infra_ui/style_widget/icon_button.dart' ;
510import 'package:flowy_infra_ui/style_widget/scrolling/styled_list.dart' ;
611import 'package:flowy_infra_ui/widget/spacing.dart' ;
712import 'package:flutter/material.dart' ;
@@ -41,6 +46,8 @@ class _GridChecklistCellEditorState extends State<GridChecklistCellEditor> {
4146 builder: (context, state) {
4247 final List <Widget > slivers = [
4348 const SliverChecklistPrograssBar (),
49+ SliverToBoxAdapter (
50+ child: Container (color: Colors .red, height: 2 , width: 2100 )),
4451 SliverToBoxAdapter (
4552 child: ListView .separated (
4653 controller: ScrollController (),
@@ -55,27 +62,92 @@ class _GridChecklistCellEditorState extends State<GridChecklistCellEditor> {
5562 ),
5663 ),
5764 ];
58- return CustomScrollView (
59- shrinkWrap: true ,
60- slivers: slivers,
61- controller: ScrollController (),
62- physics: StyledScrollPhysics (),
65+ return Padding (
66+ padding: const EdgeInsets .symmetric (horizontal: 8 ),
67+ child: CustomScrollView (
68+ shrinkWrap: true ,
69+ slivers: slivers,
70+ controller: ScrollController (),
71+ physics: StyledScrollPhysics (),
72+ ),
6373 );
6474 },
6575 ),
6676 );
6777 }
6878}
6979
70- class _ChecklistOptionCell extends StatelessWidget {
80+ class _ChecklistOptionCell extends StatefulWidget {
7181 final ChecklistSelectOption option;
7282 const _ChecklistOptionCell ({
7383 required this .option,
7484 Key ? key,
7585 }) : super (key: key);
7686
87+ @override
88+ State <_ChecklistOptionCell > createState () => _ChecklistOptionCellState ();
89+ }
90+
91+ class _ChecklistOptionCellState extends State <_ChecklistOptionCell > {
92+ late PopoverController _popoverController;
93+
94+ @override
95+ void initState () {
96+ _popoverController = PopoverController ();
97+ super .initState ();
98+ }
99+
77100 @override
78101 Widget build (BuildContext context) {
79- return Container (height: 20 , width: 100 , color: Colors .red);
102+ final icon = widget.option.isSelected
103+ ? svgWidget ('editor/editor_check' )
104+ : svgWidget ('editor/editor_uncheck' );
105+ return _wrapPopover (
106+ SizedBox (
107+ height: GridSize .typeOptionItemHeight,
108+ child: Row (
109+ children: [
110+ icon,
111+ const HSpace (6 ),
112+ FlowyText (widget.option.data.name),
113+ const Spacer (),
114+ _disclosureButton (),
115+ ],
116+ ),
117+ ),
118+ );
119+ }
120+
121+ Widget _disclosureButton () {
122+ return FlowyIconButton (
123+ width: 20 ,
124+ onPressed: () => _popoverController.show (),
125+ hoverColor: Colors .transparent,
126+ iconPadding: const EdgeInsets .fromLTRB (4 , 4 , 4 , 4 ),
127+ icon: svgWidget (
128+ "editor/details" ,
129+ color: Theme .of (context).colorScheme.onSurface,
130+ ),
131+ );
132+ }
133+
134+ Widget _wrapPopover (Widget child) {
135+ return AppFlowyPopover (
136+ controller: _popoverController,
137+ offset: const Offset (20 , 0 ),
138+ asBarrier: true ,
139+ constraints: BoxConstraints .loose (const Size (200 , 300 )),
140+ child: child,
141+ popupBuilder: (BuildContext popoverContext) {
142+ return SelectOptionTypeOptionEditor (
143+ option: widget.option.data,
144+ onDeleted: () {},
145+ onUpdated: (updatedOption) {},
146+ key: ValueKey (
147+ widget.option.data.id,
148+ ), // Use ValueKey to refresh the UI, otherwise, it will remain the old value.
149+ );
150+ },
151+ );
80152 }
81153}
0 commit comments