Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.example.example

import androidx.annotation.NonNull;
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugins.GeneratedPluginRegistrant

class MainActivity: FlutterActivity() {
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine);
}
}
99 changes: 90 additions & 9 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import 'package:ui_kit/components/badge/gf_badge.dart';

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

import 'package:ui_kit/components/header_bar/gf_title_bar.dart';
import 'package:ui_kit/components/list_tile/gf_list_tile.dart';

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

Expand All @@ -29,6 +29,8 @@ import 'package:ui_kit/shape/gf_shape.dart';
import 'package:ui_kit/components/toggle/gf_toggle.dart';
import 'package:ui_kit/types/gf_toggle_type.dart';
import 'package:flutter/cupertino.dart';
import 'package:ui_kit/components/header/gf_header.dart';
import 'package:ui_kit/position/gf_position.dart';

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

Expand All @@ -48,6 +50,7 @@ class MyApp extends StatelessWidget {
title: 'UI_KIT_EXAMPLE',
theme: ThemeData(
primarySwatch: Colors.blue,

),
debugShowCheckedModeBanner: false,

Expand Down Expand Up @@ -80,16 +83,70 @@ class _MyHomePageState extends State<MyHomePage> {
title: Text(widget.title),
),

body: Column(
body:

SingleChildScrollView(
child: Column(
children: <Widget>[
GFToast(
bgColor: GFColor.warning,
button: GFButton(
onPressed: null,
type: GFType.outline,
text: 'Accept',

// GFCard(
//// boxFit: BoxFit.cover,
//// colorFilter: new ColorFilter.mode(
//// Colors.black.withOpacity(0.67), BlendMode.darken),
// image: Image.asset("lib/assets/food.jpeg"),
//// imageOverlay: AssetImage("lib/assets/food.jpeg"),
// titlePosition: GFPosition.end,
// title: GFListItem(
// avatar: GFAvatar(
// child: Text("tb"),
// ),
// title: Text(
// 'title',
// style: TextStyle(color: Colors.grey),
// ),
// subTitle: Text(
// 'subtitle',
// style: TextStyle(color: Colors.grey),
// ),
// icon: GFIconButton(
// onPressed: null,
// icon: Icon(Icons.favorite_border),
// type: GFType.transparent,
// ),
// ),
// ),

//
// GFCard(
// title: GFListItem(
// title: Text('dcrfvjn'),
// subTitle: Text('fghjk'),
//
// ),
//
// ),

GFListTile(
avatar: GFAvatar(),

icon: Icon(Icons.description),
title: Text('Header'),
subTitle: Text('Sub Header'),
description: Text('Lorem ipsum gf header used to show the header of the list tile'),
),
Container(
margin: EdgeInsets.only(top:10),
child: GFToast(
//
//
//
// button: GFButton(
// onPressed: null,
// type: GFType.outline,
// text: 'Accept',
// ),
text: 'Marked as Favorite.',
),
text: 'Marked as Favorite.',
),
Container(
margin: EdgeInsets.only(left: 10, right: 10, top: 10, bottom: 10),
Expand Down Expand Up @@ -124,9 +181,33 @@ class _MyHomePageState extends State<MyHomePage> {
),
],
),
),

Container(
// padding: EdgeInsets.only(left: 20, right: 20),
child: GFHeader(
// icon: Icon(Icons.image, color: Colors.white,),
text: 'GET FLUTTER HEADER',
//textColor: Colors.red,
dividerWidth: 20,
//backgroundImage: NetworkImage('https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg'),
//showDivider: false,

// textColor: Colors.black,
// dividerColor: Colors.red,
//dividerAlignment: Alignment.center,



// child: Text('GF HEADER ', ),
// dividercolor: GFColor.warning,
// dividerBorderRadius: BorderRadius.all(Radius.circular(0)),
),
)

],
),
)
// body: DefaultTabController(
// length: 3,
// child: Scaffold(
Expand Down
4 changes: 2 additions & 2 deletions lib/components/card/gf_card.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:ui_kit/components/button_bar/gf_button_bar.dart';
import 'package:ui_kit/components/header_bar/gf_title_bar.dart';
import 'package:ui_kit/components/list_item/gf_list_item.dart';
import 'package:ui_kit/components/image/gf_image_overlay.dart';
import 'package:ui_kit/position/gf_position.dart';

Expand Down Expand Up @@ -62,7 +62,7 @@ class GFCard extends StatelessWidget {
final bool semanticContainer;

/// The title to display inside the [GFTitleBar]. see [GFTitleBar]
final GFTitleBar title;
final GFListItem title;

/// widget can be used to define content
final Widget content;
Expand Down
114 changes: 114 additions & 0 deletions lib/components/header/gf_header.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import 'package:flutter/material.dart';
import 'package:ui_kit/colors/gf_color.dart';

class GFHeader extends StatelessWidget {
const GFHeader(
{Key key,
this.child,
this.text,
this.icon,
this.dividerBorderRadius,
this.textColor,
this.dividerAlignment,
this.dividerColor,
this.showDivider = true,
this.dividerWidth,
this.backgroundImage,
this.backgroundImagecolorFilter})
: super(key: key);


/// child of type [Widget] is alternative to text key. text will get priority over child
final Widget child;

/// text of type [String] is alternative to child. text will get priority over child
final String text;

///icon of type [Widget] used to pass icon or image
final Widget icon;

/// Pass [GFColor] or [Color] for dividerColor
final dynamic dividerColor;

/// Pass [GFColor] or [Color] for textColor
final dynamic textColor;

/// dividerBorderRadius of type [BorderRadius] to alter the radius of the divider
final BorderRadius dividerBorderRadius;

///dividerAlignment of type [Alignment] used for aligning the divider to required alignment
final Alignment dividerAlignment;

///Pass [bool] value to show or hide the divider
final bool showDivider;

///pass [double] type to increase or decrease the width of the divider
final double dividerWidth;

///backgroundImage of type [ImageProvider] to set the background of [GFHeader]
final ImageProvider backgroundImage;

///backgroundImagecolorFilter of type [ColorFilter] to set the background color of [GFHeader] only when backgroundImage is available
final ColorFilter backgroundImagecolorFilter;

@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.all(backgroundImage != null ? 10 : 0),
decoration: BoxDecoration(
image: backgroundImage != null
? DecorationImage(
image: backgroundImage,
fit: BoxFit.cover,
colorFilter: backgroundImagecolorFilter ??
ColorFilter.mode(Colors.black54, BlendMode.darken),
)
: null,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
icon != null ? icon : Container(),
icon != null
? Padding(padding: EdgeInsets.only(left: 10))
: Container(),
text != null
? Text(
text,
style: TextStyle(
color: textColor != null
? getGFColor(textColor)
: backgroundImage != null
? Colors.white
: Colors.black,
fontSize: 16,
letterSpacing: 0.3,
fontWeight: FontWeight.w500),
)
: child
],
),
showDivider
? Container(
margin: EdgeInsets.only(top: 5, bottom: 5),
alignment: dividerAlignment,
child: Container(
width: dividerWidth != null ? dividerWidth : 70,
height: 4,
decoration: BoxDecoration(
color: dividerColor != null
? getGFColor(dividerColor)
: backgroundImage != null
? Colors.white
: Colors.black,
borderRadius: dividerBorderRadius != null
? dividerBorderRadius
: BorderRadius.all(Radius.circular(5))),
))
: Container()
],
));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,25 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:ui_kit/components/avatar/gf_avatar.dart';

