|
| 1 | +import 'package:flutter/cupertino.dart'; |
| 2 | +import 'package:flutter/material.dart'; |
| 3 | +import 'package:flutter/widgets.dart'; |
| 4 | +import 'package:getwidget/getwidget.dart'; |
| 5 | + |
| 6 | +final List<String> imageList = [ |
| 7 | + 'https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg', |
| 8 | + 'https://cdn.pixabay.com/photo/2017/12/13/00/23/christmas-3015776_960_720.jpg', |
| 9 | + 'https://cdn.pixabay.com/photo/2019/12/19/10/55/christmas-market-4705877_960_720.jpg', |
| 10 | + 'https://cdn.pixabay.com/photo/2019/12/20/00/03/road-4707345_960_720.jpg', |
| 11 | + 'https://cdn.pixabay.com/photo/2019/12/22/04/18/x-mas-4711785__340.jpg', |
| 12 | + 'https://cdn.pixabay.com/photo/2016/11/22/07/09/spruce-1848543__340.jpg', |
| 13 | + 'https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg', |
| 14 | + 'https://cdn.pixabay.com/photo/2017/12/13/00/23/christmas-3015776_960_720.jpg', |
| 15 | +]; |
| 16 | + |
| 17 | +void main() => runApp(MyApp()); |
| 18 | + |
| 19 | +class MyApp extends StatelessWidget { |
| 20 | + @override |
| 21 | + Widget build(BuildContext context) => MaterialApp( |
| 22 | + title: 'GetWidget Example', |
| 23 | + theme: ThemeData( |
| 24 | + primarySwatch: Colors.blue, |
| 25 | + ), |
| 26 | + debugShowCheckedModeBanner: false, |
| 27 | + home: const MyHomePage(title: 'GetWidget Example'), |
| 28 | + ); |
| 29 | +} |
| 30 | + |
| 31 | +class MyHomePage extends StatefulWidget { |
| 32 | + const MyHomePage({Key key, this.title}) : super(key: key); |
| 33 | + |
| 34 | + final String title; |
| 35 | + |
| 36 | + @override |
| 37 | + _MyHomePageState createState() => _MyHomePageState(); |
| 38 | +} |
| 39 | + |
| 40 | +class _MyHomePageState extends State<MyHomePage> |
| 41 | + with SingleTickerProviderStateMixin { |
| 42 | + final _scaffoldKey = new GlobalKey<ScaffoldState>(); |
| 43 | + TabController tabController; |
| 44 | + final _ratingController = TextEditingController(); |
| 45 | + bool check = false; |
| 46 | + String searchData; |
| 47 | + final TextEditingController _searchController = TextEditingController(); |
| 48 | + int groupValue = 0; |
| 49 | + final GFBottomSheetController _controller = GFBottomSheetController(); |
| 50 | + double foo = 100.0; |
| 51 | + |
| 52 | + @override |
| 53 | + void initState() { |
| 54 | + super.initState(); |
| 55 | + _ratingController.text = '4.5'; |
| 56 | + tabController = TabController(length: 6, initialIndex: 3, vsync: this); |
| 57 | + } |
| 58 | + |
| 59 | + @override |
| 60 | + void dispose() { |
| 61 | + tabController.dispose(); |
| 62 | + super.dispose(); |
| 63 | + } |
| 64 | + |
| 65 | + bool switchValue = true; |
| 66 | + bool showToast = false; |
| 67 | + |
| 68 | + List list = [ |
| 69 | + 'Flutter', |
| 70 | + 'React', |
| 71 | + 'Ionic', |
| 72 | + 'Xamarin', |
| 73 | + 'Flutter2', |
| 74 | + 'React2', |
| 75 | + 'Ionic2', |
| 76 | + 'Xamarin2', |
| 77 | + ]; |
| 78 | + |
| 79 | + void _persistentBottomSheet() { |
| 80 | + _scaffoldKey.currentState.showBottomSheet((context) => Container( |
| 81 | + color: Colors.redAccent, |
| 82 | + height: 250, |
| 83 | + child: const Center( |
| 84 | + child: Text('Hey! guys , this is a persistent bottom sheet'), |
| 85 | + ), |
| 86 | + )); |
| 87 | + } |
| 88 | + |
| 89 | + void _modalBottomSheetMenu() { |
| 90 | + showModalBottomSheet( |
| 91 | + context: context, |
| 92 | + elevation: 10, |
| 93 | + builder: (builder) => Container( |
| 94 | + height: 350, |
| 95 | + color: Colors.transparent, |
| 96 | + child: Container( |
| 97 | + decoration: const BoxDecoration( |
| 98 | + color: Colors.white, |
| 99 | + borderRadius: BorderRadius.only( |
| 100 | + topLeft: Radius.circular(10), |
| 101 | + topRight: Radius.circular(10))), |
| 102 | + child: const Center( |
| 103 | + child: Text('This is a modal sheet'), |
| 104 | + )), |
| 105 | + )); |
| 106 | + } |
| 107 | + |
| 108 | + @override |
| 109 | + Widget build(BuildContext context) => Scaffold( |
| 110 | + key: _scaffoldKey, |
| 111 | + appBar: GFAppBar( |
| 112 | + backgroundColor: Colors.blueGrey, |
| 113 | + title: const Text('UI Kit'), |
| 114 | + centerTitle: true, |
| 115 | + ), |
| 116 | + body: SingleChildScrollView( |
| 117 | + child: Column( |
| 118 | + mainAxisAlignment: MainAxisAlignment.start, |
| 119 | + crossAxisAlignment: CrossAxisAlignment.center, |
| 120 | + children: [ |
| 121 | + Container( |
| 122 | + height: 10, |
| 123 | + ), |
| 124 | + Radio( |
| 125 | + value: 0, |
| 126 | + groupValue: groupValue, |
| 127 | + onChanged: (val) { |
| 128 | + setState(() { |
| 129 | + groupValue = val; |
| 130 | + }); |
| 131 | + }, |
| 132 | + ), |
| 133 | + Radio( |
| 134 | + value: 1, |
| 135 | + groupValue: groupValue, |
| 136 | + onChanged: (val) { |
| 137 | + setState(() { |
| 138 | + groupValue = val; |
| 139 | + }); |
| 140 | + }, |
| 141 | + ), |
| 142 | +// Expanded(child: SizedBox.expand( |
| 143 | +// child: DraggableScrollableSheet( |
| 144 | +// builder: (BuildContext context, ScrollController scrollController) => Container( |
| 145 | +// color: Colors.blue[100], |
| 146 | +// child: ListView.builder( |
| 147 | +// controller: scrollController, |
| 148 | +// itemCount: 25, |
| 149 | +// itemBuilder: (BuildContext context, int index) => ListTile(title: Text('Item $index')), |
| 150 | +// ), |
| 151 | +// ), |
| 152 | +// ), |
| 153 | +// ),) |
| 154 | + ], |
| 155 | + ), |
| 156 | + ), |
| 157 | + bottomSheet: GFBottomSheet( |
| 158 | + controller: _controller, |
| 159 | +// minContentHeight: 100, |
| 160 | + maxContentHeight: 500, |
| 161 | +// elevation: 10, |
| 162 | + stickyHeader: Container( |
| 163 | + decoration: BoxDecoration( |
| 164 | + borderRadius: BorderRadius.circular(10), |
| 165 | + color: Colors.tealAccent), |
| 166 | + height: 50, |
| 167 | + child: const Center( |
| 168 | + child: Text('Swipe me!'), |
| 169 | + ), |
| 170 | + ), |
| 171 | + contentBody: Container( |
| 172 | + child: ListView( |
| 173 | + children: const [ |
| 174 | + Text('fhj'), |
| 175 | + Text('fhj'), |
| 176 | + Text('fhj'), |
| 177 | + Text('fhj'), |
| 178 | + Text('fhj'), |
| 179 | + Text('fhj'), |
| 180 | + ], |
| 181 | + ), |
| 182 | + ), |
| 183 | + stickyFooter: Container( |
| 184 | + color: Theme.of(context).primaryColor, |
| 185 | + height: 100, |
| 186 | + child: const Center( |
| 187 | + child: Text('I am Footer!'), |
| 188 | + ), |
| 189 | + ), |
| 190 | + stickyFooterHeight: 50, |
| 191 | + ), |
| 192 | + floatingActionButton: FloatingActionButton( |
| 193 | + child: const Icon(Icons.stars), |
| 194 | + onPressed: () { |
| 195 | +// _persistentBottomSheet(); |
| 196 | +// _modalBottomSheetMenu(); |
| 197 | + _controller.isBottomSheetOpened |
| 198 | + ? _controller.hideBottomSheet() |
| 199 | + : _controller.showBottomSheet(); |
| 200 | + }), |
| 201 | + ); |
| 202 | +} |
0 commit comments