Skip to content

Commit 9b4e946

Browse files
authored
Merge pull request #15 from shravyackm/listtile
Listtile
2 parents 47e426a + 71a9d8f commit 9b4e946

6 files changed

Lines changed: 227 additions & 28 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.example.example
2+
3+
import androidx.annotation.NonNull;
4+
import io.flutter.embedding.android.FlutterActivity
5+
import io.flutter.embedding.engine.FlutterEngine
6+
import io.flutter.plugins.GeneratedPluginRegistrant
7+
8+
class MainActivity: FlutterActivity() {
9+
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
10+
GeneratedPluginRegistrant.registerWith(flutterEngine);
11+
}
12+
}

example/lib/main.dart

Lines changed: 90 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import 'package:ui_kit/components/badge/gf_badge.dart';
1515

1616
import 'package:ui_kit/components/card/gf_card.dart';
1717

18-
import 'package:ui_kit/components/header_bar/gf_title_bar.dart';
18+
import 'package:ui_kit/components/list_tile/gf_list_tile.dart';
1919

2020
import 'package:ui_kit/components/image/gf_image_overlay.dart';
2121

@@ -29,6 +29,8 @@ import 'package:ui_kit/shape/gf_shape.dart';
2929
import 'package:ui_kit/components/toggle/gf_toggle.dart';
3030
import 'package:ui_kit/types/gf_toggle_type.dart';
3131
import 'package:flutter/cupertino.dart';
32+
import 'package:ui_kit/components/header/gf_header.dart';
33+
import 'package:ui_kit/position/gf_position.dart';
3234

3335
import 'package:ui_kit/components/toast/gf_toast.dart';
3436