class GFTitleBar extends StatelessWidget {
class GFListItem extends StatelessWidget {
/// The card's background color.
final Color color;

/// The empty space that surrounds the card. Defines the card's outer [Container.margin].
final EdgeInsetsGeometry margin;

/// The empty space that surrounds the card. Defines the card's outer [Container.padding].
final EdgeInsetsGeometry padding;

/// [GFAvatar] used to create rounded user profile
final GFAvatar avatar;

/// The title to display inside the [GFTitleBar]. see [Text]
/// The title to display inside the [GFListItem]. see [Text]
final Widget title;

/// The subTitle to display inside the [GFTitleBar]. see [Text]
/// The subTitle to display inside the [GFListItem]. see [Text]
final Widget subTitle;

/// The icon to display inside the [GFTitleBar]. see [Icon]
/// The icon to display inside the [GFListItem]. see [Icon]
final Widget icon;

const GFTitleBar(
const GFListItem(
{Key key,
this.color,
this.padding,
this.margin,
this.avatar,
this.title,
this.subTitle,
Expand Down
8 changes: 4 additions & 4 deletions lib/components/toast/gf_toast.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ class GFToast extends StatelessWidget {
GFToast({Key key,
this.child,
this.button,
this.bgColor,
this.backgroundColor,
this.text,
this.textStyle = const TextStyle(color: Colors.white70, height: 1.5),
this.textStyle = const TextStyle(color: Colors.white70),
}) :super(key: key);

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

///pass color of type [Color] or [GFColor] for background of [GFToast]
final dynamic bgColor;
final dynamic backgroundColor;

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