diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..f964b4d8 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: # Replace with a single Patreon username +open_collective: getflutter +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/.gitignore b/.gitignore index 1f62091d..1978a178 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,8 @@ .pub/ build/ web/ +getflutter-app-kit +getflutter-web-kit # Android related **/android/**/gradle-wrapper.jar diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..1b20de2f --- /dev/null +++ b/.travis.yml @@ -0,0 +1,28 @@ +os: + - linux + +sudo: false + +git: + depth: 3 + +cache: + directories: + - $HOME/.pub-cache + +env: + - FLUTTER_VERSION=stable + +# Only building master means that we don't run two builds for each pull request. +branches: + only: [master] + +before_script: + - cd ../ + - git clone https://github.com/flutter/flutter.git -b $FLUTTER_VERSION + - ./flutter/bin/flutter doctor + - cd getflutter/ + +script: + - ./../flutter/bin/flutter analyze . + - ./../flutter/bin/cache/dart-sdk/bin/dartfmt --dry-run lib diff --git a/CHANGELOG.md b/CHANGELOG.md index d9b8506a..76fd3434 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,38 @@ # Changelog + +## 1.0.0 - 2020-01-20 + +### Added +* Stable version release +* code refectoring +* this release includes following stable components + - GFAvatar + - GFButton + - GFIconButton + - GFButtonBar + - GFBadge + - GFButtonBadge + - GFIconBadge + - GFCard + - GFCarousel + - GFImageOverlay + - GFListTile + - GFTabs + - GFTypography + + +## 1.0.0-dev.9 - 2020-01-17 + +### Added +* Added library exports for commonly used files. + + +## 1.0.0-dev.8 - 2020-01-16 + +### Fixed +* ListTile re-implemeted. + ## 1.0.0-dev.3 - 2020-01-15 ### Fixed diff --git a/README.md b/README.md index 743a18a2..45ac9a45 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,13 @@ +[![pub package](https://img.shields.io/pub/v/getflutter.svg)](https://pub.dartlang.org/packages/getflutter) [![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=102)](https://opensource.org/licenses/MIT) [![License](https://img.shields.io/badge/license-MIT-orange.svg)](https://github.com/ionicfirebaseapp/getflutter/blob/master/LICENSE) [![Say Thanks!](https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg)](https://www.getflutter.dev) [![Twitter Follow](https://img.shields.io/twitter/follow/getflutterdev.svg?style=social)](https://twitter.com/getflutterdev) + +

- + Get Flutter