@@ -48,6 +50,7 @@ class MyApp extends StatelessWidget {
4850
title: 'UI_KIT_EXAMPLE',
4951
theme: ThemeData(
5052
primarySwatch: Colors.blue,
53+
5154
),
5255
debugShowCheckedModeBanner: false,
5356

@@ -80,16 +83,70 @@ class _MyHomePageState extends State<MyHomePage> {
8083
title: Text(widget.title),
8184
),
8285

83-
body: Column(
86+
body:
87+
88+
SingleChildScrollView(
89+
child: Column(
8490
children: <Widget>[
85-
GFToast(
86-
bgColor: GFColor.warning,
87-
button: GFButton(
88-
onPressed: null,
89-
type: GFType.outline,
90-
text: 'Accept',
91+
92+
// GFCard(
93+
//// boxFit: BoxFit.cover,
94+
//// colorFilter: new ColorFilter.mode(
95+
//// Colors.black.withOpacity(0.67), BlendMode.darken),
96+
// image: Image.asset("lib/assets/food.jpeg"),
97+
//// imageOverlay: AssetImage("lib/assets/food.jpeg"),
98+
// titlePosition: GFPosition.end,
99+
// title: GFListItem(
100+
// avatar: GFAvatar(
101+
// child: Text("tb"),
102+
// ),
103+
// title: Text(
104+
// 'title',
105+
// style: TextStyle(color: Colors.grey),
106+
// ),
107+
// subTitle: Text(
108+
// 'subtitle',
109+
// style: TextStyle(color: Colors.grey),
110+
// ),
111+
// icon: GFIconButton(
112+
// onPressed: null,
113+
// icon: Icon(Icons.favorite_border),
114+
// type: GFType.transparent,
115+
// ),
116+
// ),
117+
// ),
118+
119+
//
120+
// GFCard(
121+
// title: GFListItem(
122+
// title: Text('dcrfvjn'),
123+
// subTitle: Text('fghjk'),
124+
//
125+
// ),
126+
//
127+
// ),
128+
129+
GFListTile(
130+
avatar: GFAvatar(),
131+
132+
icon: Icon(Icons.description),
133+
title: Text('Header'),
134+
subTitle: Text('Sub Header'),
135+
description: Text('Lorem ipsum gf header used to show the header of the list tile'),
136+
),
137+
Container(
138+
margin: EdgeInsets.only(top:10),
139+
child: GFToast(
140+
//
141+
//
142+
//
143+
// button: GFButton(
144+
// onPressed: null,
145+
// type: GFType.outline,
146+
// text: 'Accept',
147+
// ),
148+
text: 'Marked as Favorite.',
91149
),
92-
text: 'Marked as Favorite.',
93150
),
94151
Container(
95152
margin: EdgeInsets.only(left: 10, right: 10, top: 10, bottom: 10),
@@ -124,9 +181,33 @@ class _MyHomePageState extends State<MyHomePage> {
124181
),
125182
],
126183
),
184+
),
185+
186+
Container(
187+
// padding: EdgeInsets.only(left: 20, right: 20),
188+
child: GFHeader(
189+
// icon: Icon(Icons.image, color: Colors.white,),
190+
text: 'GET FLUTTER HEADER',
191+
//textColor: Colors.red,
192+
dividerWidth: 20,
193+
//backgroundImage: NetworkImage('https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg'),
194+
//showDivider: false,
195+
196+
// textColor: Colors.black,
197+
// dividerColor: Colors.red,
198+
//dividerAlignment: Alignment.center,
199+
200+
201+
202+
// child: Text('GF HEADER ', ),
203+
// dividercolor: GFColor.warning,
204+
// dividerBorderRadius: BorderRadius.all(Radius.circular(0)),
205+
),
127206
)
207+
128208
],
129209
),
210+
)
130211
// body: DefaultTabController(
131212
// length: 3,
132213
// child: Scaffold(

lib/components/card/gf_card.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'package:flutter/cupertino.dart';
22
import 'package:flutter/material.dart';
33
import 'package:ui_kit/components/button_bar/gf_button_bar.dart';
4-
import 'package:ui_kit/components/header_bar/gf_title_bar.dart';
4+
import 'package:ui_kit/components/list_item/gf_list_item.dart';
55
import 'package:ui_kit/components/image/gf_image_overlay.dart';
66
import 'package:ui_kit/position/gf_position.dart';
77

@@ -62,7 +62,7 @@ class GFCard extends StatelessWidget {
6262
final bool semanticContainer;
6363

6464
/// The title to display inside the [GFTitleBar]. see [GFTitleBar]
65-
final GFTitleBar title;
65+
final GFListItem title;
6666

6767
/// widget can be used to define content
6868
final Widget content;
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:ui_kit/colors/gf_color.dart';
3+
4+
class GFHeader extends StatelessWidget {
5+
const GFHeader(
6+
{Key key,
7+
this.child,
8+
this.text,
9+
this.icon,
10+
this.dividerBorderRadius,
11+
this.textColor,
12+
this.dividerAlignment,
13+
this.dividerColor,
14+
this.showDivider = true,
15+
this.dividerWidth,
16+
this.backgroundImage,
17+
this.backgroundImagecolorFilter})
18+
: super(key: key);
19+
20+
21+
/// child of type [Widget] is alternative to text key. text will get priority over child
22+
final Widget child;
23+
24+
/// text of type [String] is alternative to child. text will get priority over child
25+
final String text;
26+
27+
///icon of type [Widget] used to pass icon or image
28+
final Widget icon;
29+
30+
/// Pass [GFColor] or [Color] for dividerColor
31+
final dynamic dividerColor;
32+
33+
/// Pass [GFColor] or [Color] for textColor
34+
final dynamic textColor;
35+
36+
/// dividerBorderRadius of type [BorderRadius] to alter the radius of the divider
37+
final BorderRadius dividerBorderRadius;
38+
39+
///dividerAlignment of type [Alignment] used for aligning the divider to required alignment
40+
final Alignment dividerAlignment;
41+
42+
///Pass [bool] value to show or hide the divider
43+
final bool showDivider;
44+
45+
///pass [double] type to increase or decrease the width of the divider
46+
final double dividerWidth;
47+
48+
///backgroundImage of type [ImageProvider] to set the background of [GFHeader]
49+
final ImageProvider backgroundImage;
50+
51+
///backgroundImagecolorFilter of type [ColorFilter] to set the background color of [GFHeader] only when backgroundImage is available
52+
final ColorFilter backgroundImagecolorFilter;
53+
54+
@override
55+
Widget build(BuildContext context) {
56+
return Container(
57+
padding: EdgeInsets.all(backgroundImage != null ? 10 : 0),
58+
decoration: BoxDecoration(
59+
image: backgroundImage != null
60+
? DecorationImage(
61+
image: backgroundImage,
62+
fit: BoxFit.cover,
63+
colorFilter: backgroundImagecolorFilter ??
64+
ColorFilter.mode(Colors.black54, BlendMode.darken),
65+
)
66+
: null,
67+
),
68+
child: Column(
69+
crossAxisAlignment: CrossAxisAlignment.start,
70+
children: <Widget>[
71+
Row(
72+
children: <Widget>[
73+
icon != null ? icon : Container(),
74+
icon != null
75+
? Padding(padding: EdgeInsets.only(left: 10))
76+
: Container(),
77+
text != null
78+
? Text(
79+
text,
80+
style: TextStyle(
81+
color: textColor != null
82+
? getGFColor(textColor)
83+
: backgroundImage != null
84+
? Colors.white
85+
: Colors.black,
86+
fontSize: 16,
87+
letterSpacing: 0.3,
88+
fontWeight: FontWeight.w500),
89+
)
90+
: child
91+
],
92+
),
93+
showDivider
94+
? Container(
95+
margin: EdgeInsets.only(top: 5, bottom: 5),
96+
alignment: dividerAlignment,
97+
child: Container(
98+
width: dividerWidth != null ? dividerWidth : 70,
99+
height: 4,
100+
decoration: BoxDecoration(
101+
color: dividerColor != null
102+
? getGFColor(dividerColor)
103+
: backgroundImage != null
104+
? Colors.white
105+
: Colors.black,
106+
borderRadius: dividerBorderRadius != null
107+
? dividerBorderRadius
108+
: BorderRadius.all(Radius.circular(5))),
109+
))
110+
: Container()
111+
],
112+
));
113+
}
114+
}

lib/components/header_bar/gf_title_bar.dart renamed to lib/components/list_tile/gf_list_tile.dart

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,25 @@ import 'package:flutter/cupertino.dart';
22
import 'package:flutter/material.dart';
33
import 'package:ui_kit/components/avatar/gf_avatar.dart';
44

5-
class GFTitleBar extends StatelessWidget {
5+
class GFListItem extends StatelessWidget {
66
/// The card's background color.
77
final Color color;
88

9-
/// The empty space that surrounds the card. Defines the card's outer [Container.margin].
10-
final EdgeInsetsGeometry margin;
11-
12-
/// The empty space that surrounds the card. Defines the card's outer [Container.padding].
13-
final EdgeInsetsGeometry padding;
14-
159
/// [GFAvatar] used to create rounded user profile
1610
final GFAvatar avatar;
1711

18-
/// The title to display inside the [GFTitleBar]. see [Text]
12+
/// The title to display inside the [GFListItem]. see [Text]
1913
final Widget title;
2014

21-
/// The subTitle to display inside the [GFTitleBar]. see [Text]
15+
/// The subTitle to display inside the [GFListItem]. see [Text]
2216
final Widget subTitle;
2317

24-
/// The icon to display inside the [GFTitleBar]. see [Icon]
18+
/// The icon to display inside the [GFListItem]. see [Icon]
2519
final Widget icon;
2620

27-
const GFTitleBar(
21+
const GFListItem(
2822
{Key key,
2923
this.color,
30-
this.padding,
31-
this.margin,
3224
this.avatar,
3325
this.title,
3426
this.subTitle,

lib/components/toast/gf_toast.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ class GFToast extends StatelessWidget {
77
GFToast({Key key,
88
this.child,
99
this.button,
10-
this.bgColor,
10+
this.backgroundColor,
1111
this.text,
12-
this.textStyle = const TextStyle(color: Colors.white70, height: 1.5),
12+
this.textStyle = const TextStyle(color: Colors.white70),
1313
}) :super(key: key);
1414

1515
/// child of type [Widget]is alternative to text key. text will get priority over child
@@ -19,7 +19,7 @@ class GFToast extends StatelessWidget {
1919
final Widget button;
2020

2121
///pass color of type [Color] or [GFColor] for background of [GFToast]
22-
final dynamic bgColor;
22+
final dynamic backgroundColor;
2323

2424
/// text of type [String] is alternative to child. text will get priority over child
2525
final String text;
@@ -36,7 +36,7 @@ class GFToast extends StatelessWidget {
3636
padding: EdgeInsets.all(10),
3737
decoration: BoxDecoration(
3838
borderRadius: BorderRadius.all(Radius.circular(3)),
39-
color: bgColor!=null ?getGFColor(bgColor):Color(0xff323232),
39+
color: backgroundColor!=null ?getGFColor(backgroundColor):Color(0xff323232),
4040
),
4141
child: Row(
4242
children: <Widget>[

0 commit comments

Comments
 (0)