Skip to content

Commit 42a0349

Browse files
committed
gflists in progress
1 parent a8d4925 commit 42a0349

4 files changed

Lines changed: 119 additions & 58 deletions

File tree

example/lib/main.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import 'package:ui_kit/components/toggle/gf_toggle.dart';
3838
import 'package:ui_kit/components/header/gf_header.dart';
3939
import 'package:ui_kit/types/gf_heading_type.dart';
4040
import 'package:ui_kit/types/gf_toggle_type.dart';
41+
import 'package:ui_kit/components/list/gf_list.dart';
4142

4243
final List<String> imageList = [
4344
"https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg",
@@ -98,6 +99,14 @@ class _MyHomePageState extends State<MyHomePage> {
9899
crossAxisAlignment: CrossAxisAlignment.center,
99100
children: <Widget>[
100101

102+
GFList(
103+
// text: 'cfvgnh ghj gyuij gyuh tgyuji yugji fyuhji gyuji',
104+
//// text: 'bj nm',
105+
// icon: GFButton(onPressed: null, text: 'k', type: GFType.outline,),
106+
// showDivider: false,
107+
108+
),
109+
GFList(),GFList(),
101110

102111

103112

lib/components/list/gf_list.dart

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import 'package:flutter/material.dart';
2+
3+
class GFList extends StatefulWidget {
4+
5+
const GFList(
6+
{Key key,
7+
this.child,
8+
this.text = 'Lorem ipsum',
9+
this.icon = const Icon(Icons.keyboard_arrow_right),
10+
this.textStyle,
11+
this.showDivider= true
12+
13+
})
14+
: super(key: key);
15+
16+
final Widget child;
17+
18+
final String text;
19+
20+
final Widget icon;
21+
22+
final TextStyle textStyle;
23+
24+
final bool showDivider;
25+
26+
27+
@override
28+
_GFListState createState() => _GFListState();
29+
}
30+
31+
class _GFListState extends State<GFList> {
32+
@override
33+
Widget build(BuildContext context) {
34+
return Container(
35+
margin: EdgeInsets.only(left: 10),
36+
padding: EdgeInsets.only(right: 5, top: 10),
37+
child: Column(
38+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
39+
children: <Widget>[
40+
Row(
41+
children: <Widget>[
42+
Flexible(
43+
flex: 7,
44+
fit: FlexFit.tight,
45+
child: widget.text != null
46+
? Text(widget.text, style: widget.textStyle)
47+
: (widget.child ?? Container()),
48+
),
49+
SizedBox(
50+
width: 10,
51+
),
52+
widget.icon != null
53+
? Flexible(
54+
flex: 4,
55+
fit: FlexFit.tight,
56+
child: Align(
57+
alignment: Alignment.topRight,
58+
child: widget.icon,
59+
))
60+
: Container()
61+
],
62+
),
63+
widget.showDivider? Divider(): Container(),
64+
],
65+
)
66+
67+
);
68+
}
69+
}

lib/components/toast/gf_floating_widget.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ class _GFFloatingWidgetState extends State<GFFloatingWidget> {
3636
child: widget.body ?? Container(),
3737
),
3838
Positioned(
39-
top: widget.horizontalPosition != null
40-
? widget.horizontalPosition
41-
: 0,
39+
top: widget.horizontalPosition != null ? widget.horizontalPosition : 0,
4240
left: widget.verticalPosition != null ? widget.verticalPosition : 0,
4341
child: Container(
4442
width: MediaQuery.of(context).size.width,

lib/components/toast/gf_toast.dart

Lines changed: 40 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import 'dart:async';
22

3-
43
import 'package:flutter/material.dart';
54
import 'package:flutter/widgets.dart';
65
import 'package:ui_kit/colors/gf_color.dart';
@@ -51,75 +50,61 @@ class _GFToastState extends State<GFToast> with TickerProviderStateMixin {
5150
controller = AnimationController(
5251
duration: const Duration(milliseconds: 300), vsync: this);
5352
animation = CurvedAnimation(parent: controller, curve: Curves.easeIn);
54-
5553
_controller =
5654
AnimationController(vsync: this, duration: Duration(milliseconds: 200));
57-
5855
offset = Tween<Offset>(begin: Offset.zero, end: Offset(0.0, 1.0))
5956
.animate(_controller);
60-
61-
offset1 = Tween<Offset>(begin: Offset.zero, end: Offset(0.0, 0.1))
62-
.animate(_controller);
63-
64-
65-
66-
6757
controller.forward();
6858
_controller.forward();
6959
}
7060

71-
7261
@override
7362
void dispose() {
7463
controller.dispose();
7564
super.dispose();
7665
}
7766

78-
79-
80-
8167
@override
8268
Widget build(BuildContext context) {
83-
84-
return
85-
SlideTransition(
86-
position: offset,
87-
child: FadeTransition(opacity: animation, child:
88-
Container(
89-
constraints: BoxConstraints(minHeight: 50.0, minWidth: 340),
90-
margin: EdgeInsets.only(left: 10, right: 10),
91-
padding: EdgeInsets.all(10),
92-
decoration: BoxDecoration(
93-
borderRadius: BorderRadius.all(Radius.circular(3)),
94-
color: widget.backgroundColor != null
95-
? getGFColor(widget.backgroundColor)
96-
: Color(0xff323232),
97-
),
98-
child: Row(
99-
children: <Widget>[
100-
Flexible(
101-
flex: 7,
102-
fit: FlexFit.tight,
103-
child: widget.text != null
104-
? Text(widget.text, style: widget.textStyle)
105-
: (widget.child ?? Container()),
106-
),
107-
SizedBox(
108-
width: 10,
109-
),
110-
widget.button != null
111-
? Flexible(
112-
flex: 4,
113-
fit: FlexFit.tight,
114-
child: Align(
115-
alignment: Alignment.topRight,
116-
child: widget.button,
117-
))
118-
: Container()
119-
],
120-
),
121-
),),
122-
)
123-
;
69+
return SlideTransition(
70+
position: offset,
71+
child: FadeTransition(
72+
opacity: animation,
73+
child: Container(
74+
constraints: BoxConstraints(minHeight: 50.0, minWidth: 340),
75+
margin: EdgeInsets.only(left: 10, right: 10),
76+
padding: EdgeInsets.all(10),
77+
decoration: BoxDecoration(
78+
borderRadius: BorderRadius.all(Radius.circular(3)),
79+
color: widget.backgroundColor != null
80+
? getGFColor(widget.backgroundColor)
81+
: Color(0xff323232),
82+
),
83+
child: Row(
84+
children: <Widget>[
85+
Flexible(
86+
flex: 7,
87+
fit: FlexFit.tight,
88+
child: widget.text != null
89+
? Text(widget.text, style: widget.textStyle)
90+
: (widget.child ?? Container()),
91+
),
92+
SizedBox(
93+
width: 10,
94+
),
95+
widget.button != null
96+
? Flexible(
97+
flex: 4,
98+
fit: FlexFit.tight,
99+
child: Align(
100+
alignment: Alignment.topRight,
101+
child: widget.button,
102+
))
103+
: Container()
104+
],
105+
),
106+
),
107+
),
108+
);
124109
}
125110
}

0 commit comments

Comments
 (0)