diff --git a/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt b/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt new file mode 100644 index 00000000..1656503f --- /dev/null +++ b/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt @@ -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); + } +} diff --git a/example/lib/main.dart b/example/lib/main.dart index 7caed510..84b8e635 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -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'; @@ -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'; @@ -48,6 +50,7 @@ class MyApp extends StatelessWidget { title: 'UI_KIT_EXAMPLE', theme: ThemeData( primarySwatch: Colors.blue, + ), debugShowCheckedModeBanner: false, @@ -80,16 +83,70 @@ class _MyHomePageState extends State { title: Text(widget.title), ), - body: Column( + body: + + SingleChildScrollView( + child: Column( children: [ - 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), @@ -124,9 +181,33 @@ class _MyHomePageState extends State { ), ], ), + ), + + 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( diff --git a/lib/components/card/gf_card.dart b/lib/components/card/gf_card.dart index 93ca4e30..b46b59b3 100644 --- a/lib/components/card/gf_card.dart +++ b/lib/components/card/gf_card.dart @@ -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'; @@ -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; diff --git a/lib/components/header/gf_header.dart b/lib/components/header/gf_header.dart index e69de29b..1aadb06d 100644 --- a/lib/components/header/gf_header.dart +++ b/lib/components/header/gf_header.dart @@ -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: [ + Row( + children: [ + 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() + ], + )); + } +} diff --git a/lib/components/header_bar/gf_title_bar.dart b/lib/components/list_tile/gf_list_tile.dart similarity index 54% rename from lib/components/header_bar/gf_title_bar.dart rename to lib/components/list_tile/gf_list_tile.dart index 34791b54..900f352e 100644 --- a/lib/components/header_bar/gf_title_bar.dart +++ b/lib/components/list_tile/gf_list_tile.dart @@ -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, diff --git a/lib/components/toast/gf_toast.dart b/lib/components/toast/gf_toast.dart index b8656bb3..b3d0af01 100644 --- a/lib/components/toast/gf_toast.dart +++ b/lib/components/toast/gf_toast.dart @@ -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 @@ -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; @@ -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: [