diff --git a/demo_app/lib/screens/avatars.dart b/demo_app/lib/screens/avatars.dart index 6b9ac2ad..fecf6873 100644 --- a/demo_app/lib/screens/avatars.dart +++ b/demo_app/lib/screens/avatars.dart @@ -2,9 +2,9 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:ui_kit/components/avatar/gf_avatar.dart'; import 'package:ui_kit/components/card/gf_card.dart'; -import 'package:ui_kit/components/header/gf_header.dart'; +import 'package:ui_kit/components/typography/gf_typography.dart'; import 'package:ui_kit/shape/gf_avatar_shape.dart'; -import 'package:ui_kit/types/gf_heading_type.dart'; +import 'package:ui_kit/types/gf_typography_type.dart'; import 'package:ui_kit/colors/gf_color.dart'; class Avatars extends StatefulWidget { @@ -27,9 +27,9 @@ class _AvatarsState extends State { content: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - GFHeader( + GFTypography( text: 'Circle Avatar', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ), SizedBox( height: 10, @@ -109,9 +109,9 @@ class _AvatarsState extends State { content: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - GFHeader( + GFTypography( text: 'Square Avatar', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ), SizedBox( height: 10, @@ -200,9 +200,9 @@ class _AvatarsState extends State { content: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - GFHeader( + GFTypography( text: 'Standard Avatar', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ), SizedBox( height: 10, diff --git a/demo_app/lib/screens/badges.dart b/demo_app/lib/screens/badges.dart index c355f07b..dfdc20c4 100644 --- a/demo_app/lib/screens/badges.dart +++ b/demo_app/lib/screens/badges.dart @@ -4,14 +4,14 @@ import 'package:ui_kit/components/badge/gf_badge.dart'; import 'package:ui_kit/components/badge/gf_button_badge.dart'; import 'package:ui_kit/components/badge/gf_icon_badge.dart'; import 'package:ui_kit/components/card/gf_card.dart'; -import 'package:ui_kit/components/header/gf_header.dart'; +import 'package:ui_kit/components/typography/gf_typography.dart'; import 'package:ui_kit/components/tabs/gf_tabs.dart'; import 'package:ui_kit/components/button/gf_icon_button.dart'; import 'package:ui_kit/position/gf_position.dart'; import 'package:ui_kit/shape/gf_badge_shape.dart'; import 'package:ui_kit/shape/gf_button_shape.dart'; import 'package:ui_kit/size/gf_size.dart'; -import 'package:ui_kit/types/gf_heading_type.dart'; +import 'package:ui_kit/types/gf_typography_type.dart'; import 'package:ui_kit/types/gf_type.dart'; import 'package:ui_kit/components/tabs/gf_tabBarView.dart'; @@ -51,9 +51,9 @@ class _BadgesState extends State { GFCard( content: Column( children: [ - GFHeader( + GFTypography( text: 'Types of Badges', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ), SizedBox( height: 10, @@ -90,9 +90,9 @@ class _BadgesState extends State { GFCard( content: Column( children: [ - GFHeader( + GFTypography( text: 'Circled Badges with different Sizes', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ), SizedBox( height: 10, @@ -126,9 +126,9 @@ class _BadgesState extends State { GFCard( content: Column( children: [ - GFHeader( + GFTypography( text: 'Squared Badges with different sizes', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ), SizedBox( height: 10, @@ -162,9 +162,9 @@ class _BadgesState extends State { GFCard( content: Column( children: [ - GFHeader( + GFTypography( text: 'Pills with different sizes', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ), SizedBox( height: 10, @@ -201,9 +201,9 @@ class _BadgesState extends State { GFCard( content: Column( children: [ - GFHeader( + GFTypography( text: 'Standard Badges with different sizes', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ), SizedBox( height: 10, @@ -241,9 +241,9 @@ class _BadgesState extends State { GFCard( content: Column( children: [ - GFHeader( + GFTypography( text: 'Types of Button Badges', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ), SizedBox( height: 10, @@ -255,7 +255,7 @@ class _BadgesState extends State { shape: GFButtonShape.pills, type: GFType.solid, color: GFColor.info, - counterChild: GFBadge( + icon: GFBadge( text: '12', color: GFColor.warning, shape: GFBadgeShape.circle, @@ -268,7 +268,7 @@ class _BadgesState extends State { shape: GFButtonShape.square, type: GFType.solid, color: GFColor.warning, - counterChild: GFBadge( + icon: GFBadge( text: '12', shape: GFBadgeShape.circle, color: GFColor.info, @@ -280,7 +280,7 @@ class _BadgesState extends State { color: GFColor.success, shape: GFButtonShape.standard, type: GFType.solid, - counterChild: GFBadge( + icon: GFBadge( text: '12', textColor: GFColor.white, color: GFColor.danger, @@ -297,9 +297,9 @@ class _BadgesState extends State { GFCard( content: Column( children: [ - GFHeader( + GFTypography( text: 'Positions of Button Badges', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ), SizedBox( height: 10, @@ -311,7 +311,7 @@ class _BadgesState extends State { shape: GFButtonShape.pills, type: GFType.solid, color: GFColor.info, - counterChild: GFBadge( + icon: GFBadge( text: '12', color: GFColor.warning, shape: GFBadgeShape.circle, @@ -324,7 +324,7 @@ class _BadgesState extends State { shape: GFButtonShape.square, type: GFType.solid, color: GFColor.warning, - counterChild: GFBadge( + icon: GFBadge( text: '12', shape: GFBadgeShape.circle, color: GFColor.info, @@ -337,7 +337,7 @@ class _BadgesState extends State { color: GFColor.success, shape: GFButtonShape.standard, type: GFType.solid, - counterChild: GFBadge( + icon: GFBadge( text: '12', textColor: GFColor.white, color: GFColor.danger, @@ -355,9 +355,9 @@ class _BadgesState extends State { GFCard( content: Column( children: [ - GFHeader( + GFTypography( text: 'Pilled shape Button Badges with sizes', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ), SizedBox( height: 10, @@ -370,7 +370,7 @@ class _BadgesState extends State { size: GFSize.large, type: GFType.solid, color: GFColor.info, - counterChild: GFBadge( + icon: GFBadge( text: '12', color: GFColor.warning, size: GFSize.large, @@ -385,7 +385,7 @@ class _BadgesState extends State { size: GFSize.medium, type: GFType.outline, color: GFColor.info, - counterChild: GFBadge( + icon: GFBadge( text: '12', color: GFColor.warning, size: GFSize.medium, @@ -400,7 +400,7 @@ class _BadgesState extends State { size: GFSize.small, type: GFType.transparent, color: GFColor.info, - counterChild: GFBadge( + icon: GFBadge( text: '12', color: GFColor.warning, size: GFSize.small, @@ -418,9 +418,9 @@ class _BadgesState extends State { GFCard( content: Column( children: [ - GFHeader( + GFTypography( text: 'Squared shape Button Badges with sizes', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ), SizedBox( height: 10, @@ -433,7 +433,7 @@ class _BadgesState extends State { size: GFSize.large, type: GFType.solid, color: GFColor.warning, - counterChild: GFBadge( + icon: GFBadge( text: '12', color: GFColor.info, size: GFSize.large, @@ -448,7 +448,7 @@ class _BadgesState extends State { size: GFSize.medium, type: GFType.outline, color: GFColor.warning, - counterChild: GFBadge( + icon: GFBadge( text: '12', color: GFColor.info, size: GFSize.medium, @@ -463,7 +463,7 @@ class _BadgesState extends State { size: GFSize.small, type: GFType.transparent, color: GFColor.warning, - counterChild: GFBadge( + icon: GFBadge( text: '12', color: GFColor.info, size: GFSize.small, @@ -481,9 +481,9 @@ class _BadgesState extends State { GFCard( content: Column( children: [ - GFHeader( + GFTypography( text: 'Standard Button Badges with sizes', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ), SizedBox( height: 10, @@ -496,7 +496,7 @@ class _BadgesState extends State { size: GFSize.large, type: GFType.solid, color: GFColor.primary, - counterChild: GFBadge( + icon: GFBadge( text: '12', color: GFColor.danger, size: GFSize.large, @@ -512,7 +512,7 @@ class _BadgesState extends State { size: GFSize.medium, type: GFType.outline, color: GFColor.primary, - counterChild: GFBadge( + icon: GFBadge( text: '12', color: GFColor.danger, textColor: GFColor.white, @@ -528,7 +528,7 @@ class _BadgesState extends State { size: GFSize.small, type: GFType.transparent, color: GFColor.primary, - counterChild: GFBadge( + icon: GFBadge( text: '12', color: GFColor.danger, textColor: GFColor.white, @@ -551,9 +551,9 @@ class _BadgesState extends State { GFCard( content: Column( children: [ - GFHeader( + GFTypography( text: 'Types of Icon Badges', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ), SizedBox( height: 10, @@ -625,9 +625,9 @@ class _BadgesState extends State { GFCard( content: Column( children: [ - GFHeader( + GFTypography( text: 'Shapes of Icon Badges', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ), SizedBox( height: 10, @@ -693,9 +693,9 @@ class _BadgesState extends State { GFCard( content: Column( children: [ - GFHeader( + GFTypography( text: 'Sizes of Icon Badges', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ), SizedBox( height: 10, diff --git a/demo_app/lib/screens/buttons.dart b/demo_app/lib/screens/buttons.dart index 0a7055e3..851a7fa2 100644 --- a/demo_app/lib/screens/buttons.dart +++ b/demo_app/lib/screens/buttons.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; -import 'package:ui_kit/components/header/gf_header.dart'; +import 'package:ui_kit/components/typography/gf_typography.dart'; import 'package:ui_kit/components/tabs/gf_tabs.dart'; import 'package:ui_kit/components/button/gf_button.dart'; -import 'package:ui_kit/types/gf_heading_type.dart'; +import 'package:ui_kit/types/gf_typography_type.dart'; import 'package:ui_kit/types/gf_type.dart'; import 'package:ui_kit/shape/gf_button_shape.dart'; import 'package:ui_kit/colors/gf_color.dart'; @@ -70,9 +70,9 @@ class _ButtonsState extends State { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - GFHeader( + GFTypography( text: 'Standard', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ), SizedBox( height: 10, @@ -187,9 +187,9 @@ class _ButtonsState extends State { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - GFHeader( + GFTypography( text: 'Pills', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ), SizedBox( height: 10, @@ -304,9 +304,9 @@ class _ButtonsState extends State { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - GFHeader( + GFTypography( text: 'Square', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ), SizedBox( height: 10, @@ -428,9 +428,9 @@ class _ButtonsState extends State { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - GFHeader( + GFTypography( text: 'Standard', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ), SizedBox( height: 10, @@ -527,9 +527,9 @@ class _ButtonsState extends State { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - GFHeader( + GFTypography( text: 'Pills', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ), SizedBox( height: 10, @@ -638,9 +638,9 @@ class _ButtonsState extends State { mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - GFHeader( + GFTypography( text: 'Square', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ), SizedBox( height: 10, @@ -752,9 +752,9 @@ class _ButtonsState extends State { height: 100, child: Column( children: [ - GFHeader( + GFTypography( text: 'Transparent', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ), Row( children: [ diff --git a/demo_app/lib/screens/cards.dart b/demo_app/lib/screens/cards.dart index 48d6f439..edc00409 100644 --- a/demo_app/lib/screens/cards.dart +++ b/demo_app/lib/screens/cards.dart @@ -1,13 +1,13 @@ import 'package:flutter/material.dart'; import 'package:ui_kit/components/card/gf_card.dart'; -import 'package:ui_kit/components/header/gf_header.dart'; +import 'package:ui_kit/components/typography/gf_typography.dart'; import 'package:ui_kit/components/list_tile/gf_list_tile.dart'; import 'package:ui_kit/components/avatar/gf_avatar.dart'; import 'package:ui_kit/position/gf_position.dart'; import 'package:ui_kit/components/button/gf_icon_button.dart'; import 'package:ui_kit/components/button/gf_button_bar.dart'; import 'package:ui_kit/components/button/gf_button.dart'; -import 'package:ui_kit/types/gf_heading_type.dart'; +import 'package:ui_kit/types/gf_typography_type.dart'; import 'package:ui_kit/types/gf_type.dart'; import 'package:ui_kit/colors/gf_color.dart'; class Cards extends StatefulWidget { @@ -26,9 +26,9 @@ class _CardsState extends State { body: ListView( children: [ Padding(padding: EdgeInsets.all(20), child: - GFHeader( + GFTypography( text: 'Basic Card', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ),), GFCard( boxFit: BoxFit.cover, @@ -61,9 +61,9 @@ class _CardsState extends State { ), Padding(padding: EdgeInsets.all(20), child: - GFHeader( + GFTypography( text: 'Basic Card 1', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ),), GFCard( boxFit: BoxFit.cover, @@ -101,9 +101,9 @@ class _CardsState extends State { ), Padding(padding: EdgeInsets.all(20), child: - GFHeader( + GFTypography( text: 'Basic Card 2', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ),), GFCard( boxFit: BoxFit.cover, @@ -157,9 +157,9 @@ class _CardsState extends State { ), Padding(padding: EdgeInsets.all(20), child: - GFHeader( + GFTypography( text: 'Basic Card 3', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ),), GFCard( boxFit: BoxFit.cover, @@ -214,9 +214,9 @@ class _CardsState extends State { ), ), Padding(padding: EdgeInsets.all(20), child: - GFHeader( + GFTypography( text: 'Basic Card 4', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ),), GFCard( @@ -263,9 +263,9 @@ class _CardsState extends State { ), Padding(padding: EdgeInsets.all(20), child: - GFHeader( + GFTypography( text: 'Basic Card 5', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ),), GFCard( boxFit: BoxFit.cover, diff --git a/demo_app/lib/screens/headers.dart b/demo_app/lib/screens/headers.dart index 20517021..2f1db46f 100644 --- a/demo_app/lib/screens/headers.dart +++ b/demo_app/lib/screens/headers.dart @@ -2,8 +2,8 @@ import 'package:flutter/material.dart'; import 'package:ui_kit/colors/gf_color.dart'; import 'package:ui_kit/components/avatar/gf_avatar.dart'; import 'package:ui_kit/components/card/gf_card.dart'; -import 'package:ui_kit/components/header/gf_header.dart'; -import 'package:ui_kit/types/gf_heading_type.dart'; +import 'package:ui_kit/components/typography/gf_typography.dart'; +import 'package:ui_kit/types/gf_typography_type.dart'; class Headers extends StatefulWidget { @override @@ -31,29 +31,29 @@ class _HeadersState extends State { crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - GFHeader( + GFTypography( text: 'GF Header Typo1', - type: GFHeadingType.typo1, + type: GFTypographyType.typo1, backgroundImage: NetworkImage( 'https://cdn.pixabay.com/photo/2019/12/25/16/49/happy-new-year-4718894_960_720.png'), ), SizedBox( height: 40, ), - GFHeader( + GFTypography( icon: GFAvatar(), text: 'GF Header Typo2', - type: GFHeadingType.typo2, + type: GFTypographyType.typo2, dividerColor: GFColor.primary, dividerAlignment: Alignment.center, ), SizedBox( height: 40, ), - GFHeader( + GFTypography( icon: Icon(Icons.insert_emoticon), text: 'GF Header Typo3', - type: GFHeadingType.typo3, + type: GFTypographyType.typo3, dividerWidth: 150, dividerColor: GFColor.warning, dividerBorderRadius: BorderRadius.all(Radius.circular(0)), @@ -61,9 +61,9 @@ class _HeadersState extends State { SizedBox( height: 40, ), - GFHeader( + GFTypography( text: 'GF Header Typo4', - type: GFHeadingType.typo4, + type: GFTypographyType.typo4, dividerWidth: 345, icon: Image.network( 'https://cdn.pixabay.com/photo/2016/12/15/03/27/cocoa-1908020_960_720.jpg', @@ -72,17 +72,17 @@ class _HeadersState extends State { SizedBox( height: 40, ), - GFHeader( + GFTypography( text: 'GF Header Typo5', - type: GFHeadingType.typo5, + type: GFTypographyType.typo5, dividerColor: GFColor.alt, ), SizedBox( height: 40, ), - GFHeader( + GFTypography( text: 'GF Header Typo6', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, dividerWidth: 20, ), ], diff --git a/demo_app/lib/screens/icon-button.dart b/demo_app/lib/screens/icon-button.dart index 0266d586..4a7d8738 100644 --- a/demo_app/lib/screens/icon-button.dart +++ b/demo_app/lib/screens/icon-button.dart @@ -2,8 +2,8 @@ import 'package:flutter/material.dart'; import 'package:ui_kit/colors/gf_color.dart'; import 'package:ui_kit/components/button/gf_icon_button.dart'; import 'package:ui_kit/components/card/gf_card.dart'; -import 'package:ui_kit/components/header/gf_header.dart'; -import 'package:ui_kit/types/gf_heading_type.dart'; +import 'package:ui_kit/components/typography/gf_typography.dart'; +import 'package:ui_kit/types/gf_typography_type.dart'; import 'package:ui_kit/types/gf_type.dart'; import 'package:ui_kit/size/gf_size.dart'; @@ -28,9 +28,9 @@ class _IconButtonsState extends State { GFCard( content: Column( children: [ - GFHeader( + GFTypography( text: 'Solid Icon Button', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ), SizedBox( height: 15.0, @@ -100,9 +100,9 @@ class _IconButtonsState extends State { GFCard( content: Column( children: [ - GFHeader( + GFTypography( text: 'Outline Icon Button', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ), SizedBox( height: 15.0, @@ -168,9 +168,9 @@ class _IconButtonsState extends State { GFCard( content: Column( children: [ - GFHeader( + GFTypography( text: 'Transparent Icon Button', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ), SizedBox( height: 15.0, diff --git a/demo_app/lib/screens/list-tiles.dart b/demo_app/lib/screens/list-tiles.dart index bec715a6..32249344 100644 --- a/demo_app/lib/screens/list-tiles.dart +++ b/demo_app/lib/screens/list-tiles.dart @@ -3,10 +3,10 @@ import 'package:ui_kit/colors/gf_color.dart'; import 'package:ui_kit/components/avatar/gf_avatar.dart'; import 'package:ui_kit/components/button/gf_icon_button.dart'; import 'package:ui_kit/components/card/gf_card.dart'; -import 'package:ui_kit/components/header/gf_header.dart'; +import 'package:ui_kit/components/typography/gf_typography.dart'; import 'package:ui_kit/components/list_tile/gf_list_tile.dart'; import 'package:ui_kit/shape/gf_avatar_shape.dart'; -import 'package:ui_kit/types/gf_heading_type.dart'; +import 'package:ui_kit/types/gf_typography_type.dart'; class ListTiles extends StatefulWidget { @override @@ -28,9 +28,9 @@ class _ListTilesState extends State { GFCard( content: GFListTile( - title: GFHeader( + title: GFTypography( text: 'List tile', - type: GFHeadingType.typo5, + type: GFTypographyType.typo5, showDivider: false, ), subTitle: Text('Lorem ipsum', style: TextStyle(color: getGFColor(GFColor.dark)),), @@ -44,9 +44,9 @@ class _ListTilesState extends State { avatar: GFAvatar( shape: GFAvatarShape.standard, ), - title: GFHeader( + title: GFTypography( text: 'List tile', - type: GFHeadingType.typo5, + type: GFTypographyType.typo5, showDivider: false, ), subTitle: Text('Lorem ipsum', style: TextStyle(color: getGFColor(GFColor.dark)),), @@ -60,9 +60,9 @@ class _ListTilesState extends State { GFCard( content: GFListTile( - title: GFHeader( + title: GFTypography( text: 'List tile', - type: GFHeadingType.typo5, + type: GFTypographyType.typo5, showDivider: false, ), subTitle: Text('Lorem ipsum', style: TextStyle(color: getGFColor(GFColor.dark)),), @@ -82,9 +82,9 @@ class _ListTilesState extends State { avatar: GFAvatar( shape: GFAvatarShape.square, ), - title: GFHeader( + title: GFTypography( text: 'List tile', - type: GFHeadingType.typo5, + type: GFTypographyType.typo5, showDivider: false, ), subTitle: Text('Lorem ipsum', style: TextStyle(color: getGFColor(GFColor.dark)),), diff --git a/demo_app/lib/screens/toasts.dart b/demo_app/lib/screens/toasts.dart index 3ec68dfd..fd6f6a5d 100644 --- a/demo_app/lib/screens/toasts.dart +++ b/demo_app/lib/screens/toasts.dart @@ -2,9 +2,9 @@ import 'package:flutter/material.dart'; import 'package:ui_kit/colors/gf_color.dart'; import 'package:ui_kit/components/button/gf_button.dart'; import 'package:ui_kit/components/card/gf_card.dart'; -import 'package:ui_kit/components/header/gf_header.dart'; +import 'package:ui_kit/components/header/gf_typography.dart'; import 'package:ui_kit/components/toast/gf_toast.dart'; -import 'package:ui_kit/types/gf_heading_type.dart'; +import 'package:ui_kit/types/gf_typography_type.dart'; import 'package:ui_kit/types/gf_type.dart'; class Toasts extends StatefulWidget { diff --git a/demo_app/lib/screens/toggles.dart b/demo_app/lib/screens/toggles.dart index 9199a3e5..691795dd 100644 --- a/demo_app/lib/screens/toggles.dart +++ b/demo_app/lib/screens/toggles.dart @@ -1,9 +1,9 @@ import 'package:flutter/material.dart'; import 'package:flutter/painting.dart'; import 'package:ui_kit/components/card/gf_card.dart'; -import 'package:ui_kit/components/header/gf_header.dart'; +import 'package:ui_kit/components/typography/gf_typography.dart'; import 'package:ui_kit/components/toggle/gf_toggle.dart'; -import 'package:ui_kit/types/gf_heading_type.dart'; +import 'package:ui_kit/types/gf_typography_type.dart'; import 'package:ui_kit/types/gf_toggle_type.dart'; import 'package:ui_kit/colors/gf_color.dart'; @@ -27,9 +27,9 @@ class _TogglesState extends State { GFCard( content: Column( children: [ - GFHeader( + GFTypography( text: 'Android', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ), SizedBox( height: 10, @@ -43,9 +43,9 @@ class _TogglesState extends State { GFCard( content: Column( children: [ - GFHeader( + GFTypography( text: 'IOS', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ), SizedBox( height: 10, @@ -59,9 +59,9 @@ class _TogglesState extends State { GFCard( content: Column( children: [ - GFHeader( + GFTypography( text: 'Square', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ), SizedBox( height: 10, @@ -75,9 +75,9 @@ class _TogglesState extends State { GFCard( content: Column( children: [ - GFHeader( + GFTypography( text: 'Custom', - type: GFHeadingType.typo6, + type: GFTypographyType.typo6, ), SizedBox( height: 10, diff --git a/example/lib/main.dart b/example/lib/main.dart index 5758485b..7df22efa 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -17,6 +17,16 @@ import 'package:ui_kit/components/toast/gf_toast.dart'; import 'package:ui_kit/components/appbar/gf_appbar.dart'; import 'package:ui_kit/components/tabs/gf_tabBarView.dart'; import 'package:ui_kit/components/button/gf_icon_button.dart'; +import 'package:ui_kit/components/button/gf_social_button.dart'; +import 'package:ui_kit/components/carousel/gf_carousel.dart'; +import 'package:ui_kit/components/carousel/gf_items_carousel.dart'; +import 'package:ui_kit/shape/gf_avatar_shape.dart'; +import 'package:ui_kit/components/card/gf_card.dart'; +import 'package:ui_kit/components/image/gf_image_overlay.dart'; +import 'package:ui_kit/components/list_tile/gf_list_tile.dart'; +import 'package:ui_kit/position/gf_position.dart'; +import 'package:ui_kit/components/button/gf_button_bar.dart'; +import 'package:ui_kit/components/badge/gf_icon_badge.dart'; final List imageList = [ "https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg", @@ -170,40 +180,109 @@ class _MyHomePageState extends State // Container(color: Colors.green), // Container(color: Colors.blue) // ]), - Column( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - - GFButton( - text: 'goodies', - onPressed: (){}, + SingleChildScrollView( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + + GFButton( + text: "whatsapp", + icon: Icon(Icons.directions_bike), + ), + + GFButton( + text: "linkedin", + icon: Icon(Icons.directions_bike), + ), + + + GFButtonBadge( + onPressed: (){}, +// position: GFIconPosition.start, +// borderSide: BorderSide(color: Colors.pink, width: 1.0, style: BorderStyle.solid), +// borderShape: RoundedRectangleBorder(side: BorderSide(color: Colors.pink, width: 2.0, style: BorderStyle.solid), borderRadius: BorderRadius.zero), +// text: 'goodiesdxs', +// color: GFColor.danger, +// shape: GFButtonShape.pills, +// type: GFType.outline2x, +// size: GFSize.small, + child: Text("der"), + icon: GFBadge( + child: Text("12"), +// color: GFColor.dark, +// shape: GFBadgeShape.circle, +// size: GFSize.small, +// border: BorderSide(color: Colors.pink, width: 1.0, style: BorderStyle.solid), +// textColor: GFColor.white, +// textStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: 8.0), + ), + ), + + GFSocialButton( + text: 'goodies', + onPressed: (){}, +// icon: GFBadge( +// child: Text("12"), +// color: GFColor.dark, +//// shape: GFBadgeShape.circle, +//// size: GFSize.small, +//// border: BorderSide(color: Colors.pink, width: 1.0, style: BorderStyle.solid), +//// textColor: GFColor.white, +//// textStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: 8.0), +// ), + type: GFType.outline2x, + shape: GFButtonShape.pills, +// blockButton: true, + fullWidthButton: true, + + ), + + GFButton( +// icon: GFBadge( +// child: Text("12"), +// color: GFColor.dark, +//// shape: GFBadgeShape.circle, +//// size: GFSize.small, +//// border: BorderSide(color: Colors.pink, width: 1.0, style: BorderStyle.solid), +//// textColor: GFColor.white, +//// textStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: 8.0), +// ), + text: 'goodies', + onPressed: (){}, // textColor: GFColor.danger, // icon: Icon(Icons.access_alarms), // hoverColor: GFColor.dark, - color: GFColor.secondary, + color: GFColor.secondary, // focusColor: GFColor.danger, - type: GFType.outline2x, - shape: GFButtonShape.pills, + type: GFType.solid, + shape: GFButtonShape.pills, + buttonBoxShadow: true, +// boxShadow: BoxShadow( +// color: Colors.pink, +// blurRadius: 2.0, +// spreadRadius: 1.0, +// offset: Offset.zero, +// ), // splashColor: GFColor.warning, // highlightColor: GFColor.alt, // size: GFSize.large, // disabledColor: GFColor.dark, // disabledTextColor: GFColor.light, - blockButton: true, + blockButton: true, // fullWidthButton: true, // borderSide: BorderSide(color: Colors.pink, width: 1.0, style: BorderStyle.solid), // borderShape: RoundedRectangleBorder(side: BorderSide(color: Colors.pink, width: 2.0, style: BorderStyle.solid), borderRadius: BorderRadius.zero), - ), + ), - GFIconButton( - onPressed: null, - icon: Icon(Icons.ac_unit,), + GFIconButton( + onPressed: null, + icon: Icon(Icons.ac_unit,), // iconSize: 12.0, - type: GFType.outline2x, + type: GFType.solid, // shape: GFButtonShape.pills, // size: GFSize.large, -// buttonBoxShadow: true, + buttonBoxShadow: true, color: GFColor.secondary, // boxShadow: BoxShadow( // color: Colors.pink, @@ -213,498 +292,471 @@ class _MyHomePageState extends State // ), // borderSide: BorderSide(color: Colors.pink, width: 1.0, style: BorderStyle.solid), // borderShape: RoundedRectangleBorder(side: BorderSide(color: Colors.pink, width: 2.0, style: BorderStyle.solid), borderRadius: BorderRadius.zero), - ), + ), - RaisedButton( - child: Text('goodiesMaterialButton button '), - onPressed: (){}, + RaisedButton( + child: Text('goodiesMaterialButton button '), + onPressed: (){}, // color: Colors.blueGrey, // hoverColor: Colors.blueGrey, // focusColor: Colors.teal, // splashColor: Colors.amber, // highlightColor: Colors.cyan, - ), - ], - ) -// SingleChildScrollView( -// child: Column( -// mainAxisAlignment: MainAxisAlignment.center, -// crossAxisAlignment: CrossAxisAlignment.center, -// children: [ -// GFAvatar( -// radius: 80.0, -// backgroundImage: NetworkImage("https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg"), + ), + + GFAvatar( + radius: 80.0, + backgroundImage: NetworkImage("https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg"), + ), + + GFSegmentTabs( + tabController: tabController, +// height: 38.0, +// width: 180.0, + initialIndex: 0, + length: 3, + tabs: [ + Text( + "Gelatin", + ), + Tab( + child: Text( + "Donuts", + ), + ), + Tab( + child: Text( + "Pastry", + ), + ), + ], +// tabBarColor: Colors.pink.withOpacity(0.6), +// indicatorSize: TabBarIndicatorSize.tab, +// indicatorColor: Colors.tealAccent, +// indicator: BoxDecoration( +// color: Colors.pink, +// border: Border.all(color: Colors.green, width: 1.0), +// borderRadius: BorderRadius.circular(50.0) +// ), +// indicatorPadding: EdgeInsets.all(8.0), +// indicatorWeight: 2.0, +// border: Border.all(color: Colors.orange, width: 2.0), +// borderRadius: BorderRadius.circular(50.0) + ), + + GFTabBarView( + controller: tabController, + height: 400.0, + children: [ + Container(color: Colors.red), + Container(color: Colors.green), + Container(color: Colors.blue) + ] + ), + + GFItemsCarousel( + rowCount: 3, + children: imageList.map( + (url) { + return Container( + margin: EdgeInsets.all(5.0), + child: ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(5.0)), + child: Image.network( + url, + fit: BoxFit.cover, + width: 1000.0 + ), + ), + ); + }, + ).toList(), + ), + + GFCarousel( + rowCount: 3, + pagerSize: 12.0, + activeIndicator: Colors.pink, + passiveIndicator: Colors.pink.withOpacity(0.4), + viewportFraction: 1.0, + aspectRatio: 2.0, + autoPlay: true, + enlargeMainPage: true, + pagination: true, + items: imageList.map( + (url) { + return Container( + margin: EdgeInsets.all(5.0), + child: ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(5.0)), + child: Image.network( + url, + fit: BoxFit.cover, + width: 1000.0 + ), + ), + ); + }, + ).toList(), + onPageChanged: (index) { + setState(() { + index; + }); + }, + ), + + + GFTabs( + initialIndex: 0, + length: 3, + tabs: [ + GFButton( + onPressed: null, + child: Text("share"), + icon: Icon(Icons.share), + buttonBoxShadow: true, + ), + Tab( + icon: Icon(Icons.error), + child: Text( + "Orders", + ), + ), + Tab( + child: Text( + "Pastry", + ), + ), + ], + tabBarView: GFTabBarView( + children: [ + Container( + color: Colors.red, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + + GFToast( + child: Text("sdc"), + backgroundColor: Colors.pink, + button: GFButton( + text: 'dsx', + onPressed: (){ + print("fdsc"); + }, + ), + ), + RawMaterialButton( + onPressed: null, + child: Text("fv"), + ), + FlatButton(onPressed: null, child: Text("cds")), + Icon(Icons.directions_railway), + GFButton( + onPressed: null, + child: Text("share"), + icon: Icon(Icons.share), + shape: GFButtonShape.pills, + type: GFType.transparent, + ), + ], + ), + ), + Icon(Icons.directions_car), + Icon(Icons.directions_transit), + ], + ), +// indicatorColor: Colors.teal, +// indicatorSize: TabBarIndicatorSize.label, +// labelColor: Colors.lightGreen, +// unselectedLabelColor: Colors.black, +// labelStyle: TextStyle( +// fontWeight: FontWeight.w500, +// fontSize: 13.0, +// color: Colors.deepOrange, +// fontFamily: 'OpenSansBold', // ), -// -// GFSegmentTabs( -// tabController: tabController, -//// height: 38.0, -//// width: 180.0, -// initialIndex: 0, -// length: 3, -// tabs: [ -// Tab( -// child: Text( -// "Gelatin", -// ), -// ), -// Tab( -// child: Text( -// "Donuts", -// ), -// ), -// Tab( -// child: Text( -// "Pastry", -// ), -// ), -// ], -//// tabBarColor: Colors.pink.withOpacity(0.6), -//// indicatorSize: TabBarIndicatorSize.tab, -//// indicatorColor: Colors.tealAccent, -//// indicator: BoxDecoration( -//// color: Colors.pink, -//// border: Border.all(color: Colors.green, width: 1.0), -//// borderRadius: BorderRadius.circular(50.0) -//// ), -//// indicatorPadding: EdgeInsets.all(8.0), -//// indicatorWeight: 2.0, -//// border: Border.all(color: Colors.orange, width: 2.0), -//// borderRadius: BorderRadius.circular(50.0) +// unselectedLabelStyle: TextStyle( +// fontWeight: FontWeight.w500, +// fontSize: 13.0, +// color: Colors.black, +// fontFamily: 'OpenSansBold', // ), + ), -// GFTabBarView( -// controller: tabController, -// height: 400.0, -// children: [ -// Container(color: Colors.red), -// Container(color: Colors.green), -// Container(color: Colors.blue) -// ] -// ), + GFCarousel( + autoPlay: true, + viewportFraction: 1.0, + aspectRatio: MediaQuery.of(context).size.aspectRatio, + items: imageList.map( + (url) { + return Container( + margin: EdgeInsets.all(5.0), + child: ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(5.0)), + child: Image.network( + url, + fit: BoxFit.cover, + width: 1000.0, + ), + ), + ); + }, + ).toList(), + onPageChanged: (index) { + setState(() { + index; + }); + }, + ), + 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: GFListTile( + 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, + ), + ), + content: Text( + "Flutter " + "Flutter is Google's mobile UI framework for crafting" + " high-quality native interfaces on iOS and Android in " + "Flutter ", + style: TextStyle(color: Colors.grey), + ), + buttonBar: GFButtonBar( + mainAxisSize: MainAxisSize.min, + children: [ + GFButton( + onPressed: null, + child: Text("favorite"), + icon: Icon(Icons.favorite_border), + type: GFType.transparent, + ), + GFButton( + onPressed: null, + child: Text("share"), + icon: Icon(Icons.share), + type: GFType.outline, + ), + ], + ), + ), + GFButtonBar( + mainAxisSize: MainAxisSize.min, + children: [ + GFButton( + onPressed: null, + child: Text("like"), + icon: Icon(Icons.favorite_border), + type: GFType.transparent, + ), + GFButton( + onPressed: null, + child: Text("comment"), + ), + GFButton( + color: Colors.teal, + onPressed: (){}, + child: Text("share"), + icon: Icon(Icons.share), + type: GFType.outline, + ), + ], + ), -// GFItemsSlider( -// rowCount: 3, -// children: imageList.map( -// (url) { -// return Container( -// margin: EdgeInsets.all(5.0), -// child: ClipRRect( -// borderRadius: BorderRadius.all(Radius.circular(5.0)), -// child: Image.network( -// url, -// fit: BoxFit.cover, -// width: 1000.0 -// ), -// ), -// ); -// }, -// ).toList(), -// ), -// GFSlider( -// rowCount: 3, -// pagerSize: 12.0, -// activeIndicator: Colors.pink, -// passiveIndicator: Colors.pink.withOpacity(0.4), -// viewportFraction: 1.0, -// aspectRatio: 2.0, -// autoPlay: true, -// enlargeMainPage: true, -// pagination: true, -// items: imageList.map( -// (url) { -// return Container( -// margin: EdgeInsets.all(5.0), -// child: ClipRRect( -// borderRadius: BorderRadius.all(Radius.circular(5.0)), -// child: Image.network( -// url, -// fit: BoxFit.cover, -// width: 1000.0 -// ), -// ), -// ); -// }, -// ).toList(), -// onPageChanged: (index) { -// setState(() { -// index; -// }); -// }, -// ), + GFListTile( + avatar: GFAvatar( + child: Text("tb"), + ), + title: Text('title'), + subTitle: Text('subtitle'), + icon: GFIconButton( + onPressed: null, + type: GFType.transparent, + icon: Icon(Icons.favorite_border), + ), + ), + GFImageOverlay( + width: MediaQuery.of(context).size.width, + margin: EdgeInsets.all(16.0), + padding: EdgeInsets.all(16.0), + child: Column( + children: [ + new Text( + 'Hello world', + style: TextStyle(color: Colors.white), + ), + new Text( + 'Hello world', + style: TextStyle(color: Colors.white), + ), + new Text( + 'Hello world', + style: TextStyle(color: Colors.white), + ), + new Text( + 'Hello world', + style: TextStyle(color: Colors.white), + ), + new Text( + 'Hello world', + style: TextStyle(color: Colors.white), + ), + new Text( + 'Hello world', + style: TextStyle(color: Colors.white), + ), + new Text( + 'Hello world', + style: TextStyle(color: Colors.white), + ), + new Text( + 'Hello world', + style: TextStyle(color: Colors.white), + ), + new Text( + 'Hello world', + style: TextStyle(color: Colors.white), + ), + new Text( + 'Hello world', + style: TextStyle(color: Colors.white), + ), + new Text( + 'Hello world', + style: TextStyle(color: Colors.white), + ), + ], + ), +// color: Colors.orange, + image: AssetImage("lib/assets/food.jpeg"), + boxFit: BoxFit.cover, + colorFilter: new ColorFilter.mode( + Colors.black.withOpacity(0.6), BlendMode.darken), + borderRadius: new BorderRadius.circular(5.0), +// border: Border.all(color: Colors.pink, width: 2.0), + ), + GFAvatar( + // radius: 20.0, +// maxRadius: 50, + child: Text("de"), -// GFTabs( -// initialIndex: 0, -// length: 3, -// tabs: [ -// GFButton( -// onPressed: null, -// child: Text("share"), -// icon: Icon(Icons.share), -// buttonBoxShadow: true, -// ), -// Tab( -// icon: Icon(Icons.error), -// child: Text( -// "Orders", -// ), -// ), -// Tab( -// child: Text( -// "Pastry", -// ), -// ), -// ], -// tabBarView: GFTabBarView( -// children: [ -// Container( -// color: Colors.red, -// child: Column( -// mainAxisAlignment: MainAxisAlignment.center, -// crossAxisAlignment: CrossAxisAlignment.center, -// children: [ +// backgroundColor: Colors.pink, // -// GFToast( -// child: Text("sdc"), -// backgroundColor: Colors.pink, -// button: GFButton( -// text: 'dsx', -// onPressed: (){ -// print("fdsc"); -// }, -// ), -// ), -// RawMaterialButton( -// onPressed: null, -// child: Text("fv"), -// ), -// FlatButton(onPressed: null, child: Text("cds")), -// Icon(Icons.directions_railway), -// GFButton( -// onPressed: null, -// child: Text("share"), -// icon: Icon(Icons.share), -// shape: GFButtonShape.pills, -// type: GFType.transparent, -// ), -// ], -// ), -// ), -// Icon(Icons.directions_car), -// Icon(Icons.directions_transit), -// ], -// ), -// indicatorColor: Colors.teal, -//// indicatorSize: TabBarIndicatorSize.label, -//// labelColor: Colors.lightGreen, -//// unselectedLabelColor: Colors.black, -//// labelStyle: TextStyle( -//// fontWeight: FontWeight.w500, -//// fontSize: 13.0, -//// color: Colors.deepOrange, -//// fontFamily: 'OpenSansBold', -//// ), -//// unselectedLabelStyle: TextStyle( -//// fontWeight: FontWeight.w500, -//// fontSize: 13.0, -//// color: Colors.black, -//// fontFamily: 'OpenSansBold', -//// ), -// ), +//// backgroundImage: , // -// GFSlider( -// autoPlay: true, -// viewportFraction: 1.0, -// aspectRatio: MediaQuery.of(context).size.aspectRatio, -// items: imageList.map( -// (url) { -// return Container( -// margin: EdgeInsets.all(5.0), -// child: ClipRRect( -// borderRadius: BorderRadius.all(Radius.circular(5.0)), -// child: Image.network( -// url, -// fit: BoxFit.cover, -// width: 1000.0, -// ), -// ), -// ); -// }, -// ).toList(), -// onPageChanged: (index) { -// setState(() { -// index; -// }); -// }, -// ), -// 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: GFListTile( -// 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, -// ), -// ), -// content: Text( -// "Flutter " -// "Flutter is Google's mobile UI framework for crafting" -// " high-quality native interfaces on iOS and Android in " -// "Flutter ", -// style: TextStyle(color: Colors.grey), -// ), -// buttonBar: GFButtonBar( -// mainAxisSize: MainAxisSize.min, -// children: [ -// GFButton( -// onPressed: null, -// child: Text("favorite"), -// icon: Icon(Icons.favorite_border), -// type: GFType.transparent, -// ), -// GFButton( -// onPressed: null, -// child: Text("share"), -// icon: Icon(Icons.share), -// type: GFType.outline, -// ), -// ], -// ), -// ), -// GFButtonBar( -// mainAxisSize: MainAxisSize.min, -// children: [ -// GFButton( -// onPressed: null, -// child: Text("like"), -// icon: Icon(Icons.favorite_border), -// type: GFType.transparent, -// ), -// GFButton( -// onPressed: null, -// child: Text("comment"), -// ), -// GFButton( -// color: Colors.teal, -// onPressed: (){}, -// child: Text("share"), -// icon: Icon(Icons.share), -// type: GFType.outline, -// ), -// ], -// ), +// foregroundColor: Colors.deepOrangeAccent, // + shape: GFAvatarShape.standard, // -// GFListTile( -// avatar: GFAvatar( -// child: Text("tb"), -// ), -// title: Text('title'), -// subTitle: Text('subtitle'), -// icon: GFIconButton( -// onPressed: null, -// type: GFType.transparent, -// icon: Icon(Icons.favorite_border), -// ), -// ), -// GFImageOverlay( -// width: MediaQuery.of(context).size.width, -// margin: EdgeInsets.all(16.0), -// padding: EdgeInsets.all(16.0), -// child: Column( -// children: [ -// new Text( -// 'Hello world', -// style: TextStyle(color: Colors.white), -// ), -// new Text( -// 'Hello world', -// style: TextStyle(color: Colors.white), -// ), -// new Text( -// 'Hello world', -// style: TextStyle(color: Colors.white), -// ), -// new Text( -// 'Hello world', -// style: TextStyle(color: Colors.white), -// ), -// new Text( -// 'Hello world', -// style: TextStyle(color: Colors.white), -// ), -// new Text( -// 'Hello world', -// style: TextStyle(color: Colors.white), -// ), -// new Text( -// 'Hello world', -// style: TextStyle(color: Colors.white), -// ), -// new Text( -// 'Hello world', -// style: TextStyle(color: Colors.white), -// ), -// new Text( -// 'Hello world', -// style: TextStyle(color: Colors.white), -// ), -// new Text( -// 'Hello world', -// style: TextStyle(color: Colors.white), -// ), -// new Text( -// 'Hello world', -// style: TextStyle(color: Colors.white), -// ), -// ], -// ), -//// color: Colors.orange, -// image: AssetImage("lib/assets/food.jpeg"), -// boxFit: BoxFit.cover, -// colorFilter: new ColorFilter.mode( -// Colors.black.withOpacity(0.6), BlendMode.darken), -// borderRadius: new BorderRadius.circular(5.0), -//// border: Border.all(color: Colors.pink, width: 2.0), -// ), -// GFAvatar( -// // radius: 20.0, -//// maxRadius: 50, +// size: GFSize.medium, // -// child: Text("de"), +// borderRadius: BorderRadius.circular(20.0), + ), + GFIconBadge( + onPressed: null, + child: GFIconButton( + onPressed: null, + icon: Icon(Icons.ac_unit), + ), + counterChild: GFBadge( + text: '12', + +// color: GFColor.dark +////, +// shape: GFBadgeShape.circle, // -//// backgroundColor: Colors.pink, -//// -////// backgroundImage: , -//// -//// foregroundColor: Colors.deepOrangeAccent, -//// -// shape: GFAvatarShape.standard, -//// -//// size: GFSize.medium, -//// -//// borderRadius: BorderRadius.circular(20.0), -// ), -// GFIconBadges( -// onPressed: null, -// child: GFIconButton( -// onPressed: null, -// icon: Icon(Icons.ac_unit), -// ), -// counterChild: GFBadge( -// text: '12', +// size: GFSize.small, +// +// border: BorderSide(color: Colors.pink, width: 1.0, style: BorderStyle.solid), +// +// textColor: GFColor.white, // -//// color: GFColor.dark -//////, -//// shape: GFBadgeShape.circle, -//// -//// size: GFSize.small, -//// -//// border: BorderSide(color: Colors.pink, width: 1.0, style: BorderStyle.solid), -//// -//// textColor: GFColor.white, -//// -//// textStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: 8.0), -//// -//// borderShape: RoundedRectangleBorder(side: BorderSide(color: Colors.orange, width: 2.0, style: BorderStyle.solid), borderRadius: BorderRadius.zero), +// textStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: 8.0), +// +// borderShape: RoundedRectangleBorder(side: BorderSide(color: Colors.orange, width: 2.0, style: BorderStyle.solid), borderRadius: BorderRadius.zero), + ), + ), + GFIconButton( + onPressed: null, + icon: Icon(Icons.ac_unit), +// iconSize: 12.0, + type: GFType.solid, + shape: GFButtonShape.pills, + size: GFSize.large, +// buttonBoxShadow: true, +// color: GFColor.primary, +// boxShadow: BoxShadow( +// color: Colors.pink, +// blurRadius: 2.0, +// spreadRadius: 1.0, +// offset: Offset.zero, // ), -// ), -// GFIconButton( -// onPressed: null, -// icon: Icon(Icons.ac_unit), -//// iconSize: 12.0, -// type: GFType.solid, -// shape: GFButtonShape.pills, +// borderSide: BorderSide(color: Colors.pink, width: 1.0, style: BorderStyle.solid), +// borderShape: RoundedRectangleBorder(side: BorderSide(color: Colors.pink, width: 2.0, style: BorderStyle.solid), borderRadius: BorderRadius.zero), + ), + + GFBadge( + text: '12', +// color: GFColor.dark, + shape: GFBadgeShape.circle, +// size: GFSize.small, +// border: BorderSide(color: Colors.pink, width: 1.0, style: BorderStyle.solid), +// textColor: GFColor.white, +// textStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: 8.0), + ), + + GFButton( + type: GFType.solid, + shape: GFButtonShape.pills, + text: 'goodies', + onPressed: () { + print('dddddddddd'); + }, + hoverColor: Colors.orange, + focusColor: Colors.teal, +// textStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: 8.0), // size: GFSize.large, -//// buttonBoxShadow: true, -//// color: GFColor.primary, -//// boxShadow: BoxShadow( -//// color: Colors.pink, -//// blurRadius: 2.0, -//// spreadRadius: 1.0, -//// offset: Offset.zero, -//// ), -//// borderSide: BorderSide(color: Colors.pink, width: 1.0, style: BorderStyle.solid), -//// borderShape: RoundedRectangleBorder(side: BorderSide(color: Colors.pink, width: 2.0, style: BorderStyle.solid), borderRadius: BorderRadius.zero), -// ), -// GFButtonBadge( -// onPressed: null, -//// position: GFIconPosition.start, -//// borderSide: BorderSide(color: Colors.pink, width: 1.0, style: BorderStyle.solid), -//// borderShape: RoundedRectangleBorder(side: BorderSide(color: Colors.pink, width: 2.0, style: BorderStyle.solid), borderRadius: BorderRadius.zero), -// text: 'goodies', -//// color: GFColor.danger, -//// shape: GFButtonShape.pills, -// type: GFType.outline, -//// size: GFSize.small, -// counterChild: GFBadge( -// child: Text("12"), -//// color: GFColor.dark, -// shape: GFBadgeShape.circle, -//// size: GFSize.small, -//// border: BorderSide(color: Colors.pink, width: 1.0, style: BorderStyle.solid), -//// textColor: GFColor.white, -//// textStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: 8.0), +// buttonBoxShadow: true, +// blockButton: true, +// fullWidthButton: true, +// color: GFColor.primary, +// textColor: GFColor.secondary, +// icon: Icon(Icons.error, color: Colors.white,), +// position: GFIconPosition.start, +// boxShadow: BoxShadow( +// color: Colors.pink, +// blurRadius: 2.0, +// spreadRadius: 1.0, +// offset: Offset.zero, // ), -// ), -// GFBadge( -// text: '12', -//// color: GFColor.dark, -// shape: GFBadgeShape.circle, -//// size: GFSize.small, -//// border: BorderSide(color: Colors.pink, width: 1.0, style: BorderStyle.solid), -//// textColor: GFColor.white, -//// textStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: 8.0), -// ), - -// GFButton( -// type: GFType.solid, -// shape: GFButtonShape.pills, -// text: 'goodies', -// onPressed: () { -// print('dddddddddd'); -// }, -// hoverColor: Colors.orange, -// focusColor: Colors.teal, -//// textStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: 8.0), -//// size: GFSize.large, -//// buttonBoxShadow: true, -//// blockButton: true, -//// fullWidthButton: true, -//// color: GFColor.primary, -//// textColor: GFColor.secondary, -//// icon: Icon(Icons.error, color: Colors.white,), -//// position: GFIconPosition.start, -//// boxShadow: BoxShadow( -//// color: Colors.pink, -//// blurRadius: 2.0, -//// spreadRadius: 1.0, -//// offset: Offset.zero, -//// ), -//// borderSide: BorderSide(color: Colors.pink, width: 1.0, style: BorderStyle.solid), -//// borderShape: RoundedRectangleBorder(side: BorderSide(color: Colors.pink, width: 2.0, style: BorderStyle.solid), borderRadius: BorderRadius.zero), -// ), -// ], -// ), -// ), +// borderSide: BorderSide(color: Colors.pink, width: 1.0, style: BorderStyle.solid), +// borderShape: RoundedRectangleBorder(side: BorderSide(color: Colors.pink, width: 2.0, style: BorderStyle.solid), borderRadius: BorderRadius.zero), + ), + ], + ), + ), ); } } diff --git a/lib/components/badge/gf_button_badge.dart b/lib/components/badge/gf_button_badge.dart index 0925bc51..9346f863 100644 --- a/lib/components/badge/gf_button_badge.dart +++ b/lib/components/badge/gf_button_badge.dart @@ -1,125 +1,397 @@ +import 'dart:math' as math; +import 'package:flutter/foundation.dart'; +import 'package:flutter/gestures.dart'; +import 'package:flutter/rendering.dart'; +import 'package:flutter/widgets.dart'; import 'package:flutter/material.dart'; -import 'package:ui_kit/shape/gf_badge_shape.dart'; +import 'package:ui_kit/components/button/gf_button.dart'; import 'package:ui_kit/shape/gf_button_shape.dart'; import 'package:ui_kit/size/gf_size.dart'; import 'package:ui_kit/types/gf_type.dart'; import 'package:ui_kit/position/gf_position.dart'; import 'package:ui_kit/colors/gf_color.dart'; -import 'package:ui_kit/components/button/gf_button.dart'; -class GFButtonBadge extends StatefulWidget { - /// Called when the badge is tapped or otherwise activated. +class GFButtonBadge extends GFButton{ + /// Called when the button is tapped or otherwise activated. final VoidCallback onPressed; + /// Called by the underlying [InkWell] widget's [InkWell.onHighlightChanged] callback. + final ValueChanged onHighlightChanged; + /// Defines the default text style, with [Material.textStyle], for the button's [child]. final TextStyle textStyle; - /// The border side for the badge's [Material]. + /// The border side for the button's [Material]. final BorderSide borderSide; - /// The internal padding for the badge's [child]. + /// The box shadow for the button's [Material]. + final BoxShadow boxShadow; + + /// Pass [GFColor] or [Color]. The color for the button's [Material] when it has the input focus. + final dynamic focusColor; + + /// Pass [GFColor] or [Color]. The color for the button's [Material] when a pointer is hovering over it. + final dynamic hoverColor; + + /// Pass [GFColor] or [Color]. The highlight color for the button's [InkWell]. + final dynamic highlightColor; + + /// Pass [GFColor] or [Color]. The splash color for the button's [InkWell]. + final dynamic splashColor; + + /// The elevation for the button's [Material] when the button is [enabled] but not pressed. + final double elevation; + + /// The elevation for the button's [Material] when the button is [enabled] and a pointer is hovering over it. + final double hoverElevation; + + /// The elevation for the button's [Material] when the button is [enabled] and has the input focus. + final double focusElevation; + + /// The elevation for the button's [Material] when the button is [enabled] and pressed. + final double highlightElevation; + + /// The elevation for the button's [Material] when the button is not [enabled]. + final double disabledElevation; + + /// The internal padding for the button's [child]. final EdgeInsetsGeometry padding; - /// The shape of the badge's [Material]. + /// Defines the button's size. + final BoxConstraints constraints; + + /// The shape of the button's [Material]. final ShapeBorder borderShape; - /// Badge type of [GFType] i.e, solid, outline, transparent + /// Defines the duration of animated changes for [shape] and [elevation]. + final Duration animationDuration; + + /// Typically the button's label. + final Widget child; + + /// Whether the button is enabled or disabled. + bool get enabled => onPressed != null; + + /// Configures the minimum size of the tap target. + final MaterialTapTargetSize materialTapTargetSize; + + /// {@macro flutter.widgets.Focus.focusNode} + final FocusNode focusNode; + + /// {@macro flutter.widgets.Focus.autofocus} + final bool autofocus; + + /// {@macro flutter.widgets.Clip} + final Clip clipBehavior; + + /// Button type of [GFType] i.e, solid, outline, outline2x, transparent final GFType type; - /// Badge type of [GFBadgeShape] i.e, standard, pills, square, circle + /// Button type of [GFButtonBadgeShape] i.e, standard, pills, square, shadow, icons final GFButtonShape shape; /// Pass [GFColor] or [Color] final dynamic color; + /// The fill color of the button when the button is disabled. + /// + /// The default value of this color is the theme's disabled color, + /// [ThemeData.disabledColor]. + /// + /// See also: + /// + /// * [color] - the fill color of the button when the button is [enabled]. + final dynamic disabledColor; + /// Pass [GFColor] or [Color] final dynamic textColor; + /// The color to use for this button's text when the button is disabled. + /// + /// The button's [Material.textStyle] will be the current theme's button + /// text style, [ThemeData.textTheme.button], configured with this color. + /// + /// The default value is the theme's disabled color, + /// [ThemeData.disabledColor]. + /// + /// If [textColor] is a [MaterialStateProperty], [disabledTextColor] + /// will be ignored. + /// + /// See also: + /// + /// * [textColor] - The color to use for this button's text when the button is [enabled]. + final dynamic disabledTextColor; + /// size of [double] or [GFSize] i.e, 1.2, small, medium, large etc. final dynamic size; - /// text of type [String] is used to display text on the button. + /// text of type [String] is alternative to child. text will get priority over child final String text; - /// child of type [Widget] is alternative to child. text will get priority over child. - /// You can use [GFBadge] for compatibility. - final Widget counterChild; + /// icon of type [Widget] + final Widget icon; - /// icon type of [GFPosition] i.e, start, end + /// icon type of [GFIconPosition] i.e, start, end final GFPosition position; - /// Create badges of all types. check out [GFIconBadge] for icon badges and [GFBadge] for default badges. - const GFButtonBadge({ - Key key, - @required this.onPressed, - this.textStyle, - this.padding = const EdgeInsets.symmetric(horizontal: 8.0), - this.borderShape, - this.type = GFType.solid, - this.shape = GFButtonShape.standard, - this.color = GFColor.primary, - this.textColor, - this.position = GFPosition.end, - this.size = GFSize.medium, - this.borderSide, - @required this.text, - @required this.counterChild, - }) : assert(shape != null, 'Badge shape can not be null'), - assert(padding != null), - super(key: key); + /// on true state blockButton gives block size button + final bool blockButton; - @override - _GFButtonBadgeState createState() => _GFButtonBadgeState(); -} + /// on true state full width Button gives full width button + final bool fullWidthButton; -class _GFButtonBadgeState extends State { - Color color; - Color textColor; - Widget child; - Widget icon; - Function onPressed; - GFType type; - GFButtonShape shape; - double size; - GFPosition position; + /// on true state default box shadow appears around button + final bool buttonBoxShadow; - @override - void initState() { - this.color = getGFColor(widget.color); - this.textColor = (widget.type == GFType.outline && widget.textColor == null) - ? this.color - : widget.textColor == null - ? getGFColor(GFColor.dark) - : getGFColor(widget.textColor); - this.onPressed = widget.onPressed; - this.type = widget.type; - this.shape = widget.shape; - this.size = getGFSize(widget.size); - this.position = widget.position; - super.initState(); - } + /// A set of thirteen colors that can be used to derive the button theme's + /// colors. + /// + /// This property was added much later than the theme's set of highly + /// specific colors, like [ThemeData.buttonColor], [ThemeData.highlightColor], + /// [ThemeData.splashColor] etc. + /// + /// The colors for new button classes can be defined exclusively in terms + /// of [colorScheme]. When it's possible, the existing buttons will + /// (continue to) gradually migrate to it. + final ColorScheme colorScheme; + + /// Whether detected gestures should provide acoustic and/or haptic feedback. + /// + /// For example, on Android a tap will produce a clicking sound and a + /// long-press will produce a short vibration, when feedback is enabled. + /// + /// See also: + /// + /// * [Feedback] for providing platform-specific feedback to certain actions. + final bool enableFeedback; + + /// Called when the button is long-pressed. + /// + /// If this callback and [onPressed] are null, then the button will be disabled. + /// + /// See also: + /// + /// * [enabled], which is true if the button is enabled. + final VoidCallback onLongPress; + + /// Create buttons of all types. check out [GFIconButton] for icon buttons, and [GFBadge] for badges + const GFButtonBadge( + {Key key, + @required this.onPressed, + this.onHighlightChanged, + this.textStyle, + this.boxShadow, + this.buttonBoxShadow, + this.focusColor, + this.hoverColor, + this.highlightColor, + this.splashColor, + this.elevation = 0.0, + this.focusElevation = 4.0, + this.hoverElevation = 4.0, + this.highlightElevation = 1.0, + this.disabledElevation = 0.0, + this.padding = const EdgeInsets.symmetric(horizontal: 8.0), + this.constraints, + this.borderShape, + this.animationDuration = kThemeChangeDuration, + this.clipBehavior = Clip.none, + this.focusNode, + this.autofocus = false, + MaterialTapTargetSize materialTapTargetSize, + this.child, + this.type = GFType.solid, + this.shape = GFButtonShape.standard, + this.color = GFColor.primary, + this.textColor, + this.position = GFPosition.end, + this.size = GFSize.medium, + this.borderSide, + this.text, + this.icon, + this.blockButton, + this.fullWidthButton, + this.colorScheme, + this.enableFeedback, + this.onLongPress, + this.disabledColor, + this.disabledTextColor, + }) + : materialTapTargetSize = + materialTapTargetSize ?? MaterialTapTargetSize.padded, + assert(shape != null, 'Button shape can not be null'), +// assert(elevation != null && elevation >= 0.0), + assert(focusElevation != null && focusElevation >= 0.0), + assert(hoverElevation != null && hoverElevation >= 0.0), + assert(highlightElevation != null && highlightElevation >= 0.0), + assert(disabledElevation != null && disabledElevation >= 0.0), + assert(padding != null), + assert(animationDuration != null), + assert(clipBehavior != null), + assert(autofocus != null); @override Widget build(BuildContext context) { + return ConstrainedBox( constraints: BoxConstraints(minHeight: 26.0, minWidth: 98.0), child: Container( height: this.size, child: GFButton( - textStyle: widget.textStyle, - borderSide: widget.borderSide, - color: this.color, - textColor: this.textColor, - text: widget.text, - onPressed: this.onPressed, - type: this.type, - shape: this.shape, - position: this.position, - size: this.size, - borderShape: widget.borderShape, - icon: widget.counterChild, + onPressed: onPressed, + onHighlightChanged: onHighlightChanged, + textStyle: textStyle, + boxShadow: boxShadow, + buttonBoxShadow: buttonBoxShadow, + focusColor: focusColor, + hoverColor: hoverColor, + highlightColor: highlightColor, + splashColor: splashColor, + elevation: elevation, + focusElevation: focusElevation, + hoverElevation: hoverElevation, + highlightElevation:highlightElevation, + disabledElevation: disabledElevation, + constraints: constraints, + borderShape: borderShape, + animationDuration: animationDuration, + clipBehavior: clipBehavior, + focusNode: focusNode, + autofocus : autofocus , + child: child, + type :GFType.solid, + shape :GFButtonShape.standard, + color :GFColor.primary, + textColor: textColor, + position :GFPosition.start, + size :GFSize.medium, + borderSide: borderSide, + text: text, + icon: icon, + blockButton: blockButton, + fullWidthButton: fullWidthButton, + disabledColor: disabledTextColor, + disabledTextColor: disabledColor, ), ), ); + } } + + + + +// +//class GFButtonBadge extends StatefulWidget { +// /// Called when the badge is tapped or otherwise activated. +// final VoidCallback onPressed; +// +// /// Defines the default text style, with [Material.textStyle], for the button's [child]. +// final TextStyle textStyle; +// +// /// The border side for the badge's [Material]. +// final BorderSide borderSide; +// +// /// The internal padding for the badge's [child]. +// final EdgeInsetsGeometry padding; +// +// /// The shape of the badge's [Material]. +// final ShapeBorder borderShape; +// +// /// Badge type of [GFType] i.e, solid, outline, transparent +// final GFType type; +// +// /// Badge type of [GFBadgeShape] i.e, standard, pills, square, circle +// final GFButtonShape shape; +// +// /// Pass [GFColor] or [Color] +// final dynamic color; +// +// /// Pass [GFColor] or [Color] +// final dynamic textColor; +// +// /// size of [double] or [GFSize] i.e, 1.2, small, medium, large etc. +// final dynamic size; +// +// /// text of type [String] is used to display text on the button. +// final String text; +// +// /// child of type [Widget] is alternative to child. text will get priority over child. +// /// You can use [GFBadge] for compatibility. +// final Widget icon; +// +// /// icon type of [GFPosition] i.e, start, end +// final GFPosition position; +// +// /// Create badges of all types. check out [GFIconBadge] for icon badges and [GFBadge] for default badges. +// const GFButtonBadge({ +// Key key, +// @required this.onPressed, +// this.textStyle, +// this.padding = const EdgeInsets.symmetric(horizontal: 8.0), +// this.borderShape, +// this.type = GFType.solid, +// this.shape = GFButtonShape.standard, +// this.color = GFColor.primary, +// this.textColor, +// this.position = GFPosition.end, +// this.size = GFSize.medium, +// this.borderSide, +// @required this.text, +// @required this.icon, +// }) : assert(shape != null, 'Badge shape can not be null'), +// assert(padding != null), +// super(key: key); +// +// @override +// _GFButtonBadgeState createState() => _GFButtonBadgeState(); +//} +// +//class _GFButtonBadgeState extends State { +// Color color; +// Color textColor; +// Widget child; +// Widget icon; +// Function onPressed; +// GFType type; +// GFButtonShape shape; +// double size; +// GFPosition position; +// +// @override +// void initState() { +// this.color = getGFColor(widget.color); +// this.textColor = getGFColor(widget.textColor); +// this.onPressed = widget.onPressed; +// this.type = widget.type; +// this.shape = widget.shape; +// this.size = getGFSize(widget.size); +// this.position = widget.position; +// super.initState(); +// } +// +// @override +// Widget build(BuildContext context) { +// return ConstrainedBox( +// constraints: BoxConstraints(minHeight: 26.0, minWidth: 98.0), +// child: Container( +// height: this.size, +// child: GFButton( +// textStyle: widget.textStyle, +// borderSide: widget.borderSide, +// color: this.color, +// textColor: this.textColor, +// text: widget.text, +// onPressed: this.onPressed, +// type: this.type, +// shape: this.shape, +// position: this.position, +// size: this.size, +// borderShape: widget.borderShape, +// icon: widget.icon, +// ), +// ), +// ); +// } +//} diff --git a/lib/components/button/gf_button_theme.dart b/lib/components/button/gf_button_theme.dart deleted file mode 100644 index 2962ef45..00000000 --- a/lib/components/button/gf_button_theme.dart +++ /dev/null @@ -1,956 +0,0 @@ -import 'package:flutter/foundation.dart'; -import 'package:flutter/widgets.dart'; -import 'package:flutter/material.dart'; - -/// Used with [ButtonTheme] and [ButtonThemeData] to define a button's base -/// colors, and the defaults for the button's minimum size, internal padding, -/// and shape. -/// -/// See also: -/// -/// * [RaisedButton], [FlatButton], [OutlineButton], which are configured -/// based on the ambient [ButtonTheme]. -enum ButtonTextTheme { - /// Button text is black or white depending on [ThemeData.brightness]. - normal, - - /// Button text is [ThemeData.accentColor]. - accent, - - /// Button text is based on [ThemeData.primaryColor]. - primary, -} - -/// Used with [ButtonTheme] and [ButtonThemeData] to define how the button bar -/// should size itself with either constraints or internal padding. -enum ButtonBarLayoutBehavior { - /// Button bars will be constrained to a minimum height of 52. - /// - /// This setting is require to create button bars which conform to the - /// material specification. - constrained, - - /// Button bars will calculate their padding from the button theme padding. - padded, -} - -/// Used with [ButtonThemeData] to configure the color and geometry of buttons. -/// -/// A button theme can be specified as part of the overall Material theme -/// using [ThemeData.buttonTheme]. The Material theme's button theme data -/// can be overridden with [ButtonTheme]. -/// -/// The actual appearance of buttons depends on the button theme, the -/// button's enabled state, its elevation (if any), and the overall [Theme]. -/// -/// See also: -/// -/// * [FlatButton] [RaisedButton], and [OutlineButton], which are styled -/// based on the ambient button theme. -/// * [RawMaterialButton], which can be used to configure a button that doesn't -/// depend on any inherited themes. -class ButtonTheme extends InheritedTheme { - /// Creates a button theme. - /// - /// The [textTheme], [minWidth], [height], and [colorScheme] arguments - /// must not be null. - ButtonTheme({ - Key key, - ButtonTextTheme textTheme = ButtonTextTheme.normal, - ButtonBarLayoutBehavior layoutBehavior = ButtonBarLayoutBehavior.padded, - double minWidth = 88.0, - double height = 36.0, - EdgeInsetsGeometry padding, - ShapeBorder shape, - bool alignedDropdown = false, - Color buttonColor, - Color disabledColor, - Color focusColor, - Color hoverColor, - Color highlightColor, - Color splashColor, - ColorScheme colorScheme, - MaterialTapTargetSize materialTapTargetSize, - Widget child, - }) : assert(textTheme != null), - assert(minWidth != null && minWidth >= 0.0), - assert(height != null && height >= 0.0), - assert(alignedDropdown != null), - assert(layoutBehavior != null), - data = ButtonThemeData( - textTheme: textTheme, - minWidth: minWidth, - height: height, - padding: padding, - shape: shape, - alignedDropdown: alignedDropdown, - layoutBehavior: layoutBehavior, - buttonColor: buttonColor, - disabledColor: disabledColor, - focusColor: focusColor, - hoverColor: hoverColor, - highlightColor: highlightColor, - splashColor: splashColor, - colorScheme: colorScheme, - materialTapTargetSize: materialTapTargetSize, - ), - super(key: key, child: child); - - /// Creates a button theme from [data]. - /// - /// The [data] argument must not be null. - const ButtonTheme.fromButtonThemeData({ - Key key, - @required this.data, - Widget child, - }) : assert(data != null), - super(key: key, child: child); - - // TODO(darrenaustin): remove after this deprecation warning has been on - // stable for a couple of releases. - // See https://github.com/flutter/flutter/issues/37333 - // - /// Creates a button theme that is appropriate for button bars, as used in - /// dialog footers and in the headers of data tables. - /// - /// Deprecated. Please use [ButtonBarTheme] instead which offers more - /// flexibility to configure [ButtonBar] widgets. - /// - /// To migrate instances of code that were just wrapping a [ButtonBar]: - /// - /// ```dart - /// ButtonTheme.bar( - /// child: ButtonBar(...) - /// ); - /// ``` - /// - /// you can just remove the `ButtonTheme.bar` as the defaults are now handled - /// by [ButtonBar] directly. - /// - /// If you have more complicated usages of `ButtonTheme.bar` like: - /// - /// ```dart - /// ButtonTheme.bar( - /// padding: EdgeInsets.symmetric(horizontal: 10.0), - /// textTheme: ButtonTextTheme.accent, - /// child: ButtonBar(...), - /// ); - /// ``` - /// - /// you can remove the `ButtonTheme.bar` and move the parameters to the - /// [ButtonBar] instance directly: - /// - /// ```dart - /// ButtonBar( - /// padding: EdgeInsets.symmetric(horizontal: 10.0), - /// textTheme: ButtonTextTheme.accent, - /// ... - /// ); - /// ``` - /// - /// You can also replace the defaults for all [ButtonBar] widgets by updating - /// [ThemeData.buttonBarTheme] for your app. - @Deprecated( - 'Use ButtonBarTheme instead. ' - 'This feature was deprecated after v1.9.1.' - ) - ButtonTheme.bar({ - Key key, - ButtonTextTheme textTheme = ButtonTextTheme.accent, - double minWidth = 64.0, - double height = 36.0, - EdgeInsetsGeometry padding = const EdgeInsets.symmetric(horizontal: 8.0), - ShapeBorder shape, - bool alignedDropdown = false, - Color buttonColor, - Color disabledColor, - Color focusColor, - Color hoverColor, - Color highlightColor, - Color splashColor, - ColorScheme colorScheme, - Widget child, - ButtonBarLayoutBehavior layoutBehavior = ButtonBarLayoutBehavior.padded, - }) : assert(textTheme != null), - assert(minWidth != null && minWidth >= 0.0), - assert(height != null && height >= 0.0), - assert(alignedDropdown != null), - data = ButtonThemeData( - textTheme: textTheme, - minWidth: minWidth, - height: height, - padding: padding, - shape: shape, - alignedDropdown: alignedDropdown, - layoutBehavior: layoutBehavior, - buttonColor: buttonColor, - disabledColor: disabledColor, - focusColor: focusColor, - hoverColor: hoverColor, - highlightColor: highlightColor, - splashColor: splashColor, - colorScheme: colorScheme, - ), - super(key: key, child: child); - - /// Specifies the color and geometry of buttons. - final ButtonThemeData data; - - /// The closest instance of this class that encloses the given context. - /// - /// Typical usage is as follows: - /// - /// ```dart - /// ButtonThemeData theme = ButtonTheme.of(context); - /// ``` - static ButtonThemeData of(BuildContext context) { - final ButtonTheme inheritedButtonTheme = context.dependOnInheritedWidgetOfExactType(); - ButtonThemeData buttonTheme = inheritedButtonTheme?.data; - if (buttonTheme?.colorScheme == null) { // if buttonTheme or buttonTheme.colorScheme is null - final ThemeData theme = Theme.of(context); -// buttonTheme ??= theme.buttonTheme; - if (buttonTheme.colorScheme == null) { - buttonTheme = buttonTheme.copyWith( - colorScheme: theme.buttonTheme.colorScheme ?? theme.colorScheme, - ); - assert(buttonTheme.colorScheme != null); - } - } - return buttonTheme; - } - - @override - Widget wrap(BuildContext context, Widget child) { - final ButtonTheme ancestorTheme = context.findAncestorWidgetOfExactType(); - return identical(this, ancestorTheme) ? child : ButtonTheme.fromButtonThemeData(data: data, child: child); - } - - @override - bool updateShouldNotify(ButtonTheme oldWidget) => data != oldWidget.data; -} - -/// Used with [ButtonTheme] to configure the color and geometry of buttons. -/// -/// A button theme can be specified as part of the overall Material theme -/// using [ThemeData.buttonTheme]. The Material theme's button theme data -/// can be overridden with [ButtonTheme]. -class ButtonThemeData extends Diagnosticable { - /// Create a button theme object that can be used with [ButtonTheme] - /// or [ThemeData]. - /// - /// The [textTheme], [minWidth], [height], [alignedDropDown], and - /// [layoutBehavior] parameters must not be null. The [minWidth] and - /// [height] parameters must greater than or equal to zero. - /// - /// The ButtonTheme's methods that have a [MaterialButton] parameter and - /// have a name with a `get` prefix are used by [RaisedButton], - /// [OutlineButton], and [FlatButton] to configure a [RawMaterialButton]. - const ButtonThemeData({ - this.textTheme = ButtonTextTheme.normal, - this.minWidth = 88.0, - this.height = 36.0, - EdgeInsetsGeometry padding, - ShapeBorder shape, - this.layoutBehavior = ButtonBarLayoutBehavior.padded, - this.alignedDropdown = false, - Color buttonColor, - Color disabledColor, - Color focusColor, - Color hoverColor, - Color highlightColor, - Color splashColor, - this.colorScheme, - MaterialTapTargetSize materialTapTargetSize, - }) : assert(textTheme != null), - assert(minWidth != null && minWidth >= 0.0), - assert(height != null && height >= 0.0), - assert(alignedDropdown != null), - assert(layoutBehavior != null), - _buttonColor = buttonColor, - _disabledColor = disabledColor, - _focusColor = focusColor, - _hoverColor = hoverColor, - _highlightColor = highlightColor, - _splashColor = splashColor, - _padding = padding, - _shape = shape, - _materialTapTargetSize = materialTapTargetSize; - - /// The minimum width for buttons. - /// - /// The actual horizontal space allocated for a button's child is - /// at least this value less the theme's horizontal [padding]. - /// - /// Defaults to 88.0 logical pixels. - final double minWidth; - - /// The minimum height for buttons. - /// - /// Defaults to 36.0 logical pixels. - final double height; - - /// Defines a button's base colors, and the defaults for the button's minimum - /// size, internal padding, and shape. - /// - /// Despite the name, this property is not a [TextTheme], its value is not a - /// collection of [TextStyle]s. - final ButtonTextTheme textTheme; - - /// Defines whether a [ButtonBar] should size itself with a minimum size - /// constraint or with padding. - /// - /// Defaults to [ButtonBarLayoutBehavior.padded]. - final ButtonBarLayoutBehavior layoutBehavior; - - /// Simply a convenience that returns [minWidth] and [height] as a - /// [BoxConstraints] object: - /// - /// ```dart - /// return BoxConstraints( - /// minWidth: minWidth, - /// minHeight: height, - /// ); - /// ``` - BoxConstraints get constraints { - return BoxConstraints( - minWidth: minWidth, - minHeight: height, - ); - } - - /// Padding for a button's child (typically the button's label). - /// - /// Defaults to 24.0 on the left and right if [textTheme] is - /// [ButtonTextTheme.primary], 16.0 on the left and right otherwise. - /// - /// See also: - /// - /// * [getPadding], which is used by [RaisedButton], [OutlineButton] - /// and [FlatButton]. - EdgeInsetsGeometry get padding { - if (_padding != null) - return _padding; - switch (textTheme) { - case ButtonTextTheme.normal: - case ButtonTextTheme.accent: - return const EdgeInsets.symmetric(horizontal: 16.0); - case ButtonTextTheme.primary: - return const EdgeInsets.symmetric(horizontal: 24.0); - } - assert(false); - return EdgeInsets.zero; - } - final EdgeInsetsGeometry _padding; - - /// The shape of a button's material. - /// - /// The button's highlight and splash are clipped to this shape. If the - /// button has an elevation, then its drop shadow is defined by this - /// shape as well. - /// - /// Defaults to a rounded rectangle with circular corner radii of 4.0 if - /// [textTheme] is [ButtonTextTheme.primary], a rounded rectangle with - /// circular corner radii of 2.0 otherwise. - /// - /// See also: - /// - /// * [getShape], which is used by [RaisedButton], [OutlineButton] - /// and [FlatButton]. - ShapeBorder get shape { - if (_shape != null) - return _shape; - switch (textTheme) { - case ButtonTextTheme.normal: - case ButtonTextTheme.accent: - return const RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(2.0)), - ); - case ButtonTextTheme.primary: - return const RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(4.0)), - ); - } - return const RoundedRectangleBorder(); - } - final ShapeBorder _shape; - - /// If true, then a [DropdownButton] menu's width will match the button's - /// width. - /// - /// If false (the default), then the dropdown's menu will be wider than - /// its button. In either case the dropdown button will line up the leading - /// edge of the menu's value with the leading edge of the values - /// displayed by the menu items. - /// - /// This property only affects [DropdownButton] and its menu. - final bool alignedDropdown; - - /// The background fill color for [RaisedButton]s. - /// - /// This property is null by default. - /// - /// If the button is in the focused, hovering, or highlighted state, then the - /// [focusColor], [hoverColor], or [highlightColor] will take precedence over - /// the [focusColor]. - /// - /// See also: - /// - /// * [getFillColor], which is used by [RaisedButton] to compute its - /// background fill color. - final Color _buttonColor; - - /// The background fill color for disabled [RaisedButton]s. - /// - /// This property is null by default. - /// - /// See also: - /// - /// * [getDisabledFillColor], which is used by [RaisedButton] to compute its - /// background fill color. - final Color _disabledColor; - - /// The fill color of the button when it has the input focus. - /// - /// This property is null by default. - /// - /// If the button is in the hovering or highlighted state, then the [hoverColor] - /// or [highlightColor] will take precedence over the [focusColor]. - /// - /// See also: - /// - /// * [getFocusColor], which is used by [RaisedButton], [OutlineButton] - /// and [FlatButton]. - final Color _focusColor; - - /// The fill color of the button when a pointer is hovering over it. - /// - /// This property is null by default. - /// - /// If the button is in the highlighted state, then the [highlightColor] will - /// take precedence over the [hoverColor]. - /// - /// See also: - /// - /// * [getHoverColor], which is used by [RaisedButton], [OutlineButton] - /// and [FlatButton]. - final Color _hoverColor; - - /// The color of the overlay that appears when a button is pressed. - /// - /// This property is null by default. - /// - /// See also: - /// - /// * [getHighlightColor], which is used by [RaisedButton], [OutlineButton] - /// and [FlatButton]. - final Color _highlightColor; - - /// The color of the ink "splash" overlay that appears when a button is tapped. - /// - /// This property is null by default. - /// - /// See also: - /// - /// * [getSplashColor], which is used by [RaisedButton], [OutlineButton] - /// and [FlatButton]. - final Color _splashColor; - - /// A set of thirteen colors that can be used to derive the button theme's - /// colors. - /// - /// This property was added much later than the theme's set of highly - /// specific colors, like [ThemeData.buttonColor], [ThemeData.highlightColor], - /// [ThemeData.splashColor] etc. - /// - /// The colors for new button classes can be defined exclusively in terms - /// of [colorScheme]. When it's possible, the existing buttons will - /// (continue to) gradually migrate to it. - final ColorScheme colorScheme; - - // The minimum size of a button's tap target. - // - // This property is null by default. - // - // See also: - // - // * [getMaterialTargetTapSize], which is used by [RaisedButton], - // [OutlineButton] and [FlatButton]. - final MaterialTapTargetSize _materialTapTargetSize; - - /// The [button]'s overall brightness. - /// - /// Returns the button's [MaterialButton.colorBrightness] if it is non-null, - /// otherwise the color scheme's [ColorScheme.brightness] is returned. - Brightness getBrightness(MaterialButton button) { - return button.colorBrightness ?? colorScheme.brightness; - } - - /// Defines the [button]'s base colors, and the defaults for the button's - /// minimum size, internal padding, and shape. - /// - /// Despite the name, this property is not the [TextTheme] whose - /// [TextTheme.button] is used as the button text's [TextStyle]. - ButtonTextTheme getTextTheme(MaterialButton button) { - return button.textTheme ?? textTheme; - } - - /// The foreground color of the [button]'s text and icon when - /// [MaterialButton.onPressed] is null (when MaterialButton.enabled is false). - /// - /// Returns the button's [MaterialButton.disabledColor] if it is non-null. - /// Otherwise the color scheme's [ColorScheme.onSurface] color is returned - /// with its opacity set to 0.38. - /// - /// If [MaterialButton.textColor] is a [MaterialStateProperty], it will be - /// used as the `disabledTextColor`. It will be resolved in the [MaterialState.disabled] state. - Color getDisabledTextColor(MaterialButton button) { - if (button.textColor is MaterialStateProperty) - return button.textColor; - if (button.disabledTextColor != null) - return button.disabledTextColor; - return colorScheme.onSurface.withOpacity(0.38); - } - - /// The [button]'s background color when [MaterialButton.onPressed] is null - /// (when [MaterialButton.enabled] is false). - /// - /// Returns the button's [MaterialButton.disabledColor] if it is non-null. - /// - /// Otherwise the value of the `disabledColor` constructor parameter - /// is returned, if it is non-null. - /// - /// Otherwise the color scheme's [ColorScheme.onSurface] color is returned - /// with its opacity set to 0.38. - Color getDisabledFillColor(MaterialButton button) { - if (button.disabledColor != null) - return button.disabledColor; - if (_disabledColor != null) - return _disabledColor; - return colorScheme.onSurface.withOpacity(0.38); - } - - /// The button's background fill color or null for buttons that don't have - /// a background color. - /// - /// Returns [MaterialButton.color] if it is non-null and the button - /// is enabled. - /// - /// Otherwise, returns [MaterialButton.disabledColor] if it is non-null and - /// the button is disabled. - /// - /// Otherwise, if button is a [FlatButton] or an [OutlineButton] then null is - /// returned. - /// - /// Otherwise, if button is a [RaisedButton], returns the `buttonColor` - /// constructor parameter if it was non-null and the button is enabled. - /// - /// Otherwise the fill color depends on the value of [getTextTheme]. - /// - /// * [ButtonTextTheme.normal] or [ButtonTextTheme.accent], the - /// color scheme's [ColorScheme.primary] color if the [button] is enabled - /// the value of [getDisabledFillColor] otherwise. - /// * [ButtonTextTheme.primary], if the [button] is enabled then the value - /// of the `buttonColor` constructor parameter if it is non-null, - /// otherwise the color scheme's ColorScheme.primary color. If the button - /// is not enabled then the colorScheme's [ColorScheme.onSurface] color - /// with opacity 0.12. - Color getFillColor(MaterialButton button) { - final Color fillColor = button.enabled ? button.color : button.disabledColor; - if (fillColor != null) - return fillColor; - - if (button is FlatButton || button is OutlineButton || button.runtimeType == MaterialButton) - return null; - - if (button.enabled && button is RaisedButton && _buttonColor != null) - return _buttonColor; - - switch (getTextTheme(button)) { - case ButtonTextTheme.normal: - case ButtonTextTheme.accent: - return button.enabled ? colorScheme.primary : getDisabledFillColor(button); - case ButtonTextTheme.primary: - return button.enabled - ? _buttonColor ?? colorScheme.primary - : colorScheme.onSurface.withOpacity(0.12); - } - - assert(false); - return null; - } - - /// The foreground color of the [button]'s text and icon. - /// - /// If [button] is not [MaterialButton.enabled], the value of - /// [getDisabledTextColor] is returned. If the button is enabled and - /// [buttonTextColor] is non-null, then [buttonTextColor] is returned. - /// - /// Otherwise the text color depends on the value of [getTextTheme] - /// and [getBrightness]. - /// - /// * [ButtonTextTheme.normal]: [Colors.white] is used if [getBrightness] - /// resolves to [Brightness.dark]. [Colors.black87] is used if - /// [getBrightness] resolves to [Brightness.light]. - /// * [ButtonTextTheme.accent]: [colorScheme.secondary]. - /// * [ButtonTextTheme.primary]: If [getFillColor] is dark then [Colors.white], - /// otherwise if [button] is a [FlatButton] or an [OutlineButton] then - /// [colorScheme.primary], otherwise [Colors.black]. - Color getTextColor(MaterialButton button) { - if (!button.enabled) - return getDisabledTextColor(button); - - if (button.textColor != null) - return button.textColor; - - switch (getTextTheme(button)) { - case ButtonTextTheme.normal: - return getBrightness(button) == Brightness.dark ? Colors.white : Colors.black87; - - case ButtonTextTheme.accent: - return colorScheme.secondary; - - case ButtonTextTheme.primary: - final Color fillColor = getFillColor(button); - final bool fillIsDark = fillColor != null - ? ThemeData.estimateBrightnessForColor(fillColor) == Brightness.dark - : getBrightness(button) == Brightness.dark; - if (fillIsDark) - return Colors.white; - if (button is FlatButton || button is OutlineButton) - return colorScheme.primary; - return Colors.black; - } - - assert(false); - return null; - } - - /// The color of the ink "splash" overlay that appears when the (enabled) - /// [button] is tapped. - /// - /// Returns the button's [MaterialButton.splashColor] if it is non-null. - /// - /// Otherwise, returns the value of the `splashColor` constructor parameter - /// it is non-null and [button] is a [RaisedButton] or an [OutlineButton]. - /// - /// Otherwise, returns the value of the `splashColor` constructor parameter - /// if it is non-null and [button] is a [FlatButton] and - /// [getTextTheme] is not [ButtonTextTheme.primary] - /// - /// Otherwise, returns [getTextColor] with an opacity of 0.12. - Color getSplashColor(MaterialButton button) { - if (button.splashColor != null) - return button.splashColor; - - if (_splashColor != null && (button is RaisedButton || button is OutlineButton)) - return _splashColor; - - if (_splashColor != null && button is FlatButton) { - switch (getTextTheme(button)) { - case ButtonTextTheme.normal: - case ButtonTextTheme.accent: - return _splashColor; - case ButtonTextTheme.primary: - break; - } - } - - return getTextColor(button).withOpacity(0.12); - } - - /// The fill color of the button when it has input focus. - /// - /// Returns the button's [MaterialButton.focusColor] if it is non-null. - /// Otherwise the focus color depends on [getTextTheme]: - /// - /// * [ButtonTextTheme.normal], [ButtonTextTheme.accent]: returns the - /// value of the `focusColor` constructor parameter if it is non-null, - /// otherwise the value of [getTextColor] with opacity 0.12. - /// * [ButtonTextTheme.primary], returns [Colors.transparent]. - Color getFocusColor(MaterialButton button) { - return button.focusColor ?? _focusColor ?? getTextColor(button).withOpacity(0.12); - } - - /// The fill color of the button when it has input focus. - /// - /// Returns the button's [MaterialButton.focusColor] if it is non-null. - /// Otherwise the focus color depends on [getTextTheme]: - /// - /// * [ButtonTextTheme.normal], [ButtonTextTheme.accent], - /// [ButtonTextTheme.primary]: returns the value of the `focusColor` - /// constructor parameter if it is non-null, otherwise the value of - /// [getTextColor] with opacity 0.04. - Color getHoverColor(MaterialButton button) { - return button.hoverColor ?? _hoverColor ?? getTextColor(button).withOpacity(0.04); - } - - /// The color of the overlay that appears when the [button] is pressed. - /// - /// Returns the button's [MaterialButton.highlightColor] if it is non-null. - /// Otherwise the highlight color depends on [getTextTheme]: - /// - /// * [ButtonTextTheme.normal], [ButtonTextTheme.accent]: returns the - /// value of the `highlightColor` constructor parameter if it is non-null, - /// otherwise the value of [getTextColor] with opacity 0.16. - /// * [ButtonTextTheme.primary], returns [Colors.transparent]. - Color getHighlightColor(MaterialButton button) { - if (button.highlightColor != null) - return button.highlightColor; - - switch (getTextTheme(button)) { - case ButtonTextTheme.normal: - case ButtonTextTheme.accent: - return _highlightColor ?? getTextColor(button).withOpacity(0.16); - case ButtonTextTheme.primary: - return Colors.transparent; - } - - assert(false); - return Colors.transparent; - } - - /// The [button]'s elevation when it is enabled and has not been pressed. - /// - /// Returns the button's [MaterialButton.elevation] if it is non-null. - /// - /// If button is a [FlatButton] then elevation is 0.0, otherwise it is 2.0. - double getElevation(MaterialButton button) { - if (button.elevation != null) - return button.elevation; - if (button is FlatButton) - return 0.0; - return 2.0; - } - - /// The [button]'s elevation when it is enabled and has focus. - /// - /// Returns the button's [MaterialButton.focusElevation] if it is non-null. - /// - /// If button is a [FlatButton] or an [OutlineButton] then the focus - /// elevation is 0.0, otherwise the highlight elevation is 4.0. - double getFocusElevation(MaterialButton button) { - if (button.focusElevation != null) - return button.focusElevation; - if (button is FlatButton) - return 0.0; - if (button is OutlineButton) - return 0.0; - return 4.0; - } - - /// The [button]'s elevation when it is enabled and has focus. - /// - /// Returns the button's [MaterialButton.hoverElevation] if it is non-null. - /// - /// If button is a [FlatButton] or an [OutlineButton] then the hover - /// elevation is 0.0, otherwise the highlight elevation is 4.0. - double getHoverElevation(MaterialButton button) { - if (button.hoverElevation != null) - return button.hoverElevation; - if (button is FlatButton) - return 0.0; - if (button is OutlineButton) - return 0.0; - return 4.0; - } - - /// The [button]'s elevation when it is enabled and has been pressed. - /// - /// Returns the button's [MaterialButton.highlightElevation] if it is non-null. - /// - /// If button is a [FlatButton] or an [OutlineButton] then the highlight - /// elevation is 0.0, otherwise the highlight elevation is 8.0. - double getHighlightElevation(MaterialButton button) { - if (button.highlightElevation != null) - return button.highlightElevation; - if (button is FlatButton) - return 0.0; - if (button is OutlineButton) - return 0.0; - return 8.0; - } - - /// The [button]'s elevation when [MaterialButton.onPressed] is null (when - /// MaterialButton.enabled is false). - /// - /// Returns the button's [MaterialButton.elevation] if it is non-null. - /// - /// Otherwise the disabled elevation is 0.0. - double getDisabledElevation(MaterialButton button) { - if (button.disabledElevation != null) - return button.disabledElevation; - return 0.0; - } - - /// Padding for the [button]'s child (typically the button's label). - /// - /// Returns the button's [MaterialButton.padding] if it is non-null. - /// - /// If this is a button constructed with [RaisedButton.icon] or - /// [FlatButton.icon] or [OutlineButton.icon] then the padding is: - /// `EdgeInsetsDirectional.only(start: 12.0, end: 16.0)`. - /// - /// Otherwise, returns [padding] if it is non-null. - /// - /// Otherwise, returns horizontal padding of 24.0 on the left and right if - /// [getTextTheme] is [ButtonTextTheme.primary], 16.0 on the left and right - /// otherwise. - EdgeInsetsGeometry getPadding(MaterialButton button) { - if (button.padding != null) - return button.padding; - - if (button is MaterialButtonWithIconMixin) - return const EdgeInsetsDirectional.only(start: 12.0, end: 16.0); - - if (_padding != null) - return _padding; - - switch (getTextTheme(button)) { - case ButtonTextTheme.normal: - case ButtonTextTheme.accent: - return const EdgeInsets.symmetric(horizontal: 16.0); - case ButtonTextTheme.primary: - return const EdgeInsets.symmetric(horizontal: 24.0); - } - assert(false); - return EdgeInsets.zero; - } - - /// The shape of the [button]'s [Material]. - /// - /// Returns the button's [MaterialButton.shape] if it is non-null, otherwise - /// [shape] is returned. - ShapeBorder getShape(MaterialButton button) { - return button.shape ?? shape; - } - - /// The duration of the [button]'s highlight animation. - /// - /// Returns the button's [MaterialButton.animationDuration] it if is non-null, - /// otherwise 200ms. - Duration getAnimationDuration(MaterialButton button) { - return button.animationDuration ?? kThemeChangeDuration; - } - - /// The [BoxConstraints] that the define the [button]'s size. - /// - /// By default this method just returns [constraints]. Subclasses - /// could override this method to return a value that was, - /// for example, based on the button's type. - BoxConstraints getConstraints(MaterialButton button) => constraints; - - /// The minimum size of the [button]'s tap target. - /// - /// Returns the button's [MaterialButton.tapTargetSize] if it is non-null. - /// - /// Otherwise the value of the [materialTapTargetSize] constructor - /// parameter is returned if that's non-null. - /// - /// Otherwise [MaterialTapTargetSize.padded] is returned. - MaterialTapTargetSize getMaterialTapTargetSize(MaterialButton button) { - return button.materialTapTargetSize ?? _materialTapTargetSize ?? MaterialTapTargetSize.padded; - } - - /// Creates a copy of this button theme data object with the matching fields - /// replaced with the non-null parameter values. - ButtonThemeData copyWith({ - ButtonTextTheme textTheme, - ButtonBarLayoutBehavior layoutBehavior, - double minWidth, - double height, - EdgeInsetsGeometry padding, - ShapeBorder shape, - bool alignedDropdown, - Color buttonColor, - Color disabledColor, - Color focusColor, - Color hoverColor, - Color highlightColor, - Color splashColor, - ColorScheme colorScheme, - MaterialTapTargetSize materialTapTargetSize, - }) { - return ButtonThemeData( - textTheme: textTheme ?? this.textTheme, - layoutBehavior: layoutBehavior ?? this.layoutBehavior, - minWidth: minWidth ?? this.minWidth, - height: height ?? this.height, - padding: padding ?? this.padding, - shape: shape ?? this.shape, - alignedDropdown: alignedDropdown ?? this.alignedDropdown, - buttonColor: buttonColor ?? _buttonColor, - disabledColor: disabledColor ?? _disabledColor, - focusColor: focusColor ?? _focusColor, - hoverColor: hoverColor ?? _hoverColor, - highlightColor: highlightColor ?? _highlightColor, - splashColor: splashColor ?? _splashColor, - colorScheme: colorScheme ?? this.colorScheme, - materialTapTargetSize: materialTapTargetSize ?? _materialTapTargetSize, - ); - } - - @override - bool operator ==(dynamic other) { - if (other.runtimeType != runtimeType) - return false; - final ButtonThemeData typedOther = other; - return textTheme == typedOther.textTheme - && minWidth == typedOther.minWidth - && height == typedOther.height - && padding == typedOther.padding - && shape == typedOther.shape - && alignedDropdown == typedOther.alignedDropdown - && _buttonColor == typedOther._buttonColor - && _disabledColor == typedOther._disabledColor - && _focusColor == typedOther._focusColor - && _hoverColor == typedOther._hoverColor - && _highlightColor == typedOther._highlightColor - && _splashColor == typedOther._splashColor - && colorScheme == typedOther.colorScheme - && _materialTapTargetSize == typedOther._materialTapTargetSize; - } - - @override - int get hashCode { - return hashValues( - textTheme, - minWidth, - height, - padding, - shape, - alignedDropdown, - _buttonColor, - _disabledColor, - _focusColor, - _hoverColor, - _highlightColor, - _splashColor, - colorScheme, - _materialTapTargetSize, - ); - } - - @override - void debugFillProperties(DiagnosticPropertiesBuilder properties) { - super.debugFillProperties(properties); - const ButtonThemeData defaultTheme = ButtonThemeData(); - properties.add(EnumProperty('textTheme', textTheme, defaultValue: defaultTheme.textTheme)); - properties.add(DoubleProperty('minWidth', minWidth, defaultValue: defaultTheme.minWidth)); - properties.add(DoubleProperty('height', height, defaultValue: defaultTheme.height)); - properties.add(DiagnosticsProperty('padding', padding, defaultValue: defaultTheme.padding)); - properties.add(DiagnosticsProperty('shape', shape, defaultValue: defaultTheme.shape)); - properties.add(FlagProperty('alignedDropdown', - value: alignedDropdown, - defaultValue: defaultTheme.alignedDropdown, - ifTrue: 'dropdown width matches button', - )); - properties.add(ColorProperty('buttonColor', _buttonColor, defaultValue: null)); - properties.add(ColorProperty('disabledColor', _disabledColor, defaultValue: null)); - properties.add(ColorProperty('focusColor', _focusColor, defaultValue: null)); - properties.add(ColorProperty('hoverColor', _hoverColor, defaultValue: null)); - properties.add(ColorProperty('highlightColor', _highlightColor, defaultValue: null)); - properties.add(ColorProperty('splashColor', _splashColor, defaultValue: null)); - properties.add(DiagnosticsProperty('colorScheme', colorScheme, defaultValue: defaultTheme.colorScheme)); - properties.add(DiagnosticsProperty('materialTapTargetSize', _materialTapTargetSize, defaultValue: null)); - } -} diff --git a/lib/components/button/gf_social_button.dart b/lib/components/button/gf_social_button.dart new file mode 100644 index 00000000..406247e7 --- /dev/null +++ b/lib/components/button/gf_social_button.dart @@ -0,0 +1,274 @@ +import 'dart:math' as math; +import 'package:flutter/foundation.dart'; +import 'package:flutter/gestures.dart'; +import 'package:flutter/rendering.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter/material.dart'; +import 'package:ui_kit/components/button/gf_button.dart'; +import 'package:ui_kit/shape/gf_button_shape.dart'; +import 'package:ui_kit/size/gf_size.dart'; +import 'package:ui_kit/types/gf_type.dart'; +import 'package:ui_kit/position/gf_position.dart'; +import 'package:ui_kit/colors/gf_color.dart'; + +class GFSocialButton extends GFButton{ + /// Called when the button is tapped or otherwise activated. + final VoidCallback onPressed; + + /// Called by the underlying [InkWell] widget's [InkWell.onHighlightChanged] callback. + final ValueChanged onHighlightChanged; + + /// Defines the default text style, with [Material.textStyle], for the button's [child]. + final TextStyle textStyle; + + /// The border side for the button's [Material]. + final BorderSide borderSide; + + /// The box shadow for the button's [Material]. + final BoxShadow boxShadow; + + /// Pass [GFColor] or [Color]. The color for the button's [Material] when it has the input focus. + final dynamic focusColor; + + /// Pass [GFColor] or [Color]. The color for the button's [Material] when a pointer is hovering over it. + final dynamic hoverColor; + + /// Pass [GFColor] or [Color]. The highlight color for the button's [InkWell]. + final dynamic highlightColor; + + /// Pass [GFColor] or [Color]. The splash color for the button's [InkWell]. + final dynamic splashColor; + + /// The elevation for the button's [Material] when the button is [enabled] but not pressed. + final double elevation; + + /// The elevation for the button's [Material] when the button is [enabled] and a pointer is hovering over it. + final double hoverElevation; + + /// The elevation for the button's [Material] when the button is [enabled] and has the input focus. + final double focusElevation; + + /// The elevation for the button's [Material] when the button is [enabled] and pressed. + final double highlightElevation; + + /// The elevation for the button's [Material] when the button is not [enabled]. + final double disabledElevation; + + /// The internal padding for the button's [child]. + final EdgeInsetsGeometry padding; + + /// Defines the button's size. + final BoxConstraints constraints; + + /// The shape of the button's [Material]. + final ShapeBorder borderShape; + + /// Defines the duration of animated changes for [shape] and [elevation]. + final Duration animationDuration; + + /// Typically the button's label. + final Widget child; + + /// Whether the button is enabled or disabled. + bool get enabled => onPressed != null; + + /// Configures the minimum size of the tap target. + final MaterialTapTargetSize materialTapTargetSize; + + /// {@macro flutter.widgets.Focus.focusNode} + final FocusNode focusNode; + + /// {@macro flutter.widgets.Focus.autofocus} + final bool autofocus; + + /// {@macro flutter.widgets.Clip} + final Clip clipBehavior; + + /// Button type of [GFType] i.e, solid, outline, outline2x, transparent + final GFType type; + + /// Button type of [GFSocialButtonShape] i.e, standard, pills, square, shadow, icons + final GFButtonShape shape; + + /// Pass [GFColor] or [Color] + final dynamic color; + + /// The fill color of the button when the button is disabled. + /// + /// The default value of this color is the theme's disabled color, + /// [ThemeData.disabledColor]. + /// + /// See also: + /// + /// * [color] - the fill color of the button when the button is [enabled]. + final dynamic disabledColor; + + /// Pass [GFColor] or [Color] + final dynamic textColor; + + /// The color to use for this button's text when the button is disabled. + /// + /// The button's [Material.textStyle] will be the current theme's button + /// text style, [ThemeData.textTheme.button], configured with this color. + /// + /// The default value is the theme's disabled color, + /// [ThemeData.disabledColor]. + /// + /// If [textColor] is a [MaterialStateProperty], [disabledTextColor] + /// will be ignored. + /// + /// See also: + /// + /// * [textColor] - The color to use for this button's text when the button is [enabled]. + final dynamic disabledTextColor; + + /// size of [double] or [GFSize] i.e, 1.2, small, medium, large etc. + final dynamic size; + + /// text of type [String] is alternative to child. text will get priority over child + final String text; + + /// icon of type [Widget] + final Widget icon; + + /// icon type of [GFIconPosition] i.e, start, end + final GFPosition position; + + /// on true state blockButton gives block size button + final bool blockButton; + + /// on true state full width Button gives full width button + final bool fullWidthButton; + + /// on true state default box shadow appears around button + final bool buttonBoxShadow; + + /// A set of thirteen colors that can be used to derive the button theme's + /// colors. + /// + /// This property was added much later than the theme's set of highly + /// specific colors, like [ThemeData.buttonColor], [ThemeData.highlightColor], + /// [ThemeData.splashColor] etc. + /// + /// The colors for new button classes can be defined exclusively in terms + /// of [colorScheme]. When it's possible, the existing buttons will + /// (continue to) gradually migrate to it. + final ColorScheme colorScheme; + + /// Whether detected gestures should provide acoustic and/or haptic feedback. + /// + /// For example, on Android a tap will produce a clicking sound and a + /// long-press will produce a short vibration, when feedback is enabled. + /// + /// See also: + /// + /// * [Feedback] for providing platform-specific feedback to certain actions. + final bool enableFeedback; + + /// Called when the button is long-pressed. + /// + /// If this callback and [onPressed] are null, then the button will be disabled. + /// + /// See also: + /// + /// * [enabled], which is true if the button is enabled. + final VoidCallback onLongPress; + + /// Create buttons of all types. check out [GFIconButton] for icon buttons, and [GFBadge] for badges + const GFSocialButton( + {Key key, + @required this.onPressed, + this.onHighlightChanged, + this.textStyle, + this.boxShadow, + this.buttonBoxShadow, + this.focusColor, + this.hoverColor, + this.highlightColor, + this.splashColor, + this.elevation = 0.0, + this.focusElevation = 4.0, + this.hoverElevation = 4.0, + this.highlightElevation = 1.0, + this.disabledElevation = 0.0, + this.padding = const EdgeInsets.symmetric(horizontal: 8.0), + this.constraints, + this.borderShape, + this.animationDuration = kThemeChangeDuration, + this.clipBehavior = Clip.none, + this.focusNode, + this.autofocus = false, + MaterialTapTargetSize materialTapTargetSize, + this.child, + this.type = GFType.solid, + this.shape = GFButtonShape.standard, + this.color = GFColor.primary, + this.textColor, + this.position = GFPosition.start, + this.size = GFSize.medium, + this.borderSide, + this.text, + this.icon, + this.blockButton, + this.fullWidthButton, + this.colorScheme, + this.enableFeedback, + this.onLongPress, + this.disabledColor, + this.disabledTextColor, + }) + : materialTapTargetSize = + materialTapTargetSize ?? MaterialTapTargetSize.padded, + assert(shape != null, 'Button shape can not be null'), +// assert(elevation != null && elevation >= 0.0), + assert(focusElevation != null && focusElevation >= 0.0), + assert(hoverElevation != null && hoverElevation >= 0.0), + assert(highlightElevation != null && highlightElevation >= 0.0), + assert(disabledElevation != null && disabledElevation >= 0.0), + assert(padding != null), + assert(animationDuration != null), + assert(clipBehavior != null), + assert(autofocus != null); + + @override + Widget build(BuildContext context) { + return GFButton( + onPressed: onPressed, + onHighlightChanged: onHighlightChanged, + textStyle: textStyle, + boxShadow: boxShadow, + buttonBoxShadow: buttonBoxShadow, + focusColor: focusColor, + hoverColor: hoverColor, + highlightColor: highlightColor, + splashColor: splashColor, + elevation: elevation, + focusElevation: focusElevation, + hoverElevation: hoverElevation, + highlightElevation:highlightElevation, + disabledElevation: disabledElevation, + constraints: constraints, + borderShape: borderShape, + animationDuration: animationDuration, + clipBehavior: clipBehavior, + focusNode: focusNode, + autofocus : autofocus , + child: child, + type :GFType.solid, + shape :GFButtonShape.standard, + color :GFColor.primary, + textColor: textColor, + position :GFPosition.start, + size :GFSize.medium, + borderSide: borderSide, + text: text, + icon: icon, + blockButton: blockButton, + fullWidthButton: fullWidthButton, + disabledColor: disabledTextColor, + disabledTextColor: disabledColor, + ); + } +} + + diff --git a/lib/components/slider/gf_slider.dart b/lib/components/carousel/gf_carousel.dart similarity index 95% rename from lib/components/slider/gf_slider.dart rename to lib/components/carousel/gf_carousel.dart index 52304775..31b28426 100644 --- a/lib/components/slider/gf_slider.dart +++ b/lib/components/carousel/gf_carousel.dart @@ -9,8 +9,8 @@ List map(List list, Function handler) { return result; } -class GFSlider extends StatefulWidget { - GFSlider( +class GFCarousel extends StatefulWidget { + GFCarousel( {@required this.items, this.pagerSize, this.passiveIndicator, @@ -53,7 +53,7 @@ class GFSlider extends StatefulWidget { /// The slider pagination's passive color. final Color passiveIndicator; - /// The [GFSlider] shows pagination on state true. + /// The [GFCarousel] shows pagination on state true. final bool pagination; /// The widgets to be shown as sliders. @@ -68,7 +68,7 @@ class GFSlider extends StatefulWidget { /// The fraction of the viewport that each page should occupy. Defaults to 0.8, which means each page fills 80% of the slide. final num viewportFraction; - /// The initial page to show when first creating the [GFSlider]. Defaults to 0. + /// The initial page to show when first creating the [GFCarousel]. Defaults to 0. final num initialPage; /// The actual index of the [PageView]. @@ -120,7 +120,7 @@ class GFSlider extends StatefulWidget { /// and can be used to control the [PageView] it is passed to. final PageController pageController; - /// Animates the controlled [GFSlider] to the next page. + /// Animates the controlled [GFCarousel] to the next page. /// /// The animation lasts for the given duration and follows the given curve. /// The returned [Future] resolves when the animation completes. @@ -128,7 +128,7 @@ class GFSlider extends StatefulWidget { return pageController.nextPage(duration: duration, curve: curve); } - /// Animates the controlled [GFSlider] to the previous page. + /// Animates the controlled [GFCarousel] to the previous page. /// /// The animation lasts for the given duration and follows the given curve. /// The returned [Future] resolves when the animation completes. @@ -136,7 +136,7 @@ class GFSlider extends StatefulWidget { return pageController.previousPage(duration: duration, curve: curve); } - /// Changes which page is displayed in the controlled [GFSlider]. + /// Changes which page is displayed in the controlled [GFCarousel]. /// /// Jumps the page position from its current value to the given value, /// without animation, and without checking if the new value is in range. @@ -147,7 +147,7 @@ class GFSlider extends StatefulWidget { .jumpToPage(pageController.page.toInt() + page - index); } - /// Animates the controlled [GFSlider] from the current page to the given page. + /// Animates the controlled [GFCarousel] from the current page to the given page. /// /// The animation lasts for the given duration and follows the given curve. /// The returned [Future] resolves when the animation completes. @@ -161,10 +161,10 @@ class GFSlider extends StatefulWidget { } @override - _GFSliderState createState() => _GFSliderState(); + _GFCarouselState createState() => _GFCarouselState(); } -class _GFSliderState extends State with TickerProviderStateMixin { +class _GFCarouselState extends State with TickerProviderStateMixin { Timer timer; /// Size of cell diff --git a/lib/components/slider/gf_items_slider.dart b/lib/components/carousel/gf_items_carousel.dart similarity index 90% rename from lib/components/slider/gf_items_slider.dart rename to lib/components/carousel/gf_items_carousel.dart index e54d32d1..8a55b837 100644 --- a/lib/components/slider/gf_items_slider.dart +++ b/lib/components/carousel/gf_items_carousel.dart @@ -8,7 +8,7 @@ import 'package:flutter/material.dart'; /// /// The `details` object provides the position of the touch when it first /// touched the surface. -typedef GFItemsSliderSlideStartCallback = void Function( +typedef GFItemsCarouselSlideStartCallback = void Function( DragStartDetails details); /// Signature for when a pointer that is in contact with the screen and moving @@ -16,14 +16,14 @@ typedef GFItemsSliderSlideStartCallback = void Function( /// /// The `details` object provides the position of the touch and the distance it /// has travelled since the last update. -typedef GFItemsSliderSlideCallback = void Function(DragUpdateDetails details); +typedef GFItemsCarouselSlideCallback = void Function(DragUpdateDetails details); /// Signature for when a pointer that was previously in contact with the screen /// and moving is no longer in contact with the screen. /// /// The velocity at which the pointer was moving when it stopped contacting /// the screen is available in the `details`. -typedef GFItemsSliderSlideEndCallback = void Function(DragEndDetails details); +typedef GFItemsCarouselSlideEndCallback = void Function(DragEndDetails details); /// A widget that show draggable cells with animation. /// @@ -32,24 +32,24 @@ typedef GFItemsSliderSlideEndCallback = void Function(DragEndDetails details); /// Set drag handlers [onSlideStart], [onSlide], [onSlideEnd] /// /// Set left/right arrows [leftArrow], [rightArrow] -class GFItemsSlider extends StatefulWidget { +class GFItemsCarousel extends StatefulWidget { /// Count of visible cells final int rowCount; final List children; /// Signature for when a pointer has contacted the screen and has begun to move. - final GFItemsSliderSlideStartCallback onSlideStart; + final GFItemsCarouselSlideStartCallback onSlideStart; /// Signature for when a pointer that is in contact with the screen and moving /// has moved again. - final GFItemsSliderSlideCallback onSlide; + final GFItemsCarouselSlideCallback onSlide; /// Signature for when a pointer that was previously in contact with the screen /// and moving is no longer in contact with the screen. - final GFItemsSliderSlideEndCallback onSlideEnd; + final GFItemsCarouselSlideEndCallback onSlideEnd; - GFItemsSlider( + GFItemsCarousel( {this.rowCount, this.children, this.onSlideStart, @@ -57,10 +57,10 @@ class GFItemsSlider extends StatefulWidget { this.onSlideEnd}); @override - _GFItemsSliderState createState() => new _GFItemsSliderState(); + _GFItemsCarouselState createState() => new _GFItemsCarouselState(); } -class _GFItemsSliderState extends State +class _GFItemsCarouselState extends State with TickerProviderStateMixin { /// In milliseconds static final int dragAnimationDuration = 1000; diff --git a/lib/components/tabs/gf_segment_tabs.dart b/lib/components/tabs/gf_segment_tabs.dart index 06b98a34..5ac6badc 100644 --- a/lib/components/tabs/gf_segment_tabs.dart +++ b/lib/components/tabs/gf_segment_tabs.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/widgets.dart'; +import 'package:ui_kit/colors/gf_color.dart'; import 'package:ui_kit/components/tabs/gf_tabBarView.dart'; @@ -166,15 +167,15 @@ class _GFSegmentTabsState extends State { width: widget.width == null ? 240.0 : widget.width, decoration: BoxDecoration( border: widget.border == null ? Border.all(color: Colors.black26, width: 2.0) : widget.border, - borderRadius: widget.borderRadius == null ? BorderRadius.circular(8.0) : widget.borderRadius, + borderRadius: widget.borderRadius == null ? BorderRadius.circular(4.0) : widget.borderRadius, ), child: DefaultTabController( initialIndex: widget.initialIndex, length: widget.length, child: Material( - borderRadius: widget.borderRadius == null ? BorderRadius.circular(8.0) : widget.borderRadius, + borderRadius: widget.borderRadius == null ? BorderRadius.circular(2.0) : widget.borderRadius, type: MaterialType.button, - color: widget.tabBarColor ?? Colors.transparent, + color: widget.tabBarColor ?? getGFColor(GFColor.primary), child: TabBar( controller: widget.tabController, labelColor: widget.labelColor, @@ -185,9 +186,9 @@ class _GFSegmentTabsState extends State { indicatorSize: widget.indicatorSize, indicator: widget.indicator == null ? BoxDecoration( - color: widget.indicatorColor == null ? Colors.blueGrey : widget.indicatorColor, - border: Border.all(color: widget.indicatorColor == null ? Colors.blueGrey : widget.indicatorColor, width: 2.0), - borderRadius: widget.borderRadius == null ? BorderRadius.circular(6.0) : widget.borderRadius, + color: widget.indicatorColor == null ? Colors.black26 : widget.indicatorColor, + border: Border.all(color: widget.indicatorColor == null ? Colors.transparent : widget.indicatorColor, width: 2.0), + borderRadius: widget.borderRadius == null ? BorderRadius.circular(4.0) : widget.borderRadius, ) : widget.indicator, indicatorPadding: widget.indicatorPadding, indicatorWeight: widget.indicatorWeight, diff --git a/lib/components/tabs/gf_tabs.dart b/lib/components/tabs/gf_tabs.dart index b1e17584..5d3a7729 100644 --- a/lib/components/tabs/gf_tabs.dart +++ b/lib/components/tabs/gf_tabs.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/widgets.dart'; +import 'package:ui_kit/colors/gf_color.dart'; import 'package:ui_kit/components/tabs/gf_tabBarView.dart'; class GFTabs extends StatefulWidget { @@ -161,7 +162,7 @@ class _GFTabsState extends State { children: [ Material( type: MaterialType.button, - color: widget.tabBarColor ?? Theme.of(context).primaryColor, + color: widget.tabBarColor ?? getGFColor(GFColor.primary), child: TabBar( labelColor: widget.labelColor, unselectedLabelColor: widget.unselectedLabelColor, diff --git a/lib/components/header/gf_header.dart b/lib/components/typography/gf_typography.dart similarity index 86% rename from lib/components/header/gf_header.dart rename to lib/components/typography/gf_typography.dart index 7dddbdd6..389112db 100644 --- a/lib/components/header/gf_header.dart +++ b/lib/components/typography/gf_typography.dart @@ -1,11 +1,11 @@ import 'package:flutter/material.dart'; import 'package:ui_kit/colors/gf_color.dart'; -import 'package:ui_kit/types/gf_heading_type.dart'; +import 'package:ui_kit/types/gf_typography_type.dart'; -class GFHeader extends StatelessWidget { - const GFHeader( +class GFTypography extends StatelessWidget { + const GFTypography( {Key key, - this.type = GFHeadingType.typo4, + this.type = GFTypographyType.typo4, this.child, this.text, this.icon, @@ -49,32 +49,32 @@ class GFHeader extends StatelessWidget { ///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] + ///backgroundImage of type [ImageProvider] to set the background of [GFTypography] final ImageProvider backgroundImage; - ///backgroundImagecolorFilter of type [ColorFilter] to set the background color of [GFHeader] only when backgroundImage is available + ///backgroundImagecolorFilter of type [ColorFilter] to set the background color of [GFTypography] only when backgroundImage is available final ColorFilter backgroundImagecolorFilter; - /// header type of [GFHeaderType] i.e, typo1, typo2, typo3, typo4, typo5, typo6 - final GFHeadingType type; + /// header type of [GFTypographyType] i.e, typo1, typo2, typo3, typo4, typo5, typo6 + final GFTypographyType type; @override Widget build(BuildContext context) { double fontSize; - if(type == GFHeadingType.typo1){ + if(type == GFTypographyType.typo1){ fontSize = 25.0; - }else if(type == GFHeadingType.typo2){ + }else if(type == GFTypographyType.typo2){ fontSize = 22.0; - }else if (type == GFHeadingType.typo3){ + }else if (type == GFTypographyType.typo3){ fontSize = 19.0; - }else if(type == GFHeadingType.typo4){ + }else if(type == GFTypographyType.typo4){ fontSize = 17.0; - }else if (type == GFHeadingType.typo5){ + }else if (type == GFTypographyType.typo5){ fontSize = 15.0; - }else if(type == GFHeadingType.typo6){ + }else if(type == GFTypographyType.typo6){ fontSize = 13.0; } diff --git a/lib/types/gf_heading_type.dart b/lib/types/gf_heading_type.dart deleted file mode 100644 index 23d7cdc6..00000000 --- a/lib/types/gf_heading_type.dart +++ /dev/null @@ -1 +0,0 @@ -enum GFHeadingType { typo1, typo2, typo3, typo4, typo5, typo6 } \ No newline at end of file diff --git a/lib/types/gf_typography_type.dart b/lib/types/gf_typography_type.dart new file mode 100644 index 00000000..ddcd579d --- /dev/null +++ b/lib/types/gf_typography_type.dart @@ -0,0 +1 @@ +enum GFTypographyType { typo1, typo2, typo3, typo4, typo5, typo6 } \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index 210e5914..72d09fbf 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,3 +16,4 @@ dev_dependencies: sdk: flutter flutter: + uses-material-design: true