Skip to content

Commit c81b60d

Browse files
committed
gfbottomsheet basic model is completed
1 parent e730033 commit c81b60d

File tree

4 files changed

+251
-1505
lines changed

4 files changed

+251
-1505
lines changed

example/lib/main_temp.dart

Lines changed: 35 additions & 233 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class _MyHomePageState extends State<MyHomePage> with SingleTickerProviderStateM
4545
String searchData;
4646
final TextEditingController _searchController = TextEditingController();
4747
int groupValue = 0;
48-
48+
SolidController _controller = SolidController();
4949

5050
@override
5151
void initState() {
@@ -86,18 +86,6 @@ class _MyHomePageState extends State<MyHomePage> with SingleTickerProviderStateM
8686
);
8787
}
8888

89-
List<IconData> icons = [
90-
Icons.ac_unit,
91-
Icons.account_balance,
92-
Icons.adb,
93-
Icons.add_photo_alternate,
94-
Icons.format_line_spacing
95-
];
96-
97-
GlobalKey<ExpandableBottomSheetState> key = new GlobalKey();
98-
// int _contentAmount = 0;
99-
// ExpansionStatus _expansionStatus = ExpansionStatus.contracted;
100-
10189

10290
@override
10391
Widget build(BuildContext context) => Scaffold(
@@ -108,129 +96,6 @@ class _MyHomePageState extends State<MyHomePage> with SingleTickerProviderStateM
10896
centerTitle: true,
10997
),
11098
body:
111-
112-
// ExpandableBottomSheet(
113-
// key: key,
114-
// onIsContractedCallback: () => print('contracted'),
115-
// onIsExtendedCallback: () => print('extended'),
116-
// animationDurationExtend: Duration(milliseconds: 500),
117-
// animationDurationContract: Duration(milliseconds: 250),
118-
// animationCurveExpand: Curves.bounceOut,
119-
// animationCurveContract: Curves.ease,
120-
//// persistentContentHeight: 220,
121-
// background: Container(
122-
// color: Colors.teal,
123-
// ),
124-
// persistentHeader: Container(
125-
// alignment: AlignmentDirectional.center,
126-
// color: Colors.orange,
127-
// constraints: BoxConstraints.expand(height: 40),
128-
// child: Text('dgfh hg '),
129-
// ),
130-
//
131-
// expandableContent: Container(
132-
// constraints: BoxConstraints(maxHeight: MediaQuery.of(context).size.height * 0.8),
133-
// child: SingleChildScrollView(
134-
// child: Column(
135-
// mainAxisSize: MainAxisSize.min,
136-
// children: const <Widget>[
137-
// GFListTile(
138-
// titleText: 'dfg',
139-
// description: Text('df hgdata '),
140-
// ),
141-
// GFListTile(
142-
// titleText: 'dfg',
143-
// description: Text('df hgdata '),
144-
// ),
145-
// GFListTile(
146-
// titleText: 'dfg',
147-
// description: Text('df hgdata '),
148-
// ),
149-
// GFListTile(
150-
// titleText: 'dfg',
151-
// description: Text('df hgdata '),
152-
// ),
153-
// GFListTile(
154-
// titleText: 'dfg',
155-
// description: Text('df hgdata '),
156-
// ),
157-
// GFListTile(
158-
// titleText: 'dfg',
159-
// description: Text('df hgdata '),
160-
// ),
161-
// GFListTile(
162-
// titleText: 'dfg',
163-
// description: Text('df hgdata '),
164-
// ),
165-
// GFListTile(
166-
// titleText: 'dfg',
167-
// description: Text('df hgdata '),
168-
// ),
169-
// GFListTile(
170-
// titleText: 'dfg',
171-
// description: Text('df hgdata '),
172-
// ),
173-
// GFListTile(
174-
// titleText: 'dfg',
175-
// description: Text('df hgdata '),
176-
// ),
177-
// GFListTile(
178-
// titleText: 'dfg',
179-
// description: Text('df hgdata '),
180-
// ),
181-
// GFListTile(
182-
// titleText: 'dfg',
183-
// description: Text('df hgdata '),
184-
// ),
185-
// ],
186-
// ),
187-
// ),
188-
// ),
189-
// ),
190-
191-
// persistentFooter: Container(
192-
// color: Colors.green,
193-
// height: 100,
194-
// child: Row(
195-
// mainAxisSize: MainAxisSize.max,
196-
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
197-
// children: <Widget>[
198-
// IconButton(
199-
// icon: Icon(Icons.add),
200-
// onPressed: () => setState(() {
201-
// _contentAmount++;
202-
// }),
203-
// ),
204-
// IconButton(
205-
// icon: Icon(Icons.arrow_upward),
206-
// onPressed: () => setState(() {
207-
// key.currentState.expand();
208-
// }),
209-
// ),
210-
// IconButton(
211-
// icon: Icon(Icons.cloud),
212-
// onPressed: () => setState(() {
213-
// _expansionStatus = key.currentState.expansionStatus;
214-
// }),
215-
// ),
216-
// IconButton(
217-
// icon: Icon(Icons.arrow_downward),
218-
// onPressed: () => setState(() {
219-
// key.currentState.contract();
220-
// }),
221-
// ),
222-
// IconButton(
223-
// icon: Icon(Icons.remove),
224-
// onPressed: () => setState(() {
225-
// if (_contentAmount > 0) _contentAmount--;
226-
// }),
227-
// ),
228-
// ],
229-
// ),
230-
// ),
231-
// ),
232-
233-
23499
SingleChildScrollView(
235100
child: Column(
236101
mainAxisAlignment: MainAxisAlignment.start,
@@ -240,98 +105,6 @@ class _MyHomePageState extends State<MyHomePage> with SingleTickerProviderStateM
240105
height: 10,
241106
),
242107

243-
RaisedButton(
244-
child: const Text('showModalBottomSheet'), onPressed: () {
245-
showModalGFBottomSheet<void>(
246-
context: context,
247-
// key: key,
248-
animationDurationExtend: Duration(milliseconds: 500),
249-
animationDurationContract: Duration(milliseconds: 250),
250-
animationCurveExpand: Curves.bounceOut,
251-
animationCurveContract: Curves.ease,
252-
persistentContentHeight: 220.0,
253-
// background: Container(
254-
// color: Colors.teal,
255-
// ),
256-
persistentHeader: Container(
257-
alignment: AlignmentDirectional.center,
258-
color: Colors.orange,
259-
constraints: BoxConstraints.expand(height: 40),
260-
child: Text('dgfh hg '),
261-
),
262-
263-
expandableContent: Container(
264-
constraints: BoxConstraints(maxHeight: MediaQuery.of(context).size.height * 0.8),
265-
child: SingleChildScrollView(
266-
child: Column(
267-
mainAxisSize: MainAxisSize.min,
268-
children: const <Widget>[
269-
GFListTile(
270-
titleText: 'dfg',
271-
description: Text('df hgdata '),
272-
),
273-
],
274-
),
275-
),
276-
),
277-
builder: (BuildContext context) =>
278-
Container(
279-
constraints: BoxConstraints(maxHeight: MediaQuery.of(context).size.height * 0.8),
280-
child: SingleChildScrollView(
281-
child: Column(
282-
mainAxisSize: MainAxisSize.min,
283-
children: const <Widget>[
284-
GFListTile(
285-
titleText: 'dfg',
286-
description: Text('df hgdata '),
287-
),
288-
GFListTile(
289-
titleText: 'dfg',
290-
description: Text('df hgdata '),
291-
),
292-
GFListTile(
293-
titleText: 'dfg',
294-
description: Text('df hgdata '),
295-
),
296-
GFListTile(
297-
titleText: 'dfg',
298-
description: Text('df hgdata '),
299-
),
300-
GFListTile(
301-
titleText: 'dfg',
302-
description: Text('df hgdata '),
303-
),
304-
GFListTile(
305-
titleText: 'dfg',
306-
description: Text('df hgdata '),
307-
),
308-
GFListTile(
309-
titleText: 'dfg',
310-
description: Text('df hgdata '),
311-
),
312-
GFListTile(
313-
titleText: 'dfg',
314-
description: Text('df hgdata '),
315-
),
316-
GFListTile(
317-
titleText: 'dfg',
318-
description: Text('df hgdata '),
319-
),
320-
GFListTile(
321-
titleText: 'dfg',
322-
description: Text('df hgdata '),
323-
),
324-
GFListTile(
325-
titleText: 'dfg',
326-
description: Text('df hgdata '),
327-
),
328-
],
329-
),
330-
),
331-
),
332-
);
333-
},),
334-
335108
Radio(
336109
value: 0,
337110
groupValue: groupValue,
@@ -354,11 +127,40 @@ class _MyHomePageState extends State<MyHomePage> with SingleTickerProviderStateM
354127
],
355128
),
356129
),
357-
floatingActionButton: FloatingActionButton(
358-
onPressed: (){
359-
_persistentBottomSheet();
360-
},
361-
child: const Icon(Icons.add),
130+
bottomSheet: GFBottomSheet(
131+
controller: _controller,
132+
stickyHeader: Container(
133+
color: Theme.of(context).primaryColor,
134+
height: 50,
135+
child: const Center(
136+
child: Text('Swipe me!'),
137+
),
138+
),
139+
contentBody: Container(
140+
color: Colors.white,
141+
child: ListView.builder(
142+
itemCount: 10,
143+
itemBuilder: (context, index) =>
144+
GFListTile(
145+
onTap: (){
146+
print('cdcvn');
147+
},
148+
title: Text('alpha $index'),
149+
)
150+
)
151+
),
152+
stickyFooter: Container(
153+
color: Theme.of(context).primaryColor,
154+
height: 50,
155+
child: const Center(
156+
child: Text('I am Footer!'),
157+
),
362158
),
159+
),
160+
floatingActionButton: FloatingActionButton(
161+
child: const Icon(Icons.stars),
162+
onPressed: () {
163+
_controller.isOpened ? _controller.hide() : _controller.show();
164+
}),
363165
);
364166
}

0 commit comments

Comments
 (0)