Skip to content

Commit 7afdb09

Browse files
authored
Merge pull request #19 from ionicfirebaseapp/master
master pull
2 parents c3870c4 + 330e258 commit 7afdb09

File tree

11 files changed

+405
-81
lines changed

11 files changed

+405
-81
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ Read the [Getting started page](https://docs.getflutter.dev)
3333
Forum [Support and discussion ](https://forum.getflutter.dev)
3434

3535
## Features
36-
In this beta release, we are going to launch the library with the following components :
36+
we have launched the library with the following components :
3737

38-
#### [Button](https://docs.getflutter.dev/gf-button) | [Badge](https://docs.getflutter.dev/gf-badge) | [Avatar](https://docs.getflutter.dev/gf-avatar) | [Image](https://docs.getflutter.dev/gf-image) | [Card](https://docs.getflutter.dev/gf-card) | [Carousel](https://docs.getflutter.dev/gf-carousel) | [Tile](https://docs.getflutter.dev/gf-tile) | [Tab](https://docs.getflutter.dev/gf-tab) | [Typography](https://docs.getflutter.dev/gf-typography)
38+
#### [Button](https://docs.getflutter.dev/gf-button) | [Badge](https://docs.getflutter.dev/gf-badge) | [Avatar](https://docs.getflutter.dev/gf-avatar) | [Image](https://docs.getflutter.dev/gf-image) | [Card](https://docs.getflutter.dev/gf-card) | [Carousel](https://docs.getflutter.dev/gf-carousel) | [Tile](https://docs.getflutter.dev/gf-tile) | [Tab](https://docs.getflutter.dev/gf-tab) | [Typography](https://docs.getflutter.dev/gf-typography) | [Toast](https://docs.getflutter.dev/gf-toast) | [Toggle](https://docs.getflutter.dev/gf-toggle) | [Drawer](https://docs.getflutter.dev/gf-drawer) | [Accordian](https://docs.getflutter.dev/gf-accordion) | [Alert](https://docs.getflutter.dev/gf-alert) | [Appbar](https://docs.getflutter.dev/gf-appbar) | [Searchbar](https://docs.getflutter.dev/gf-searchbar)
3939

4040

4141
## Demo

example/lib/assets/heart.png

8.16 KB
Loading
14 KB
Loading

example/lib/assets/heart_half.png

11.4 KB
Loading

example/lib/main.dart

Lines changed: 100 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,14 @@ class _MyHomePageState extends State<MyHomePage>
4040
GlobalKey<ScaffoldState>();
4141

4242
TabController tabController;
43+
final _ratingController = TextEditingController();
44+
double _rating = 3.5;
45+
double _userRating = 4.5;
4346

4447
@override
4548
void initState() {
4649
super.initState();
50+
_ratingController.text = '4.5';
4751
tabController = TabController(length: 3, vsync: this);
4852
}
4953

@@ -67,8 +71,6 @@ class _MyHomePageState extends State<MyHomePage>
6771
'Xamarin2',
6872
];
6973

70-
double rating = 3.5;
71-
7274
@override
7375
Widget build(BuildContext context) => Scaffold(
7476
drawer: GFDrawer(
@@ -174,10 +176,16 @@ class _MyHomePageState extends State<MyHomePage>
174176
// Container(color: Colors.blue)
175177
// ]),
176178

179+
<<<<<<< HEAD
180+
SingleChildScrollView(
181+
child: Column(
182+
mainAxisAlignment: MainAxisAlignment.center,
183+
=======
177184
// SingleChildScrollView(
178185
// child:
179186
Column(
180187
mainAxisAlignment: MainAxisAlignment.start,
188+
>>>>>>> ccc97fde38d7e90bca8ef572ba85c4254a92c687
181189
crossAxisAlignment: CrossAxisAlignment.center,
182190
children: <Widget>[
183191
GFSearchBar(
@@ -214,50 +222,106 @@ class _MyHomePageState extends State<MyHomePage>
214222
}),
215223

216224
GFRating(
217-
rating: rating,
218-
// itemSize: 65,
219-
filledIcon: Icons.star,
220-
halfFilledIcon: Icons.star_half,
221-
defaultIcon: Icons.star_border,
222-
itemCount: 5,
223-
allowHalfRating: false,
224-
spacing: 2,
225+
rating: _rating,
226+
itemSize: 50,
227+
// filledIcon: Image.asset(
228+
// 'lib/assets/heart.png',
229+
// height: 50,
230+
// width: 50,
231+
// color: Colors.amber,
232+
// ),
233+
// halfFilledIcon: Image.asset(
234+
// 'lib/assets/heart_half.png',
235+
// height: 50,
236+
// width: 50,
237+
// color: Colors.amber,
238+
// ),
239+
// defaultIcon: Image.asset(
240+
// 'lib/assets/heart_border.png',
241+
// height: 50,
242+
// width: 50,
243+
// color: Colors.amber,
244+
// ),
245+
// allowHalfRating: false,
246+
spacing: 8,
225247
color: Colors.teal,
226248
borderColor: Colors.tealAccent,
227249
onRatingChanged: (value) {
228250
setState(() {
229-
rating = value;
251+
_rating = value;
252+
print('user selected $_rating');
230253
});
231254
},
232255
),
233256

234-
GFCard(
235-
content: Column(
236-
children: <Widget>[
237-
const GFTypography(
238-
text: 'Toast',
239-
type: GFTypographyType.typo6,
240-
),
241-
const SizedBox(
242-
height: 20,
243-
),
244-
const SizedBox(
245-
height: 20,
246-
),
247-
GFToast(
248-
text: 'Happy New Year',
249-
button: GFButton(
250-
onPressed: () {
251-
print('dfr');
252-
},
253-
text: 'OK',
254-
type: GFButtonType.outline,
255-
color: GFColor.warning,
256-
),
257-
),
258-
],
257+
SizedBox(
258+
height: 20,
259+
child: Text('selected rating ${_rating.toStringAsFixed(1)}'),
260+
),
261+
262+
GFRating(
263+
rating: _userRating,
264+
itemSize: 50,
265+
filledIcon: Image.asset(
266+
'lib/assets/heart.png',
267+
height: 50,
268+
width: 50,
269+
color: Colors.amber,
270+
),
271+
halfFilledIcon: Image.asset(
272+
'lib/assets/heart_half.png',
273+
height: 50,
274+
width: 50,
275+
color: Colors.amber,
276+
),
277+
defaultIcon: Image.asset(
278+
'lib/assets/heart_border.png',
279+
height: 50,
280+
width: 50,
281+
color: Colors.amber,
282+
),
283+
ratingController: _ratingController,
284+
textFormRating: true,
285+
spacing: 8,
286+
color: Colors.teal,
287+
borderColor: Colors.tealAccent,
288+
suffixIcon: MaterialButton(
289+
onPressed: () {
290+
setState(() {
291+
_userRating = double.parse(_ratingController.text ?? '0.0');
292+
});
293+
},
294+
child: const Text('Rate'),
259295
),
260296
),
297+
298+
// GFCard(
299+
// content: Column(
300+
// children: <Widget>[
301+
// const GFTypography(
302+
// text: 'Toast',
303+
// type: GFTypographyType.typo6,
304+
// ),
305+
// const SizedBox(
306+
// height: 20,
307+
// ),
308+
// const SizedBox(
309+
// height: 20,
310+
// ),
311+
// GFToast(
312+
// text: 'Happy New Year',
313+
// button: GFButton(
314+
// onPressed: () {
315+
// print('dfr');
316+
// },
317+
// text: 'OK',
318+
// type: GFButtonType.outline,
319+
// color: GFColor.warning,
320+
// ),
321+
// ),
322+
// ],
323+
// ),
324+
// ),
261325
//
262326
// GFCard(
263327
// content: Column(

example/pubspec.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@ flutter:
2828
assets:
2929
- lib/assets/food.jpeg
3030
- lib/assets/img.png
31+
- lib/assets/heart.png
32+
- lib/assets/heart_border.png
33+
- lib/assets/heart_half.png

lib/components/accordian/gf_accordian.dart

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ class _GFAccordionState extends State<GFAccordion>
107107

108108
@override
109109
Widget build(BuildContext context) => Container(
110-
margin:
111-
widget.margin != null ? widget.margin : const EdgeInsets.all(10),
110+
margin: widget.margin ?? const EdgeInsets.all(10),
112111
child: Column(
113112
crossAxisAlignment: CrossAxisAlignment.start,
114113
children: <Widget>[
@@ -152,9 +151,7 @@ class _GFAccordionState extends State<GFAccordion>
152151
? Container(
153152
decoration: BoxDecoration(
154153
border: widget.contentBorderColor,
155-
color: widget.contentbackgroundColor != null
156-
? widget.contentbackgroundColor
157-
: Colors.white70,
154+
color: widget.contentbackgroundColor ?? Colors.white70,
158155
),
159156
width: MediaQuery.of(context).size.width,
160157
padding: widget.contentPadding,

lib/components/alert/gf_alert.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,7 @@ class _GFAlertState extends State<GFAlert> with TickerProviderStateMixin {
110110
: GFColors.getGFColor(GFColor.white),
111111
boxShadow: [
112112
BoxShadow(
113-
color: Colors.black.withOpacity(0.40),
114-
blurRadius: 3,
115-
)
113+
color: Colors.black.withOpacity(0.40), blurRadius: 3)
116114
]),
117115
child: Column(
118116
crossAxisAlignment: CrossAxisAlignment.start,

0 commit comments

Comments
 (0)