-[**GetFlutter**](https://www.getflutter.dev) is a 100% Free Flutter open source UI library that is build to make flutter development easier than ever. GetFlutter has 1000+ pre-build widgets that you could reuse to build both Flutter Web or Mobile app development. +[**GetFlutter**](https://www.getflutter.dev) is a 100% Free Flutter open-source UI library that is built to make flutter development easier and joyful than ever. GetFlutter has 1000+ pre-build widgets that you could reuse to build both Flutter mobile app and web app development. Our motto to provide the best Flutter UI library to Flutter community to speed up their development process and build awesome apps with pre-build Flutter Library Components. ## Table of contents @@ -13,7 +16,6 @@ - [Features](#features) - [Demo](#demo) - [Contributing](#contributing) -- [Bugs and feature requests](#bugs-and-feature-requests) - [Documentation](#documentation) - [Copyright and license](#copyright-and-license) @@ -33,27 +35,35 @@ Forum [Support and discussion ](https://forum.getflutter.dev) ## Features In this beta release we are going to launch the library with following components : - #### Button | Badge | Avatar | Image | Card | Carousel | Tile | Tab | Typography + #### [Button](https://docs.getflutter.dev/gf-button) | [Badge](https://docs.getflutter.dev/gf-badge) | [Avatar](https://docs.getflutter.dev/gf-avatar) | [Image](https://docs.getflutter.dev/gf-image) | [Card](https://docs.getflutter.dev/gf-card) | [Carousel](https://docs.getflutter.dev/gf-carousel) | [Tile](https://docs.getflutter.dev/gf-tile) | [Tab](https://docs.getflutter.dev/gf-tab) | [Typography](https://docs.getflutter.dev/gf-typography) ## Demo - Coming Soon + ### Play Store +

+ + Get Flutter playstore Demo + +

+ + ### IOS Store and Web Demo + Coming Soon ## Contributing - GetFlutter is **100% free** and **open source**. We encourage and support an active, healthy community that accepts contributions from the public – including you! - + GetFlutter is **100% free** and **open source**. We encourage and support an active, healthy community that accepts contributions from the public – including you. There are couple of ways in which you can contribute to the growing community of `getflutter`. + + * Pick up any issue marked with ["good first issue"](https://github.com/ionicfirebaseapp/getflutter/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) + * Fix a bug + * Write and improve some **documentation**. Documentation is very critical to us. We would like to if you can support to add support in multiple language for our docs. * If you are a developer, feel free to check out the source and submit pull requests. * Dig into [**CONTRIBUTING.MD**](CONTRIBUTING.md), which covers submitting bugs, requesting new features, preparing your code for a pull request, etc. * Please don't forget to **like**, **follow**, and **star our repo**! Join our growing [community](http://forum.getflutter.dev) to keep up to date with the latest Get Flutter development. * Not sure what to work on? [**We've got lots ideas.**](https://roadmap.getflutter.dev) - ## Bugs-and-feature-requests - - ## Documentation [**Installation Guide**](https://docs.getflutter.dev) @@ -72,4 +82,4 @@ Instagram: ## Copyright-and-license - Code and documentation copyright 2017-2020 the [GETFLUTTER Authors](https://www.getflutter.dev) and [PIETECH SOLUTION PVT LTD.](https://pietechsolution.com) Code released under the [MIT License]. Docs released under [Creative Commons](https://creativecommons.org/licenses/by/3.0/). + Code and documentation copyright 2017-2020 the [GETFLUTTER Authors](https://www.getflutter.dev) and [IONICFIREBASEAPP](https://ionicfirebaseapp.com) Code released under the [MIT License]. Docs released under [Creative Commons](https://creativecommons.org/licenses/by/3.0/). diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 15c1ba65..334d1b95 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -7,7 +7,7 @@ FlutterApplication and put your custom class here. --> + + #19CA4B + \ No newline at end of file diff --git a/example/ios/Runner/Assets.xcassets/Contents.json b/example/ios/Runner/Assets.xcassets/Contents.json new file mode 100644 index 00000000..0bedcf2f --- /dev/null +++ b/example/ios/Runner/Assets.xcassets/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage.png b/example/ios/Runner/Assets.xcassets/LaunchImage.png new file mode 100644 index 00000000..9da19eac Binary files /dev/null and b/example/ios/Runner/Assets.xcassets/LaunchImage.png differ diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage@2x.png b/example/ios/Runner/Assets.xcassets/LaunchImage@2x.png new file mode 100644 index 00000000..9da19eac Binary files /dev/null and b/example/ios/Runner/Assets.xcassets/LaunchImage@2x.png differ diff --git a/example/ios/Runner/Assets.xcassets/LaunchImage@3x.png b/example/ios/Runner/Assets.xcassets/LaunchImage@3x.png new file mode 100644 index 00000000..9da19eac Binary files /dev/null and b/example/ios/Runner/Assets.xcassets/LaunchImage@3x.png differ diff --git a/example/ios/Runner/Assets.xcassets/README.md b/example/ios/Runner/Assets.xcassets/README.md new file mode 100644 index 00000000..89c2725b --- /dev/null +++ b/example/ios/Runner/Assets.xcassets/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/example/ios/Runner/Info.plist b/example/ios/Runner/Info.plist index 2ea12e65..2fcbb3fb 100644 --- a/example/ios/Runner/Info.plist +++ b/example/ios/Runner/Info.plist @@ -11,7 +11,7 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleName - getflutter_example + GetFlutter CFBundlePackageType APPL CFBundleShortVersionString diff --git a/example/lib/main.dart b/example/lib/main.dart index 5234dea5..9120c9cf 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -3,38 +3,18 @@ import 'package:getflutter/colors/gf_color.dart'; import 'package:getflutter/components/button/gf_button.dart'; import 'package:getflutter/components/badge/gf_button_badge.dart'; import 'package:getflutter/components/avatar/gf_avatar.dart'; -import 'package:getflutter/components/badge/gf_badge.dart'; -// import 'package:getflutter/components/list/gf_list.dart'; import 'package:getflutter/components/tabs/gf_segment_tabs.dart'; -import 'package:getflutter/size/gf_size.dart'; -import 'package:getflutter/types/gf_type.dart'; +import 'package:getflutter/types/gf_button_type.dart'; import 'package:getflutter/shape/gf_button_shape.dart'; -import 'package:getflutter/shape/gf_badge_shape.dart'; import 'package:flutter/cupertino.dart'; -import 'package:getflutter/components/tabs/gf_tabs.dart'; -import 'package:getflutter/components/drawer/gf_drawer.dart'; -import 'package:getflutter/components/drawer/gf_drawer_header.dart'; import 'package:getflutter/components/toast/gf_toast.dart'; import 'package:getflutter/components/appbar/gf_appbar.dart'; -import 'package:getflutter/components/tabs/gf_tabBarView.dart'; -import 'package:getflutter/components/button/gf_icon_button.dart'; -import 'package:getflutter/components/button/gf_social_button.dart'; -import 'package:getflutter/components/carousel/gf_carousel.dart'; -import 'package:getflutter/components/carousel/gf_items_carousel.dart'; -import 'package:getflutter/shape/gf_avatar_shape.dart'; import 'package:getflutter/components/card/gf_card.dart'; -import 'package:getflutter/components/image/gf_image_overlay.dart'; import 'package:getflutter/components/list_tile/gf_list_tile.dart'; -import 'package:getflutter/position/gf_position.dart'; import 'package:getflutter/components/button/gf_button_bar.dart'; -import 'package:getflutter/components/badge/gf_icon_badge.dart'; -import 'package:getflutter/shape/gf_icon_button_shape.dart'; -import 'package:getflutter/components/tabs/gf_tabBar.dart'; import 'package:getflutter/components/typography/gf_typography.dart'; import 'package:getflutter/types/gf_typography_type.dart'; import 'package:getflutter/components/toast/gf_floating_widget.dart'; -import 'package:getflutter/components/toggle/gf_toggle.dart'; -import 'package:getflutter/types/gf_toggle_type.dart'; final List imageList = [ "https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg", @@ -173,6 +153,89 @@ class _MyHomePageState extends State mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ + GFCard( + content: Column( + children: [ + GFTypography( + text: 'Toast', + type: GFTypographyType.typo6, + ), + SizedBox( + height: 20, + ), + GFButtonBar( + children: [ + GFButton( + onPressed: () {}, + ), + GFButton( + onPressed: () {}, + ), + ], + ), + SizedBox( + height: 20, + ), + GFToast( + text: 'Happy New Year', + button: GFButton( + onPressed: () { + print("dfr"); + }, + text: 'OK', + type: GFButtonType.outline, + color: GFColor.warning, + ), + ), + ], + ), + ), + + GFCard( + content: Column( + children: [ + GFTypography( + text: 'Floating Toast', + type: GFTypographyType.typo6, + ), + GFFloatingWidget( + verticalPosition: 80, + child: showToast + ? GFToast( + width: 300, + text: 'Happy New Year', + button: GFButton( + onPressed: () { + print("df"); + }, + text: 'OK', + type: GFButtonType.outline, + color: GFColor.warning, + ), + ) + : Container(), + body: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + alignment: Alignment.center, + child: GFButton( + onPressed: () { + setState(() { + showToast = !showToast; + }); + }, + text: 'Click to View the toast', + type: GFButtonType.outline, + color: GFColor.warning, + ), + ) + ], + )) + ], + ), + ), + // Container( // height: 130.0, // width: 105.0, @@ -187,6 +250,7 @@ class _MyHomePageState extends State // ])), // ), // + // GFCard( // content: Column( // children: [ @@ -263,7 +327,49 @@ class _MyHomePageState extends State // ), // ), // ), -// + + GFButtonBar( + alignment: WrapAlignment.spaceEvenly, + children: [ + GFButton( + onPressed: null, + child: Text("dshsc"), + icon: Icon(Icons.access_time), + ), + GFButton( + onPressed: null, + child: Text("dszndc"), + icon: Icon(Icons.warning), + ), + GFButtonBadge( + onPressed: null, + text: "djvhcfdscc", + icon: Icon(Icons.label), + ), + GFButton( + onPressed: null, + child: Text("gcnjd"), + ), + GFButton( + onPressed: null, + child: Text("dsqdsc"), + icon: Icon(Icons.favorite), + ), + GFButton( + onPressed: null, + child: Text("gcd"), + ), + GFButton( + onPressed: null, + child: Text("dascdsc"), + ), + GFButton( + onPressed: null, + child: Text("gtgcd"), + ), + ], + ), + // GFCard( // content: Column( // crossAxisAlignment: CrossAxisAlignment.center, @@ -324,7 +430,8 @@ class _MyHomePageState extends State // dividerWidth: 20, // ), // ], -// )), +// ) +// ), // GFButton( // onPressed: (){}, @@ -338,11 +445,11 @@ class _MyHomePageState extends State // ), GFListTile( -// padding: EdgeInsets.all(8.0), -// color: Colors.redAccent, -// avatar: GFAvatar( -// child: Text("tb"), -// ), + padding: EdgeInsets.all(8.0), + color: Colors.redAccent, + avatar: GFAvatar( + child: Text("tb"), + ), title: Text('title'), subTitle: Text('subtitle'), description: Text('A page view that displays the widget which ' @@ -378,7 +485,7 @@ class _MyHomePageState extends State // showDivider: false, // icon: GFIconButton( // onPressed: null, -// type: GFType.transparent, +// type: GFButtonType.transparent, // icon: Icon(Icons.favorite_border), // ), // ), @@ -448,7 +555,7 @@ class _MyHomePageState extends State //// color: GFColor.success, //// textColor: GFColor.dark, //// shape: GFButtonShape.pills, -//// type: GFType.outline2x, +//// type: GFButtonType.outline2x, //// size: GFSize.small, // icon: GFBadge( // child: Text("12"), @@ -474,55 +581,55 @@ class _MyHomePageState extends State ////// textColor: GFColor.white, ////// textStyle: TextStyle(fontWeight: FontWeight.w500, fontSize: 8.0), //// ), -// type: GFType.outline2x, +// type: GFButtonType.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, -//// focusColor: GFColor.danger, -// 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, -//// 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), -// ), + 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, +// focusColor: GFColor.danger, + type: GFButtonType.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, +// 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,), //// iconSize: 12.0, -// type: GFType.solid, +// type: GFButtonType.solid, //// shape: GFButtonShape.pills, //// size: GFSize.large, // buttonBoxShadow: true, @@ -553,54 +660,30 @@ class _MyHomePageState extends State // ), GFSegmentTabs( - tabController: tabController, - height: 36.0, -// width: 180.0, - initialIndex: 0, - length: 3, - tabs: [ - Text( - "Gelatin", - ), - Tab( - child: Text( - "Donuts", - ), - ), - Tab( - child: Text( - "Pastry", - ), - ), - ], - tabBarColor: Colors.grey, - indicatorSize: TabBarIndicatorSize.tab, - indicatorColor: Colors.greenAccent, - labelColor: Colors.greenAccent, - unselectedLabelColor: Colors.white, - indicator: BoxDecoration( - color: Colors.black, - border: Border( - bottom: BorderSide( - color: Colors.greenAccent, - width: 2.0, - ), - ), -// borderRadius: BorderRadius.circular(2.0) + tabController: tabController, + initialIndex: 0, + length: 3, + tabs: [ + Text( + "Tab1", ), - indicatorPadding: EdgeInsets.all(8.0), - indicatorWeight: 2.0, - border: Border.all(color: Colors.white, width: 2.0), - borderRadius: BorderRadius.circular(2.0)), + Text( + "Tab2", + ), + Text( + "Tab3", + ), + ], + ), - GFTabBarView( - controller: tabController, - height: 400.0, - children: [ - Container(color: Colors.red), - Container(color: Colors.green), - Container(color: Colors.blue) - ]), +// GFTabBarView( +// controller: tabController, +// children: [ +// Container(color: Colors.red), +// Container(color: Colors.green), +// Container(color: Colors.blue) +// ] +// ), // GFItemsCarousel( // rowCount: 3, @@ -649,85 +732,37 @@ class _MyHomePageState extends State // }, // ), +// // GFTabs( -//// height: 100.0, -//// tabBarHeight: 52.0, // initialIndex: 0, // length: 3, // tabs: [ -// GFButton( -// onPressed: null, -// child: Text("share"), -// icon: Icon(Icons.share), -// buttonBoxShadow: true, +// Tab( +// icon: Icon(Icons.directions_bike), +// child: Text( +// "Tab1", +// ), // ), // Tab( -// icon: Icon(Icons.error), +// icon: Icon(Icons.directions_bus), // child: Text( -// "Orders", +// "Tab2", // ), // ), // Tab( +// icon: Icon(Icons.directions_railway), // child: Text( -// "Pastry", +// "Tab3", // ), // ), // ], // 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), +// Container(child: Icon(Icons.directions_bike), color: Colors.red,), +// Container(child: Icon(Icons.directions_bus), color: Colors.blue,), +// Container(child: Icon(Icons.directions_railway), color: Colors.orange,), // ], // ), -// 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', -// ), // ), // // GFCarousel( @@ -782,7 +817,7 @@ class _MyHomePageState extends State // icon: GFIconButton( // onPressed: null, // icon: Icon(Icons.favorite_border), -// type: GFType.transparent, +// type: GFButtonType.transparent, // ), // ), // content: Text( @@ -797,13 +832,13 @@ class _MyHomePageState extends State //// onPressed: null, //// child: Text("favorite"), //// icon: Icon(Icons.favorite_border), -//// type: GFType.transparent, +//// type: GFButtonType.transparent, //// ), //// GFButton( //// onPressed: null, //// child: Text("share"), //// icon: Icon(Icons.share), -//// type: GFType.outline, +//// type: GFButtonType.outline, //// ), //// ], //// ), @@ -816,7 +851,7 @@ class _MyHomePageState extends State // onPressed: null, // child: Text("like"), // icon: Icon(Icons.favorite_border), -// type: GFType.transparent, +// type: GFButtonType.transparent, // ), // GFButton( // onPressed: null, @@ -827,7 +862,7 @@ class _MyHomePageState extends State // onPressed: (){}, // child: Text("share"), // icon: Icon(Icons.share), -// type: GFType.outline, +// type: GFButtonType.outline, // ), // ], // ), @@ -841,7 +876,7 @@ class _MyHomePageState extends State // subTitle: Text('subtitle'), // icon: GFIconButton( // onPressed: null, -// type: GFType.transparent, +// type: GFButtonType.transparent, // icon: Icon(Icons.favorite_border), // ), // ), @@ -979,7 +1014,7 @@ class _MyHomePageState extends State // onPressed: (){}, // icon: Icon(Icons.ac_unit), //// iconSize: 12.0, -//// type: GFType.solid, +//// type: GFButtonType.solid, //// shape: GFIconButtonShape.pills, //// size: GFSize.large, //// buttonBoxShadow: true, @@ -1005,7 +1040,7 @@ class _MyHomePageState extends State // ), // // GFButton( -// type: GFType.outline, +// type: GFButtonType.outline, // shape: GFButtonShape.pills, // text: 'goodies', // icon: Icon(Icons.share), @@ -1033,31 +1068,31 @@ class _MyHomePageState extends State ], ), ), - bottomNavigationBar: GFTabBar( - initialIndex: 0, - length: 3, - controller: tabController, - tabs: [ - Tab( - icon: Icon(Icons.directions_bike), - child: Text( - "Tab1", - ), - ), - Tab( - icon: Icon(Icons.directions_bus), - child: Text( - "Tab2", - ), - ), - Tab( - icon: Icon(Icons.directions_railway), - child: Text( - "Tab3", - ), - ), - ], -// indicatorColor: Colors.teal, +// bottomNavigationBar: GFTabBar( +// initialIndex: 0, +// length: 3, +// controller: tabController, +// tabs: [ +// Tab( +// icon: Icon(Icons.directions_bike), +// child: Text( +// "Tab1", +// ), +// ), +// Tab( +// icon: Icon(Icons.directions_bus), +// child: Text( +// "Tab2", +// ), +// ), +// Tab( +// icon: Icon(Icons.directions_railway), +// child: Text( +// "Tab3", +// ), +// ), +// ], +// indicatorColor: Colors.white, //// indicatorSize: TabBarIndicatorSize.label, // labelColor: Colors.lightGreen, // labelPadding: EdgeInsets.all(8.0), @@ -1075,7 +1110,7 @@ class _MyHomePageState extends State // color: Colors.black, // fontFamily: 'OpenSansBold', // ), - ), +// ), ); } } diff --git a/example/pubspec.lock b/example/pubspec.lock index ab9c5288..c583984a 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -80,7 +80,7 @@ packages: path: ".." relative: true source: path - version: "1.0.0-dev.3" + version: "1.0.0" image: dependency: transitive description: diff --git a/example/pubspec.yaml b/example/pubspec.yaml index c4708b13..d940393a 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -1,5 +1,5 @@ name: example -description: A new Flutter project. +description: GetFlutter Demo app version: 1.0.0+1 diff --git a/lib/colors/gf_color.dart b/lib/colors/gf_color.dart index ba9d651c..8b77a3f1 100644 --- a/lib/colors/gf_color.dart +++ b/lib/colors/gf_color.dart @@ -15,64 +15,66 @@ enum GFColor { transparent } -const PRIMARY = Color(0xff3880FF); -const SECONDARY = Color(0xffAA66CC); -const SUCCESS = Color(0xff10DC60); -const INFO = Color(0xff33B5E5); -const WARNING = Color(0xffFFBB33); -const DANGER = Color(0xffF04141); -const LIGHT = Color(0xffE0E0E0); -const DARK = Color(0xff222428); -const WHITE = Color(0xffffffff); -const FOCUS = Color(0xff434054); -const ALT = Color(0xff794c8a); -const TRANSPARENT = Colors.transparent; +class GFColors { + static const Color PRIMARY = Color(0xff3880FF); + static const Color SECONDARY = Color(0xffAA66CC); + static const Color SUCCESS = Color(0xff10DC60); + static const Color INFO = Color(0xff33B5E5); + static const Color WARNING = Color(0xffFFBB33); + static const Color DANGER = Color(0xffF04141); + static const Color LIGHT = Color(0xffE0E0E0); + static const Color DARK = Color(0xff222428); + static const Color WHITE = Color(0xffffffff); + static const Color FOCUS = Color(0xff434054); + static const Color ALT = Color(0xff794c8a); + static const Color TRANSPARENT = Colors.transparent; -/// Pass [GFColor] or [Color] -Color getGFColor(dynamic color) { - if (color is Color) { - return color; - } else { - switch (color) { - case GFColor.primary: - return PRIMARY; - break; - case GFColor.secondary: - return SECONDARY; - break; - case GFColor.success: - return SUCCESS; - break; - case GFColor.warning: - return WARNING; - break; - case GFColor.info: - return INFO; - break; - case GFColor.danger: - return DANGER; - break; - case GFColor.focus: - return FOCUS; - break; - case GFColor.alt: - return ALT; - break; - case GFColor.light: - return LIGHT; - break; - case GFColor.dark: - return DARK; - break; - case GFColor.white: - return WHITE; - break; - case GFColor.transparent: - return TRANSPARENT; - break; - default: - return null; - break; + /// Pass [GFColor] or [Color] + static Color getGFColor(dynamic color) { + if (color is Color) { + return color; + } else { + switch (color) { + case GFColor.primary: + return PRIMARY; + break; + case GFColor.secondary: + return SECONDARY; + break; + case GFColor.success: + return SUCCESS; + break; + case GFColor.warning: + return WARNING; + break; + case GFColor.info: + return INFO; + break; + case GFColor.danger: + return DANGER; + break; + case GFColor.focus: + return FOCUS; + break; + case GFColor.alt: + return ALT; + break; + case GFColor.light: + return LIGHT; + break; + case GFColor.dark: + return DARK; + break; + case GFColor.white: + return WHITE; + break; + case GFColor.transparent: + return TRANSPARENT; + break; + default: + return null; + break; + } } } } diff --git a/lib/components/appbar/gf_appbar.dart b/lib/components/appbar/gf_appbar.dart index c3cfb533..a3a7af0d 100644 --- a/lib/components/appbar/gf_appbar.dart +++ b/lib/components/appbar/gf_appbar.dart @@ -202,8 +202,9 @@ class GFAppBar extends StatefulWidget implements PreferredSizeWidget { return false; case TargetPlatform.iOS: return trailing == null || trailing.length < 2; + default: + return false; } - return null; } @override @@ -294,6 +295,8 @@ class _GFAppBarState extends State { break; case TargetPlatform.iOS: break; + default: + break; } title = DefaultTextStyle( style: centerStyle, diff --git a/lib/components/avatar/gf_avatar.dart b/lib/components/avatar/gf_avatar.dart index 1b969e3d..9a9c0bec 100644 --- a/lib/components/avatar/gf_avatar.dart +++ b/lib/components/avatar/gf_avatar.dart @@ -28,7 +28,7 @@ class GFAvatar extends StatelessWidget { /// The maximum size of the avatar, expressed as the radius (half the diameter). final double maxRadius; - /// size of avatar like [GFSize] i.e, 1.2, small, medium, large etc. + /// size of avatar. use [GFSize] or [double] i.e, 1.2, small, medium, large etc. final dynamic size; /// shape of avatar [GFAvatarShape] i.e, standard, circle, square @@ -59,7 +59,7 @@ class GFAvatar extends StatelessWidget { double get _minDiameter { if (radius == null && minRadius == null && maxRadius == null) { - return 1.5 * getGFSize(size); + return 1.5 * GFSizesClass.getGFSize(size); } else { return 2.0 * (radius ?? minRadius ?? 0); } @@ -67,7 +67,7 @@ class GFAvatar extends StatelessWidget { double get _maxDiameter { if (radius == null && minRadius == null && maxRadius == null) { - return 1.5 * getGFSize(size); + return 1.5 * GFSizesClass.getGFSize(size); } else { return 2.0 * (radius ?? maxRadius ?? 0); } @@ -87,8 +87,8 @@ class GFAvatar extends StatelessWidget { @override Widget build(BuildContext context) { - Color backgroundColor = getGFColor(this.backgroundColor); - Color foregroundColor = getGFColor(this.foregroundColor); + Color backgroundColor = GFColors.getGFColor(this.backgroundColor); + Color foregroundColor = GFColors.getGFColor(this.foregroundColor); assert(debugCheckHasMediaQuery(context)); final ThemeData theme = Theme.of(context); TextStyle textStyle = diff --git a/lib/components/badge/gf_badge.dart b/lib/components/badge/gf_badge.dart index 3802d2e9..1c27b5b6 100644 --- a/lib/components/badge/gf_badge.dart +++ b/lib/components/badge/gf_badge.dart @@ -2,9 +2,6 @@ import 'package:flutter/material.dart'; import 'package:getflutter/shape/gf_badge_shape.dart'; import 'package:getflutter/size/gf_size.dart'; import 'package:getflutter/colors/gf_color.dart'; -export 'package:getflutter/shape/gf_badge_shape.dart'; -export 'package:getflutter/size/gf_size.dart'; -export 'package:getflutter/colors/gf_color.dart'; class GFBadge extends StatefulWidget { /// The border side for the badge's [Material]. @@ -20,7 +17,7 @@ class GFBadge extends StatefulWidget { final dynamic color; /// size of [double] or [GFSize] i.e, 1.2, small, medium, large etc. - final GFSize size; + final dynamic size; /// child of type [Widget] is alternative to child. text will get priority over child final Widget child; @@ -58,18 +55,18 @@ class _GFBadgeState extends State { Color textColor; Widget child; GFBadgeShape counterShape; - GFSize size; + double size; double height; double width; double fontSize; @override void initState() { - this.color = getGFColor(widget.color); - this.textColor = getGFColor(widget.textColor); + this.color = GFColors.getGFColor(widget.color); + this.textColor = GFColors.getGFColor(widget.textColor); this.child = widget.text != null ? Text(widget.text ?? '') : widget.child; this.counterShape = widget.shape; - this.size = widget.size; + this.size = GFSizesClass.getGFSize(widget.size); super.initState(); } @@ -101,23 +98,22 @@ class _GFBadgeState extends State { borderRadius: BorderRadius.circular(5.0), side: shapeBorder); } - if (this.size == GFSize.small) { - this.height = getGFSize(this.size) * 0.56; - this.width = getGFSize(this.size) * 0.75; - this.fontSize = getGFSize(this.size) * 0.31; - } else if (this.size == GFSize.medium) { - this.height = getGFSize(this.size) * 0.5; - this.width = getGFSize(this.size) * 0.65; - this.fontSize = getGFSize(this.size) * 0.3; - this.fontSize = 12.0; - } else if (this.size == GFSize.large) { - this.height = getGFSize(this.size) * 0.428; - this.width = getGFSize(this.size) * 0.535; - this.fontSize = getGFSize(this.size) * 0.214; + if (widget.size == GFSize.small) { + this.height = this.size * 0.56; + this.width = this.size * 0.73; + this.fontSize = this.size * 0.31; + } else if (widget.size == GFSize.medium) { + this.height = this.size * 0.58; + this.width = this.size * 0.76; + this.fontSize = this.size * 0.34; + } else if (widget.size == GFSize.large) { + this.height = this.size * 0.6; + this.width = this.size * 0.79; + this.fontSize = this.size * 0.37; } else { - this.height = getGFSize(this.size) * 0.56; - this.width = getGFSize(this.size) * 0.75; - this.fontSize = getGFSize(this.size) * 0.31; + this.height = this.size * 0.58; + this.width = this.size * 0.76; + this.fontSize = this.size * 0.34; } return Container( diff --git a/lib/components/badge/gf_button_badge.dart b/lib/components/badge/gf_button_badge.dart index 49de906f..107cb5e6 100644 --- a/lib/components/badge/gf_button_badge.dart +++ b/lib/components/badge/gf_button_badge.dart @@ -5,14 +5,9 @@ import 'package:flutter/material.dart'; import 'package:getflutter/components/button/gf_button.dart'; import 'package:getflutter/shape/gf_button_shape.dart'; import 'package:getflutter/size/gf_size.dart'; -import 'package:getflutter/types/gf_type.dart'; +import 'package:getflutter/types/gf_button_type.dart'; import 'package:getflutter/position/gf_position.dart'; import 'package:getflutter/colors/gf_color.dart'; -export 'package:getflutter/position/gf_position.dart'; -export 'package:getflutter/shape/gf_button_shape.dart'; -export 'package:getflutter/size/gf_size.dart'; -export 'package:getflutter/types/gf_type.dart'; -export 'package:getflutter/colors/gf_color.dart'; class GFButtonBadge extends GFButton { /// Called when the button is tapped or otherwise activated. @@ -84,8 +79,8 @@ class GFButtonBadge extends GFButton { /// {@macro flutter.widgets.Clip} final Clip clipBehavior; - /// Button type of [GFType] i.e, solid, outline, outline2x, transparent - final GFType type; + /// Button type of [GFButtonType] i.e, solid, outline, outline2x, transparent + final GFButtonType type; /// Button type of [GFButtonBadgeShape] i.e, standard, pills, square, shadow, icons final GFButtonShape shape; @@ -128,7 +123,7 @@ class GFButtonBadge extends GFButton { /// text of type [String] is alternative to child. text will get priority over child final String text; - /// icon type of [GFIconPosition] i.e, start, end + /// icon type of [GFPosition] i.e, start, end final GFPosition position; /// on true state blockButton gives block size badge @@ -199,7 +194,7 @@ class GFButtonBadge extends GFButton { this.focusNode, this.autofocus = false, MaterialTapTargetSize materialTapTargetSize, - this.type = GFType.solid, + this.type = GFButtonType.solid, this.shape = GFButtonShape.standard, this.color = GFColor.primary, this.textColor, @@ -232,7 +227,7 @@ class GFButtonBadge extends GFButton { return ConstrainedBox( constraints: BoxConstraints(minHeight: 26.0, minWidth: 98.0), child: Container( - height: getGFSize(size), + height: GFSizesClass.getGFSize(size), child: GFButton( onPressed: onPressed, onHighlightChanged: onHighlightChanged, @@ -260,7 +255,7 @@ class GFButtonBadge extends GFButton { color: color, textColor: textColor, position: position, - size: getGFSize(size), + size: GFSizesClass.getGFSize(size), borderSide: borderSide, text: text, icon: icon, diff --git a/lib/components/badge/gf_icon_badge.dart b/lib/components/badge/gf_icon_badge.dart index a7575555..96640b4a 100644 --- a/lib/components/badge/gf_icon_badge.dart +++ b/lib/components/badge/gf_icon_badge.dart @@ -2,8 +2,8 @@ import 'package:flutter/material.dart'; import 'package:getflutter/components/button/gf_icon_button.dart'; class GFIconBadge extends StatefulWidget { - /// child of type [GFIconButton] is used to show icon. - /// Use [Icon] widget for compatibility. + /// child of type [Widget] is used to show icon. + /// Use [GFIconButton] widget for compatibility. final Widget child; /// widget of type [Widget] is used to show counter to the top right corner of child. @@ -27,16 +27,11 @@ class GFIconBadge extends StatefulWidget { } class _GFIconBadgeState extends State { - @override - void initState() { - super.initState(); - } + double size; @override Widget build(BuildContext context) { return Container( - height: 60.0, - width: 60.0, padding: widget.padding, child: Stack( children: [ diff --git a/lib/components/button/gf_button.dart b/lib/components/button/gf_button.dart index d96f9e25..399e0e12 100644 --- a/lib/components/button/gf_button.dart +++ b/lib/components/button/gf_button.dart @@ -6,14 +6,9 @@ import 'package:flutter/widgets.dart'; import 'package:flutter/material.dart'; import 'package:getflutter/shape/gf_button_shape.dart'; import 'package:getflutter/size/gf_size.dart'; -import 'package:getflutter/types/gf_type.dart'; +import 'package:getflutter/types/gf_button_type.dart'; import 'package:getflutter/position/gf_position.dart'; import 'package:getflutter/colors/gf_color.dart'; -export 'package:getflutter/position/gf_position.dart'; -export 'package:getflutter/shape/gf_button_shape.dart'; -export 'package:getflutter/size/gf_size.dart'; -export 'package:getflutter/types/gf_type.dart'; -export 'package:getflutter/colors/gf_color.dart'; class GFButton extends StatefulWidget { /// Called when the button is tapped or otherwise activated. @@ -88,8 +83,8 @@ class GFButton extends StatefulWidget { /// {@macro flutter.widgets.Clip} final Clip clipBehavior; - /// Button type of [GFType] i.e, solid, outline, outline2x, transparent - final GFType type; + /// Button type of [GFButtonType] i.e, solid, outline, outline2x, transparent + final GFButtonType type; /// Button type of [GFButtonShape] i.e, standard, pills, square, shadow, icons final GFButtonShape shape; @@ -135,7 +130,7 @@ class GFButton extends StatefulWidget { /// icon of type [Widget] final Widget icon; - /// icon type of [GFIconPosition] i.e, start, end + /// icon type of [GFPosition] i.e, start, end final GFPosition position; /// on true state blockButton gives block size button @@ -204,7 +199,7 @@ class GFButton extends StatefulWidget { this.autofocus = false, MaterialTapTargetSize materialTapTargetSize, this.child, - this.type = GFType.solid, + this.type = GFButtonType.solid, this.shape = GFButtonShape.standard, this.color = GFColor.primary, this.textColor, @@ -246,7 +241,7 @@ class _GFButtonState extends State { Widget child; Widget icon; Function onPressed; - GFType type; + GFButtonType type; GFButtonShape shape; double size; GFPosition position; @@ -256,17 +251,17 @@ class _GFButtonState extends State { @override void initState() { - this.color = getGFColor(widget.color); - this.textColor = getGFColor(widget.textColor); + this.color = GFColors.getGFColor(widget.color); + this.textColor = GFColors.getGFColor(widget.textColor); this.child = widget.text != null ? Text(widget.text) : widget.child; this.icon = widget.icon; this.onPressed = widget.onPressed; this.type = widget.type; this.shape = widget.shape; - this.size = getGFSize(widget.size); + this.size = GFSizesClass.getGFSize(widget.size); this.position = widget.position; - this.disabledColor = getGFColor(widget.disabledColor); - this.disabledTextColor = getGFColor(widget.disabledTextColor); + this.disabledColor = GFColors.getGFColor(widget.disabledColor); + this.disabledTextColor = GFColors.getGFColor(widget.disabledTextColor); _updateState(MaterialState.disabled, !widget.enabled); super.initState(); @@ -355,8 +350,9 @@ class _GFButtonState extends State { Color getBorderColor() { if (widget.enabled) { - final Color fillColor = - this.color == null ? getGFColor(GFColor.primary) : this.color; + final Color fillColor = this.color == null + ? GFColors.getGFColor(GFColor.primary) + : this.color; if (fillColor != null) return fillColor; } else { if (this.disabledColor != null) @@ -365,13 +361,15 @@ class _GFButtonState extends State { return this.color.withOpacity(0.48); } } - return this.color == null ? getGFColor(GFColor.primary) : this.color; + return this.color == null + ? GFColors.getGFColor(GFColor.primary) + : this.color; } Color getDisabledFillColor() { - if (widget.type == GFType.transparent || - widget.type == GFType.outline || - widget.type == GFType.outline2x) return Colors.transparent; + if (widget.type == GFButtonType.transparent || + widget.type == GFButtonType.outline || + widget.type == GFButtonType.outline2x) return Colors.transparent; if (this.disabledColor != null) return this.disabledColor; else { @@ -380,43 +378,44 @@ class _GFButtonState extends State { } Color getColor() { - if (widget.type == GFType.transparent || - widget.type == GFType.outline || - widget.type == GFType.outline2x) return Colors.transparent; - final Color fillColor = - this.color == null ? getGFColor(GFColor.primary) : this.color; + if (widget.type == GFButtonType.transparent || + widget.type == GFButtonType.outline || + widget.type == GFButtonType.outline2x) return Colors.transparent; + final Color fillColor = this.color == null + ? GFColors.getGFColor(GFColor.primary) + : this.color; return fillColor; } Color getDisabledTextColor() { if (this.disabledTextColor != null) return this.disabledTextColor; - else if (widget.type == GFType.outline || - widget.type == GFType.outline2x || - widget.type == GFType.transparent) { + else if (widget.type == GFButtonType.outline || + widget.type == GFButtonType.outline2x || + widget.type == GFButtonType.transparent) { return this.color; } else { - return getGFColor(GFColor.dark); + return GFColors.getGFColor(GFColor.dark); } } Color getTextColor() { - if (widget.type == GFType.outline || - widget.type == GFType.outline2x || - widget.type == GFType.transparent) { + if (widget.type == GFButtonType.outline || + widget.type == GFButtonType.outline2x || + widget.type == GFButtonType.transparent) { return widget.enabled ? this.textColor == null - ? this.color == getGFColor(GFColor.transparent) - ? getGFColor(GFColor.dark) + ? this.color == GFColors.getGFColor(GFColor.transparent) + ? GFColors.getGFColor(GFColor.dark) : this.color : this.textColor : getDisabledTextColor(); } if (this.textColor == null) { - if (this.color == getGFColor(GFColor.transparent)) { - return getGFColor(GFColor.dark); + if (this.color == GFColors.getGFColor(GFColor.transparent)) { + return GFColors.getGFColor(GFColor.dark); } else { - return getGFColor(GFColor.white); + return GFColors.getGFColor(GFColor.white); } } else { return this.textColor; @@ -434,7 +433,7 @@ class _GFButtonState extends State { ? getBorderColor() : widget.borderSide.color, width: widget.borderSide?.width == null - ? widget.type == GFType.outline2x ? 2.0 : 1.0 + ? widget.type == GFButtonType.outline2x ? 2.0 : 1.0 : widget.borderSide?.width, ); @@ -451,15 +450,15 @@ class _GFButtonState extends State { break; } - final BorderSide shapeBorder = - widget.type == GFType.outline || widget.type == GFType.outline2x - ? outlineBorder - : widget.borderSide != null - ? widget.borderSide - : BorderSide( - color: this.color == null ? themeColor : getBorderColor(), - width: 0.0, - ); + final BorderSide shapeBorder = widget.type == GFButtonType.outline || + widget.type == GFButtonType.outline2x + ? outlineBorder + : widget.borderSide != null + ? widget.borderSide + : BorderSide( + color: this.color == null ? themeColor : getBorderColor(), + width: 0.0, + ); if (this.shape == GFButtonShape.pills) { shape = RoundedRectangleBorder( @@ -476,14 +475,14 @@ class _GFButtonState extends State { } BoxDecoration getBoxShadow() { - if (widget.type != GFType.transparent) { + if (widget.type != GFButtonType.transparent) { if (widget.boxShadow == null && widget.buttonBoxShadow != true) { return null; } else { return BoxDecoration( - color: widget.type == GFType.transparent || - widget.type == GFType.outline || - widget.type == GFType.outline2x + color: widget.type == GFButtonType.transparent || + widget.type == GFButtonType.outline || + widget.type == GFButtonType.outline2x ? Colors.transparent : this.color, borderRadius: widget.shape == GFButtonShape.pills @@ -539,11 +538,11 @@ class _GFButtonState extends State { constraints: this.icon == null ? BoxConstraints(minWidth: 80.0) : BoxConstraints(minWidth: 90.0), - decoration: widget.type == GFType.solid ? getBoxShadow() : null, + decoration: widget.type == GFButtonType.solid ? getBoxShadow() : null, child: Material( elevation: _effectiveElevation, textStyle: widget.textStyle == null ? getTextStyle() : widget.textStyle, - shape: widget.type == GFType.transparent + shape: widget.type == GFButtonType.transparent ? null : widget.borderShape == null ? shape : widget.borderShape, color: widget.enabled ? getColor() : getDisabledFillColor(), @@ -562,11 +561,11 @@ class _GFButtonState extends State { onTap: widget.onPressed, onLongPress: widget.onLongPress, enableFeedback: widget.enableFeedback, - splashColor: getGFColor(widget.splashColor), - highlightColor: getGFColor(widget.highlightColor), - focusColor: getGFColor(widget.focusColor), - hoverColor: getGFColor(widget.hoverColor), - customBorder: widget.type == GFType.transparent + splashColor: GFColors.getGFColor(widget.splashColor), + highlightColor: GFColors.getGFColor(widget.highlightColor), + focusColor: GFColors.getGFColor(widget.focusColor), + hoverColor: GFColors.getGFColor(widget.hoverColor), + customBorder: widget.type == GFButtonType.transparent ? null : widget.borderShape == null ? shape : widget.borderShape, child: IconTheme.merge( diff --git a/lib/components/button/gf_button_bar.dart b/lib/components/button/gf_button_bar.dart index 922ba9b7..b8b0ef33 100644 --- a/lib/components/button/gf_button_bar.dart +++ b/lib/components/button/gf_button_bar.dart @@ -1,22 +1,159 @@ import 'package:flutter/material.dart'; import 'package:getflutter/components/button/gf_button.dart'; import 'package:getflutter/components/button/gf_icon_button.dart'; +import 'package:flutter/rendering.dart'; class GFButtonBar extends StatelessWidget { /// Create buttons bar for all types of buttons. /// check [GFButton] and [GFIconButton] const GFButtonBar({ Key key, - this.alignment = MainAxisAlignment.end, - this.mainAxisSize = MainAxisSize.max, + this.direction = Axis.horizontal, + this.alignment = WrapAlignment.center, + this.spacing = 8.0, + this.runAlignment = WrapAlignment.start, + this.runSpacing = 0.0, + this.crossAxisAlignment = WrapCrossAlignment.start, + this.textDirection, + this.verticalDirection = VerticalDirection.down, this.children = const [], + this.padding = const EdgeInsets.all(0.0), }) : super(key: key); - /// How the children should be placed along the horizontal axis. - final MainAxisAlignment alignment; + /// The empty space that surrounds the buttonBar. Default's to padding.zero + final EdgeInsetsGeometry padding; - /// How much horizontal space is available. See [Row.mainAxisSize]. - final MainAxisSize mainAxisSize; + /// The direction to use as the main axis. + /// + /// For example, if [direction] is [Axis.horizontal], the default, the + /// children are placed adjacent to one another in a horizontal run until the + /// available horizontal space is consumed, at which point a subsequent + /// children are placed in a new run vertically adjacent to the previous run. + final Axis direction; + + /// How the children within a run should be placed in the main axis. + /// + /// For example, if [alignment] is [WrapAlignment.center], the children in + /// each run are grouped together in the center of their run in the main axis. + /// + /// Defaults to [WrapAlignment.start]. + /// + /// See also: + /// + /// * [runAlignment], which controls how the runs are placed relative to each + /// other in the cross axis. + /// * [crossAxisAlignment], which controls how the children within each run + /// are placed relative to each other in the cross axis. + final WrapAlignment alignment; + + /// How much space to place between children in a run in the main axis. + /// + /// For example, if [spacing] is 10.0, the children will be spaced at least + /// 10.0 logical pixels apart in the main axis. + /// + /// If there is additional free space in a run (e.g., because the wrap has a + /// minimum size that is not filled or because some runs are longer than + /// others), the additional free space will be allocated according to the + /// [alignment]. + /// + /// Defaults to 0.0. + final double spacing; + + /// How the runs themselves should be placed in the cross axis. + /// + /// For example, if [runAlignment] is [WrapAlignment.center], the runs are + /// grouped together in the center of the overall [Wrap] in the cross axis. + /// + /// Defaults to [WrapAlignment.start]. + /// + /// See also: + /// + /// * [alignment], which controls how the children within each run are placed + /// relative to each other in the main axis. + /// * [crossAxisAlignment], which controls how the children within each run + /// are placed relative to each other in the cross axis. + final WrapAlignment runAlignment; + + /// How much space to place between the runs themselves in the cross axis. + /// + /// For example, if [runSpacing] is 10.0, the runs will be spaced at least + /// 10.0 logical pixels apart in the cross axis. + /// + /// If there is additional free space in the overall [Wrap] (e.g., because + /// the wrap has a minimum size that is not filled), the additional free space + /// will be allocated according to the [runAlignment]. + /// + /// Defaults to 0.0. + final double runSpacing; + + /// How the children within a run should be aligned relative to each other in + /// the cross axis. + /// + /// For example, if this is set to [WrapCrossAlignment.end], and the + /// [direction] is [Axis.horizontal], then the children within each + /// run will have their bottom edges aligned to the bottom edge of the run. + /// + /// Defaults to [WrapCrossAlignment.start]. + /// + /// See also: + /// + /// * [alignment], which controls how the children within each run are placed + /// relative to each other in the main axis. + /// * [runAlignment], which controls how the runs are placed relative to each + /// other in the cross axis. + final WrapCrossAlignment crossAxisAlignment; + + /// Determines the order to lay children out horizontally and how to interpret + /// `start` and `end` in the horizontal direction. + /// + /// Defaults to the ambient [Directionality]. + /// + /// If the [direction] is [Axis.horizontal], this controls order in which the + /// children are positioned (left-to-right or right-to-left), and the meaning + /// of the [alignment] property's [WrapAlignment.start] and + /// [WrapAlignment.end] values. + /// + /// If the [direction] is [Axis.horizontal], and either the + /// [alignment] is either [WrapAlignment.start] or [WrapAlignment.end], or + /// there's more than one child, then the [textDirection] (or the ambient + /// [Directionality]) must not be null. + /// + /// If the [direction] is [Axis.vertical], this controls the order in which + /// runs are positioned, the meaning of the [runAlignment] property's + /// [WrapAlignment.start] and [WrapAlignment.end] values, as well as the + /// [crossAxisAlignment] property's [WrapCrossAlignment.start] and + /// [WrapCrossAlignment.end] values. + /// + /// If the [direction] is [Axis.vertical], and either the + /// [runAlignment] is either [WrapAlignment.start] or [WrapAlignment.end], the + /// [crossAxisAlignment] is either [WrapCrossAlignment.start] or + /// [WrapCrossAlignment.end], or there's more than one child, then the + /// [textDirection] (or the ambient [Directionality]) must not be null. + final TextDirection textDirection; + + /// Determines the order to lay children out vertically and how to interpret + /// `start` and `end` in the vertical direction. + /// + /// If the [direction] is [Axis.vertical], this controls which order children + /// are painted in (down or up), the meaning of the [alignment] property's + /// [WrapAlignment.start] and [WrapAlignment.end] values. + /// + /// If the [direction] is [Axis.vertical], and either the [alignment] + /// is either [WrapAlignment.start] or [WrapAlignment.end], or there's + /// more than one child, then the [verticalDirection] must not be null. + /// + /// If the [direction] is [Axis.horizontal], this controls the order in which + /// runs are positioned, the meaning of the [runAlignment] property's + /// [WrapAlignment.start] and [WrapAlignment.end] values, as well as the + /// [crossAxisAlignment] property's [WrapCrossAlignment.start] and + /// [WrapCrossAlignment.end] values. + /// + /// If the [direction] is [Axis.horizontal], and either the + /// [runAlignment] is either [WrapAlignment.start] or [WrapAlignment.end], the + /// [crossAxisAlignment] is either [WrapCrossAlignment.start] or + /// [WrapCrossAlignment.end], or there's more than one child, then the + /// [verticalDirection] must not be null. + final VerticalDirection verticalDirection; /// The buttons to arrange horizontally. /// Typically [RaisedButton] or [GFButton] or [GFIconButton] widgets. @@ -24,37 +161,21 @@ class GFButtonBar extends StatelessWidget { @override Widget build(BuildContext context) { - final ButtonThemeData buttonTheme = ButtonTheme.of(context); - // We divide by 4.0 because we want half of the average of the left and right padding. - final double paddingUnit = buttonTheme.padding.horizontal / 4.0; - final Widget child = Row( - mainAxisAlignment: alignment, - mainAxisSize: mainAxisSize, - children: children.map((Widget child) { - return Padding( - padding: EdgeInsets.symmetric(horizontal: paddingUnit), - child: child, - ); - }).toList(), + return Padding( + padding: padding, + child: Wrap( + direction: direction, + alignment: alignment, + spacing: spacing, + runAlignment: runAlignment, + runSpacing: runSpacing, + crossAxisAlignment: crossAxisAlignment, + textDirection: textDirection, + verticalDirection: verticalDirection, + children: children.map((Widget child) { + return child; + }).toList(), + ), ); - switch (buttonTheme.layoutBehavior) { - case ButtonBarLayoutBehavior.padded: - return Padding( - padding: EdgeInsets.symmetric( - vertical: 2.0 * paddingUnit, - horizontal: paddingUnit, - ), - child: child, - ); - case ButtonBarLayoutBehavior.constrained: - return Container( - padding: EdgeInsets.symmetric(horizontal: paddingUnit), - constraints: const BoxConstraints(minHeight: 52.0), - alignment: Alignment.center, - child: child, - ); - } - assert(false); - return null; } } diff --git a/lib/components/button/gf_icon_button.dart b/lib/components/button/gf_icon_button.dart index 559f0e30..ef8b2fab 100644 --- a/lib/components/button/gf_icon_button.dart +++ b/lib/components/button/gf_icon_button.dart @@ -4,12 +4,8 @@ import 'package:flutter/widgets.dart'; import 'package:flutter/material.dart'; import 'package:getflutter/shape/gf_icon_button_shape.dart'; import 'package:getflutter/size/gf_size.dart'; -import 'package:getflutter/types/gf_type.dart'; +import 'package:getflutter/types/gf_button_type.dart'; import 'package:getflutter/colors/gf_color.dart'; -export 'package:getflutter/shape/gf_icon_button_shape.dart'; -export 'package:getflutter/size/gf_size.dart'; -export 'package:getflutter/types/gf_type.dart'; -export 'package:getflutter/colors/gf_color.dart'; class GFIconButton extends StatefulWidget { /// The size of the icon inside the button. @@ -30,8 +26,8 @@ class GFIconButton extends StatefulWidget { /// The color for the button's icon when a pointer is hovering over it. final Color hoverColor; - /// Button type of [GFType] i.e, solid, outline, outline2x transparent - final GFType type; + /// Button type of [GFButtonType] i.e, solid, outline, outline2x transparent + final GFButtonType type; /// Button type of [GFIconButtonShape] i.e, standard, pills, square, shadow, icons final GFIconButtonShape shape; @@ -91,7 +87,7 @@ class GFIconButton extends StatefulWidget { this.focusNode, this.autofocus = false, this.tooltip, - this.type = GFType.solid, + this.type = GFButtonType.solid, this.shape = GFIconButtonShape.standard, this.color = GFColor.primary, this.borderShape, @@ -113,7 +109,7 @@ class GFIconButton extends StatefulWidget { class _GFIconButtonState extends State { Color color; Function onPressed; - GFType type; + GFButtonType type; GFIconButtonShape shape; BoxShadow boxShadow; double height; @@ -122,49 +118,67 @@ class _GFIconButtonState extends State { @override void initState() { - this.color = getGFColor(widget.color); + this.color = GFColors.getGFColor(widget.color); this.onPressed = widget.onPressed; this.type = widget.type; this.shape = widget.shape; super.initState(); } - @override - Widget build(BuildContext context) { - assert(debugCheckHasMaterial(context)); - - Color getBorderColor() { - if (widget.onPressed != null) { - return this.color; - } else { - if (widget.disabledColor != null) - return widget.disabledColor; - else { - return this.color.withOpacity(0.48); - } - } - } - - Color getDisabledFillColor() { - if (widget.type == GFType.transparent || - widget.type == GFType.outline || - widget.type == GFType.outline2x) return Colors.transparent; + Color getBorderColor() { + if (widget.onPressed != null) { + return this.color; + } else { if (widget.disabledColor != null) return widget.disabledColor; else { return this.color.withOpacity(0.48); } } + } - Color getColor() { - if (widget.type == GFType.transparent || - widget.type == GFType.outline || - widget.type == GFType.outline2x) - return Colors.transparent; - else { - return this.color; - } + Color getDisabledFillColor() { + if (widget.type == GFButtonType.transparent || + widget.type == GFButtonType.outline || + widget.type == GFButtonType.outline2x) return Colors.transparent; + if (widget.disabledColor != null) + return widget.disabledColor; + else { + return this.color.withOpacity(0.48); + } + } + + Color getColor() { + if (widget.type == GFButtonType.transparent || + widget.type == GFButtonType.outline || + widget.type == GFButtonType.outline2x) + return Colors.transparent; + else { + return this.color; } + } + + Color getIconColor() { + if (widget.type == GFButtonType.transparent || + widget.type == GFButtonType.outline || + widget.type == GFButtonType.outline2x) + return widget.onPressed != null + ? this.color == GFColors.getGFColor(GFColor.transparent) + ? GFColors.getGFColor(GFColor.dark) + : this.color + : this.color.withOpacity(0.48); + else if (this.color == GFColors.getGFColor(GFColor.transparent)) { + return widget.onPressed != null + ? GFColors.getGFColor(GFColor.dark) + : GFColors.getGFColor(GFColor.white); + } else { + return GFColors.getGFColor(GFColor.white); + } + } + + @override + Widget build(BuildContext context) { + assert(debugCheckHasMaterial(context)); final Color themeColor = Theme.of(context).colorScheme.onSurface.withOpacity(0.12); @@ -173,19 +187,19 @@ class _GFIconButtonState extends State { ? getBorderColor() : widget.borderSide.color, width: widget.borderSide?.width == null - ? widget.type == GFType.outline2x ? 2.0 : 1.0 + ? widget.type == GFButtonType.outline2x ? 2.0 : 1.0 : widget.borderSide?.width, ); - final BorderSide shapeBorder = - widget.type == GFType.outline || widget.type == GFType.outline2x - ? outlineBorder - : widget.borderSide != null - ? widget.borderSide - : BorderSide( - color: this.color, - width: 0.0, - ); + final BorderSide shapeBorder = widget.type == GFButtonType.outline || + widget.type == GFButtonType.outline2x + ? outlineBorder + : widget.borderSide != null + ? widget.borderSide + : BorderSide( + color: this.color, + width: 0.0, + ); ShapeBorder shape; @@ -212,32 +226,19 @@ class _GFIconButtonState extends State { this.width = 35.0; this.iconPixel = 18.0; } else if (widget.size == GFSize.large) { + print('her'); this.height = 40.0; this.width = 40.0; this.iconPixel = 18.0; - } - - getIconColor() { - if (widget.type == GFType.transparent || - widget.type == GFType.outline || - widget.type == GFType.outline2x) - return widget.onPressed != null - ? this.color == getGFColor(GFColor.transparent) - ? getGFColor(GFColor.dark) - : this.color - : this.color.withOpacity(0.48); - else if (this.color == getGFColor(GFColor.transparent)) { - return widget.onPressed != null - ? getGFColor(GFColor.dark) - : getGFColor(GFColor.white); - } else { - return getGFColor(GFColor.white); - } + } else { + this.height = 35.0; + this.width = 35.0; + this.iconPixel = 18.0; } Widget result = Container( height: widget.shape == GFIconButtonShape.circle - ? this.height + 6 + ? this.height + 6.0 : this.height, width: widget.shape == GFIconButtonShape.pills ? this.width + 10 @@ -262,7 +263,7 @@ class _GFIconButtonState extends State { } BoxDecoration getBoxShadow() { - if (widget.type != GFType.transparent) { + if (widget.type != GFButtonType.transparent) { if (widget.boxShadow == null && widget.buttonBoxShadow != true) { return null; } else { @@ -316,31 +317,32 @@ class _GFIconButtonState extends State { : widget.shape == GFIconButtonShape.circle ? this.height + 6 : this.width, - decoration: widget.type == GFType.solid ? getBoxShadow() : null, + decoration: + widget.type == GFButtonType.solid ? getBoxShadow() : null, child: Material( - shape: widget.type == GFType.transparent + shape: widget.type == GFButtonType.transparent ? null : widget.borderShape == null ? shape : widget.borderShape, color: widget.onPressed != null ? getColor() : getDisabledFillColor(), - type: widget.type == GFType.transparent + type: widget.type == GFButtonType.transparent ? MaterialType.transparency : MaterialType.button, child: InkResponse( onTap: widget.onPressed, child: result, focusColor: widget.focusColor != null - ? getGFColor(widget.focusColor) + ? GFColors.getGFColor(widget.focusColor) : Theme.of(context).focusColor, hoverColor: widget.hoverColor != null - ? getGFColor(widget.hoverColor) + ? GFColors.getGFColor(widget.hoverColor) : Theme.of(context).hoverColor, highlightColor: widget.highlightColor != null - ? getGFColor(widget.highlightColor) + ? GFColors.getGFColor(widget.highlightColor) : Theme.of(context).highlightColor, splashColor: widget.splashColor != null - ? getGFColor(widget.splashColor) + ? GFColors.getGFColor(widget.splashColor) : Theme.of(context).splashColor, radius: math.max( Material.defaultSplashRadius, diff --git a/lib/components/button/gf_social_button.dart b/lib/components/button/gf_social_button.dart index 80c00461..bef48e38 100644 --- a/lib/components/button/gf_social_button.dart +++ b/lib/components/button/gf_social_button.dart @@ -5,14 +5,9 @@ import 'package:flutter/material.dart'; import 'package:getflutter/components/button/gf_button.dart'; import 'package:getflutter/shape/gf_button_shape.dart'; import 'package:getflutter/size/gf_size.dart'; -import 'package:getflutter/types/gf_type.dart'; +import 'package:getflutter/types/gf_button_type.dart'; import 'package:getflutter/position/gf_position.dart'; import 'package:getflutter/colors/gf_color.dart'; -export 'package:getflutter/position/gf_position.dart'; -export 'package:getflutter/shape/gf_button_shape.dart'; -export 'package:getflutter/size/gf_size.dart'; -export 'package:getflutter/types/gf_type.dart'; -export 'package:getflutter/colors/gf_color.dart'; class GFSocialButton extends GFButton { /// Called when the button is tapped or otherwise activated. @@ -87,8 +82,8 @@ class GFSocialButton extends GFButton { /// {@macro flutter.widgets.Clip} final Clip clipBehavior; - /// Button type of [GFType] i.e, solid, outline, outline2x, transparent - final GFType type; + /// Button type of [GFButtonType] i.e, solid, outline, outline2x, transparent + final GFButtonType type; /// Button type of [GFSocialButtonShape] i.e, standard, pills, square, shadow, icons final GFButtonShape shape; @@ -134,7 +129,7 @@ class GFSocialButton extends GFButton { /// icon of type [Widget] final Widget icon; - /// icon type of [GFIconPosition] i.e, start, end + /// icon type of [GFPosition] i.e, start, end final GFPosition position; /// on true state blockButton gives block size button @@ -203,7 +198,7 @@ class GFSocialButton extends GFButton { this.autofocus = false, MaterialTapTargetSize materialTapTargetSize, this.child, - this.type = GFType.solid, + this.type = GFButtonType.solid, this.shape = GFButtonShape.standard, this.color = GFColor.primary, this.textColor, @@ -255,7 +250,7 @@ class GFSocialButton extends GFButton { focusNode: focusNode, autofocus: autofocus, child: child, - type: GFType.solid, + type: GFButtonType.solid, shape: GFButtonShape.standard, color: GFColor.primary, textColor: textColor, diff --git a/lib/components/card/gf_card.dart b/lib/components/card/gf_card.dart index b4a2fb75..3957bd07 100644 --- a/lib/components/card/gf_card.dart +++ b/lib/components/card/gf_card.dart @@ -4,7 +4,6 @@ import 'package:getflutter/components/button/gf_button_bar.dart'; import 'package:getflutter/components/list_tile/gf_list_tile.dart'; import 'package:getflutter/components/image/gf_image_overlay.dart'; import 'package:getflutter/position/gf_position.dart'; -export 'package:getflutter/position/gf_position.dart'; /// A material design card. A card has slightly rounded corners and a shadow. /// diff --git a/lib/components/drawer/gf_drawer.dart b/lib/components/drawer/gf_drawer.dart index 2b3d919a..cd2fa757 100644 --- a/lib/components/drawer/gf_drawer.dart +++ b/lib/components/drawer/gf_drawer.dart @@ -116,6 +116,9 @@ class GFDrawer extends StatelessWidget { case TargetPlatform.android: case TargetPlatform.fuchsia: label = semanticLabel ?? MaterialLocalizations.of(context)?.drawerLabel; + break; + default: + break; } return Semantics( scopesRoute: true, diff --git a/lib/components/list_tile/gf_list_tile.dart b/lib/components/list_tile/gf_list_tile.dart index 5b06e3bd..9e41fd2e 100644 --- a/lib/components/list_tile/gf_list_tile.dart +++ b/lib/components/list_tile/gf_list_tile.dart @@ -10,7 +10,7 @@ class GFListTile extends StatelessWidget { ///type of [String] used to pass text, alternative to subtitle property and gets higher priority than subtitle final String subtitleText; - /// The GFListTile's background color. Can be given [Colors] or [GFColor] + /// The GFListTile's background color. Can be given [Color] or [GFColor] final dynamic color; /// type of [Widget] or [GFAvatar] used to create rounded user profile @@ -28,6 +28,8 @@ class GFListTile extends StatelessWidget { /// The icon to display inside the [GFListTile]. see [Icon] final Widget icon; + final EdgeInsets padding; + /// Creates ListTile with leading, title, trailing, image widget for almost every type of ListTile design. const GFListTile({ Key key, @@ -39,13 +41,14 @@ class GFListTile extends StatelessWidget { this.subTitle, this.description, this.icon, + this.padding = const EdgeInsets.all(8.0), }) : super(key: key); @override Widget build(BuildContext context) { return Container( constraints: BoxConstraints(minHeight: 50), - padding: EdgeInsets.all(8), + padding: padding, decoration: BoxDecoration( color: color, borderRadius: BorderRadius.all(Radius.circular(5)), @@ -66,7 +69,7 @@ class GFListTile extends StatelessWidget { style: TextStyle( fontSize: 17, fontWeight: FontWeight.w500, - color: getGFColor(GFColor.dark)), + color: GFColors.getGFColor(GFColor.dark)), ) : title ?? Container(), subtitleText != null diff --git a/lib/components/tabs/gf_segment_tabs.dart b/lib/components/tabs/gf_segment_tabs.dart index cd33898d..2b798bf0 100644 --- a/lib/components/tabs/gf_segment_tabs.dart +++ b/lib/components/tabs/gf_segment_tabs.dart @@ -175,7 +175,8 @@ class _GFSegmentTabsState extends State { width: widget.width == null ? 240.0 : widget.width, decoration: BoxDecoration( border: widget.border == null - ? Border.all(color: getGFColor(GFColor.primary), width: 1.0) + ? Border.all( + color: GFColors.getGFColor(GFColor.primary), width: 1.0) : widget.border, borderRadius: widget.borderRadius == null ? BorderRadius.circular(2.0) @@ -192,20 +193,20 @@ class _GFSegmentTabsState extends State { color: widget.tabBarColor ?? Colors.transparent, child: TabBar( controller: widget.tabController, - labelColor: widget.labelColor ?? getGFColor(GFColor.white), - unselectedLabelColor: - widget.unselectedLabelColor ?? getGFColor(GFColor.primary), + labelColor: widget.labelColor ?? GFColors.getGFColor(GFColor.white), + unselectedLabelColor: widget.unselectedLabelColor ?? + GFColors.getGFColor(GFColor.primary), labelStyle: widget.labelStyle ?? TextStyle(fontSize: 12.0), unselectedLabelStyle: widget.unselectedLabelStyle ?? TextStyle(fontSize: 12.0), indicatorColor: widget.indicatorColor == null - ? getGFColor(GFColor.primary) + ? GFColors.getGFColor(GFColor.primary) : widget.indicatorColor, indicatorSize: widget.indicatorSize, indicator: widget.indicator == null ? BoxDecoration( color: widget.indicatorColor == null - ? getGFColor(GFColor.primary) + ? GFColors.getGFColor(GFColor.primary) : widget.indicatorColor, border: Border.all( color: widget.indicatorColor == null diff --git a/lib/components/tabs/gf_tabBar.dart b/lib/components/tabs/gf_tabBar.dart index bf9cda40..75eee5ad 100644 --- a/lib/components/tabs/gf_tabBar.dart +++ b/lib/components/tabs/gf_tabBar.dart @@ -168,7 +168,7 @@ class _GFTabBarState extends State { : widget.tabBarHeight, child: Material( type: MaterialType.button, - color: widget.tabBarColor ?? getGFColor(GFColor.primary), + color: widget.tabBarColor ?? GFColors.getGFColor(GFColor.primary), child: TabBar( controller: widget.controller, labelColor: widget.labelColor, diff --git a/lib/components/tabs/gf_tabs.dart b/lib/components/tabs/gf_tabs.dart index a8756c30..439bd556 100644 --- a/lib/components/tabs/gf_tabs.dart +++ b/lib/components/tabs/gf_tabs.dart @@ -192,7 +192,8 @@ class _GFTabsState extends State { length: widget.length, initialIndex: widget.initialIndex, tabBarHeight: widget.tabBarHeight, - tabBarColor: widget.tabBarColor ?? getGFColor(GFColor.primary), + tabBarColor: + widget.tabBarColor ?? GFColors.getGFColor(GFColor.primary), controller: widget.controller, labelColor: widget.labelColor, unselectedLabelColor: widget.unselectedLabelColor, diff --git a/lib/components/toast/gf_floating_widget.dart b/lib/components/toast/gf_floating_widget.dart index b6fa7076..8afd436e 100644 --- a/lib/components/toast/gf_floating_widget.dart +++ b/lib/components/toast/gf_floating_widget.dart @@ -40,10 +40,14 @@ class _GFFloatingWidgetState extends State { child: widget.body ?? Container(), ), Positioned( - top: widget.horizontalPosition != null + top: + widget.verticalPosition != null ? widget.verticalPosition : 0.0, + left: widget.horizontalPosition != null ? widget.horizontalPosition - : 0, - left: widget.verticalPosition != null ? widget.verticalPosition : 0, + : 0.0, + right: widget.horizontalPosition != null + ? widget.horizontalPosition + : 0.0, child: Container( width: MediaQuery.of(context).size.width, child: widget.child ?? Container(), diff --git a/lib/components/toast/gf_toast.dart b/lib/components/toast/gf_toast.dart index 3fc3843c..45a7f13c 100644 --- a/lib/components/toast/gf_toast.dart +++ b/lib/components/toast/gf_toast.dart @@ -83,7 +83,7 @@ class _GFToastState extends State with TickerProviderStateMixin { decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(3)), color: widget.backgroundColor != null - ? getGFColor(widget.backgroundColor) + ? GFColors.getGFColor(widget.backgroundColor) : Color(0xff323232), ), child: Row( diff --git a/lib/components/toggle/gf_toggle.dart b/lib/components/toggle/gf_toggle.dart index 3afe42eb..1d397cf5 100644 --- a/lib/components/toggle/gf_toggle.dart +++ b/lib/components/toggle/gf_toggle.dart @@ -1,7 +1,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import '../../types/gf_toggle_type.dart'; -export '../../types/gf_toggle_type.dart'; +import 'package:getflutter/types/gf_toggle_type.dart'; /// A toggle button allows the user to change a setting between two states. /// diff --git a/lib/components/typography/gf_typography.dart b/lib/components/typography/gf_typography.dart index d510bfc1..98b480f4 100644 --- a/lib/components/typography/gf_typography.dart +++ b/lib/components/typography/gf_typography.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:getflutter/colors/gf_color.dart'; import 'package:getflutter/types/gf_typography_type.dart'; -export 'package:getflutter/types/gf_typography_type.dart'; class GFTypography extends StatelessWidget { /// Creates simple title with underline. Style of title can be changed using [GFTypographyType] @@ -104,7 +103,7 @@ class GFTypography extends StatelessWidget { text, style: TextStyle( color: textColor != null - ? getGFColor(textColor) + ? GFColors.getGFColor(textColor) : backgroundImage != null ? Colors.white : Colors.black, @@ -124,7 +123,7 @@ class GFTypography extends StatelessWidget { height: fontSize / 5, decoration: BoxDecoration( color: dividerColor != null - ? getGFColor(dividerColor) + ? GFColors.getGFColor(dividerColor) : backgroundImage != null ? Colors.white : Colors.black, diff --git a/lib/getflutter.dart b/lib/getflutter.dart new file mode 100644 index 00000000..bf278aab --- /dev/null +++ b/lib/getflutter.dart @@ -0,0 +1,12 @@ +library getflutter; + +export 'colors/gf_color.dart'; +export 'position/gf_position.dart'; +export 'shape/gf_avatar_shape.dart'; +export 'shape/gf_badge_shape.dart'; +export 'shape/gf_button_shape.dart'; +export 'shape/gf_icon_button_shape.dart'; +export 'size/gf_size.dart'; +export 'types/gf_toggle_type.dart'; +export 'types/gf_button_type.dart'; +export 'types/gf_typography_type.dart'; diff --git a/lib/size/gf_size.dart b/lib/size/gf_size.dart index fba39977..96d2bcde 100644 --- a/lib/size/gf_size.dart +++ b/lib/size/gf_size.dart @@ -10,29 +10,30 @@ enum GFSize { large, } -const double SMALL = 30.0; -const double MEDIUM = 35.0; -const double LARGE = 40.0; -//const double BLOCK = 40.0; +class GFSizesClass { + static const double SMALL = 30.0; + static const double MEDIUM = 35.0; + static const double LARGE = 40.0; -/// Pass [GFSize] or [double] -double getGFSize(dynamic size) { - if (size is double) { - return size; - } else { - switch (size) { - case GFSize.small: - return SMALL; - break; - case GFSize.medium: - return MEDIUM; - break; - case GFSize.large: - return LARGE; - break; - default: - return MEDIUM; - break; + /// Pass [GFSize] or [double] + static double getGFSize(dynamic size) { + if (size is double || size is int) { + return double.parse(size.toString()); + } else { + switch (size) { + case GFSize.small: + return SMALL; + break; + case GFSize.medium: + return MEDIUM; + break; + case GFSize.large: + return LARGE; + break; + default: + return MEDIUM; + break; + } } } } diff --git a/lib/types/gf_type.dart b/lib/types/gf_button_type.dart similarity index 96% rename from lib/types/gf_type.dart rename to lib/types/gf_button_type.dart index 88475acf..b634213b 100644 --- a/lib/types/gf_type.dart +++ b/lib/types/gf_button_type.dart @@ -1,5 +1,5 @@ /// [GFType] is used to change the type of widgets -enum GFType { +enum GFButtonType { /// Default type is [GFType.solid], used to fill with color for widget solid, diff --git a/pubspec.yaml b/pubspec.yaml index 9e414623..6fb701da 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,11 +1,12 @@ name: getflutter description: GetFlutter is open source libraries that come with pre-build 1000+ UI components. It makes development faster & more enjoyable. You can customize the component as per your need. -version: 1.0.0-dev.3 +version: 1.0.0 #author: GetFlutter homepage: https://github.com/ionicfirebaseapp/getflutter environment: - sdk: ">=2.1.0 <3.0.0" + # sdk: ">=2.1.0 <3.0.0" + sdk: ">=2.2.2 <3.0.0" dependencies: flutter: