diff --git a/example/lib/fonts/icomoon.eot b/example/lib/fonts/icomoon.eot
new file mode 100644
index 00000000..9543e5a5
Binary files /dev/null and b/example/lib/fonts/icomoon.eot differ
diff --git a/example/lib/fonts/icomoon.svg b/example/lib/fonts/icomoon.svg
new file mode 100644
index 00000000..55edf066
--- /dev/null
+++ b/example/lib/fonts/icomoon.svg
@@ -0,0 +1,22 @@
+
+
+
\ No newline at end of file
diff --git a/example/lib/fonts/icomoon.ttf b/example/lib/fonts/icomoon.ttf
new file mode 100644
index 00000000..5a7e0b17
Binary files /dev/null and b/example/lib/fonts/icomoon.ttf differ
diff --git a/example/lib/fonts/icomoon.woff b/example/lib/fonts/icomoon.woff
new file mode 100644
index 00000000..b43706f4
Binary files /dev/null and b/example/lib/fonts/icomoon.woff differ
diff --git a/example/lib/main.dart b/example/lib/main.dart
index 9120c9cf..dfc5e2c8 100644
--- a/example/lib/main.dart
+++ b/example/lib/main.dart
@@ -4,17 +4,27 @@ 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/tabs/gf_segment_tabs.dart';
-import 'package:getflutter/types/gf_button_type.dart';
+import 'package:getflutter/getflutter.dart';
import 'package:getflutter/shape/gf_button_shape.dart';
import 'package:flutter/cupertino.dart';
import 'package:getflutter/components/toast/gf_toast.dart';
import 'package:getflutter/components/appbar/gf_appbar.dart';
-import 'package:getflutter/components/card/gf_card.dart';
import 'package:getflutter/components/list_tile/gf_list_tile.dart';
import 'package:getflutter/components/button/gf_button_bar.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/drawer/gf_drawer.dart';
+import 'package:getflutter/components/drawer/gf_drawer_header.dart';
+import 'package:getflutter/components/button/gf_icon_button.dart';
+import 'package:getflutter/components/image/gf_image_overlay.dart';
+import 'package:getflutter/components/card/gf_card.dart';
+import 'package:getflutter/components/tabs/gf_tabs.dart';
+import 'package:getflutter/components/tabs/gf_tabBarView.dart';
+import 'package:getflutter/types/gf_button_type.dart';
+import 'package:getflutter/position/gf_position.dart';
+import 'package:getflutter/components/tabs/gf_tabBar.dart';
+import 'dart:io';
final List imageList = [
"https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg",
@@ -52,12 +62,16 @@ class MyHomePage extends StatefulWidget {
class _MyHomePageState extends State
with SingleTickerProviderStateMixin {
+ static final GlobalKey scaffoldKey =
+ new GlobalKey();
+
TabController tabController;
@override
void initState() {
super.initState();
tabController = TabController(length: 3, vsync: this);
+ _searchQuery = new TextEditingController();
}
@override
@@ -69,75 +83,207 @@ class _MyHomePageState extends State
bool switchValue = true;
bool showToast = false;
+ Widget appBarTitle = new Text("UI Kit");
+ Icon actionIcon = new Icon(Icons.search);
+
+ TextEditingController _searchQuery;
+ bool _isSearching = false;
+ String searchQuery = "Search query";
+
+ void _startSearch() {
+ ModalRoute.of(context)
+ .addLocalHistoryEntry(new LocalHistoryEntry(onRemove: _stopSearching));
+
+ setState(() {
+ _isSearching = true;
+ });
+ }
+
+ void _stopSearching() {
+ _clearSearchQuery();
+
+ setState(() {
+ _isSearching = false;
+ });
+ }
+
+ void _clearSearchQuery() {
+ setState(() {
+ _searchQuery.clear();
+ updateSearchQuery("Search query");
+ });
+ }
+
+ Widget _buildTitle(BuildContext context) {
+ var horizontalTitleAlignment =
+ Platform.isIOS ? CrossAxisAlignment.center : CrossAxisAlignment.start;
+
+ return new InkWell(
+ onTap: () => scaffoldKey.currentState.openDrawer(),
+ child: new Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 12.0),
+ child: new Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ crossAxisAlignment: horizontalTitleAlignment,
+ children: [
+ const Text('Seach box'),
+ ],
+ ),
+ ),
+ );
+ }
+
+ Widget _buildSearchField() {
+ return new TextField(
+ controller: _searchQuery,
+ autofocus: true,
+ decoration: const InputDecoration(
+ hintText: 'Search...',
+ border: InputBorder.none,
+ hintStyle: const TextStyle(color: Colors.white30),
+ ),
+ style: const TextStyle(color: Colors.white, fontSize: 16.0),
+ onChanged: updateSearchQuery,
+ );
+ }
+
+ void updateSearchQuery(String newQuery) {
+ setState(() {
+ searchQuery = newQuery;
+ });
+ print("search query " + newQuery);
+ }
+
+ List _buildActions() {
+ if (_isSearching) {
+ return [
+ new IconButton(
+ icon: const Icon(Icons.clear),
+ onPressed: () {
+ if (_searchQuery == null || _searchQuery.text.isEmpty) {
+ Navigator.pop(context);
+ return;
+ }
+ _clearSearchQuery();
+ },
+ ),
+ ];
+ }
+
+ return [
+ new IconButton(
+ icon: const Icon(Icons.search),
+ onPressed: _startSearch,
+ ),
+ ];
+ }
+
@override
Widget build(BuildContext context) {
return Scaffold(
-// drawer: GFDrawer(
-// colorFilter: new ColorFilter.mode(Colors.black.withOpacity(0.6), BlendMode.darken),
-// backgroundImage: NetworkImage("https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg"),
-// gradient: LinearGradient(
-// begin: Alignment.topRight,
-// end: Alignment.bottomLeft,
-// stops: [0.1, 0.5, 0.7, 0.9],
-// colors: [
-// Colors.teal[800],
-// Colors.teal[600],
-// Colors.teal[400],
-// Colors.teal[200],
-// ],
-// ),
-// child: ListView(
-// padding: EdgeInsets.zero,
-// children: [
-// GFDrawerHeader(
-// currentAccountPicture: GFAvatar(
-// radius: 80.0,
-// backgroundImage: NetworkImage("https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg"),
-// ),
-//
-// decoration: BoxDecoration(
-// color: Colors.teal.withOpacity(0.45),
-// ),
-// otherAccountsPictures: [
-// Image(
-// image: NetworkImage("https://cdn.pixabay.com/photo/2019/12/20/00/03/road-4707345_960_720.jpg"),
-// fit: BoxFit.cover,
-// ),
-// GFAvatar(
-// child: Text("dcf"),
-// )
-// ],
-// child: Column(
-// mainAxisAlignment: MainAxisAlignment.start,
-// crossAxisAlignment: CrossAxisAlignment.start,
-// children: [
-// Text('user'),
-// Text('user@asdf.com'),
-// ],
-// ),
-// ),
-// ListTile(
-// title: Text('Item 1'),
-// onTap: () {
-// Navigator.pop(context);
-// },
-// ),
-// ListTile(
-// title: Text('Item 2'),
-// onTap: () {
-// },
-// ),
-// ],
-// ),
-// ),
- appBar: GFAppBar(
- backgroundColor: Colors.tealAccent,
- centerTitle: true,
- title: Text("UI KIT"),
-// trailing: [
-// GFIconButton(icon: Icon(Icons.directions_bus), onPressed: null)
-// ],
+ drawer: GFDrawer(
+ colorFilter: new ColorFilter.mode(
+ Colors.black.withOpacity(0.6), BlendMode.darken),
+ backgroundImage: NetworkImage(
+ "https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg"),
+ gradient: LinearGradient(
+ begin: Alignment.topRight,
+ end: Alignment.bottomLeft,
+ stops: [0.1, 0.5, 0.7, 0.9],
+ colors: [
+ Colors.teal[800],
+ Colors.teal[600],
+ Colors.teal[400],
+ Colors.teal[200],
+ ],
+ ),
+ child: ListView(
+ padding: EdgeInsets.zero,
+ children: [
+ GFDrawerHeader(
+ currentAccountPicture: GFAvatar(
+ radius: 80.0,
+ backgroundImage: NetworkImage(
+ "https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg"),
+ ),
+ decoration: BoxDecoration(
+ color: Colors.teal.withOpacity(0.45),
+ ),
+ otherAccountsPictures: [
+ Image(
+ image: NetworkImage(
+ "https://cdn.pixabay.com/photo/2019/12/20/00/03/road-4707345_960_720.jpg"),
+ fit: BoxFit.cover,
+ ),
+ GFAvatar(
+ child: Text("dcf"),
+ )
+ ],
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text('user'),
+ Text('user@asdf.com'),
+ ],
+ ),
+ ),
+ ListTile(
+ title: Text('Item 1'),
+ onTap: () {
+ Navigator.pop(context);
+ },
+ ),
+ ListTile(
+ title: Text('Item 2'),
+ onTap: () {},
+ ),
+ ],
+ ),
),
+ appBar: AppBar(
+ leading: _isSearching ? const BackButton() : null,
+ title: _isSearching ? _buildSearchField() : _buildTitle(context),
+ actions: _buildActions(),
+ ),
+// GFAppBar(
+//// backgroundColor: Colors.tealAccent,
+// centerTitle: true,
+//// leading: GFIconButton(icon: Icon(Icons.directions_bus), onPressed: (){}),
+// title: appBarTitle,
+//// bottom: TabBar(
+//// controller: tabController,
+//// tabs: [
+//// Tab(icon: Icon(Icons.directions_car)),
+//// Tab(icon: Icon(Icons.directions_transit)),
+//// Tab(icon: Icon(Icons.directions_bike)),
+//// ],
+//// ),
+// actions: [
+// new IconButton(
+// icon: actionIcon,
+// onPressed: () {
+// setState(() {
+// if (this.actionIcon.icon == Icons.search) {
+// this.actionIcon = new Icon(Icons.close);
+// this.appBarTitle = new TextField(
+// style: new TextStyle(
+// color: Colors.white,
+// ),
+// decoration: new InputDecoration(
+// prefixIcon: new Icon(Icons.search, color: Colors.white),
+// hintText: "Search...",
+// hintStyle: new TextStyle(color: Colors.white)),
+// );
+// } else {
+// this.actionIcon = new Icon(Icons.search);
+// this.appBarTitle = new Text("UI Kit");
+// }
+// });
+// },
+// ),
+// ],
+// ),
// backgroundColor: Colors.teal,
body:
// GFTabBarView(
@@ -153,6 +299,12 @@ class _MyHomePageState extends State
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
+ GFIconButton(
+ icon: Icon(Icons.title),
+ onPressed: null,
+// color: GFColor.secondary,
+ ),
+
GFCard(
content: Column(
children: [
@@ -163,16 +315,6 @@ class _MyHomePageState extends State
SizedBox(
height: 20,
),
- GFButtonBar(
- children: [
- GFButton(
- onPressed: () {},
- ),
- GFButton(
- onPressed: () {},
- ),
- ],
- ),
SizedBox(
height: 20,
),
@@ -199,7 +341,7 @@ class _MyHomePageState extends State
type: GFTypographyType.typo6,
),
GFFloatingWidget(
- verticalPosition: 80,
+ verticalPosition: 100,
child: showToast
? GFToast(
width: 300,
@@ -445,7 +587,7 @@ class _MyHomePageState extends State
// ),
GFListTile(
- padding: EdgeInsets.all(8.0),
+ padding: EdgeInsets.all(30.0),
color: Colors.redAccent,
avatar: GFAvatar(
child: Text("tb"),
@@ -513,18 +655,28 @@ class _MyHomePageState extends State
// ),
// ),
//
-// GFCard(
-// content: GFImageOverlay(
-// height: 200.0,
-// width: 200.0,
-// image: AssetImage("lib/assets/food.jpeg"),
-// boxFit: BoxFit.fill,
-// colorFilter: new ColorFilter.mode(
-// Colors.black.withOpacity(0.67), BlendMode.darken),
+ GFCard(
+ content: Row(
+ children: [
+ GFImageOverlay(
+ height: 200.0,
+ width: 200.0,
+ image: AssetImage("lib/assets/food.jpeg"),
+ boxFit: BoxFit.fill,
+ colorFilter: new ColorFilter.mode(
+ Colors.black.withOpacity(0.67), BlendMode.darken),
// shape: BoxShape.circle,
-// ),
-// ),
-//
+ ),
+ ],
+ )),
+
+ // Image.asset(
+ // 'lib/assets/food.jpeg',
+ // fit: BoxFit.cover,
+ // color: Color(0xff0d69ff).withOpacity(1.0),
+ // colorBlendMode: BlendMode.softLight,
+ // ),
+
// GFCard(
// content: Container(
// width: 190.0,
@@ -676,14 +828,11 @@ class _MyHomePageState extends State
],
),
-// GFTabBarView(
-// controller: tabController,
-// 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,
@@ -732,38 +881,54 @@ class _MyHomePageState extends State
// },
// ),
-//
-// GFTabs(
-// initialIndex: 0,
-// length: 3,
-// tabs: [
-// Tab(
+ GFTabs(
+ initialIndex: 0,
+ length: 3,
+ tabs: [
+ Tab(
// icon: Icon(Icons.directions_bike),
-// child: Text(
-// "Tab1",
-// ),
-// ),
-// Tab(
+ icon: Icon(
+ IconData(0xe907, fontFamily: 'icomoon'),
+ ),
+ child: Text(
+ "Tab1",
+ ),
+ ),
+ Tab(
// icon: Icon(Icons.directions_bus),
-// child: Text(
-// "Tab2",
-// ),
-// ),
-// Tab(
-// icon: Icon(Icons.directions_railway),
-// child: Text(
-// "Tab3",
-// ),
-// ),
-// ],
-// tabBarView: GFTabBarView(
-// children: [
-// 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,),
-// ],
-// ),
-// ),
+ icon: Icon(
+ IconData(0xe900, fontFamily: 'icomoon'),
+ ),
+ child: Text(
+ "Tab2",
+ ),
+ ),
+ Tab(
+ icon: Icon(
+ IconData(0xe904, fontFamily: 'icomoon'),
+ ),
+ child: Text(
+ "Tab3",
+ ),
+ ),
+ ],
+ tabBarView: GFTabBarView(
+ children: [
+ 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,
+ ),
+ ],
+ ),
+ ),
//
// GFCarousel(
// autoPlay: true,
@@ -791,58 +956,66 @@ class _MyHomePageState extends State
// },
// ),
-// GFCard(
-// boxFit: BoxFit.fill,
-// colorFilter: new ColorFilter.mode(
-// Colors.black.withOpacity(0.67), BlendMode.darken),
-// image: Image.asset(
-// "lib/assets/img.png",
-// fit: BoxFit.fitWidth,
-// width: 400.0,
-// ),
-//// 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: GFButtonType.transparent,
-// ),
-// ),
-// content: Text(
-// "Flutter Flutter is Google's mobile UI framework for crafting"
-// "Flutter Flutter is Google's mobile UI framework for crafting",
-// style: TextStyle(color: Colors.grey),
-// ),
-//// buttonBar: GFButtonBar(
-//// mainAxisSize: MainAxisSize.min,
-//// children: [
-//// GFButton(
-//// onPressed: null,
-//// child: Text("favorite"),
-//// icon: Icon(Icons.favorite_border),
-//// type: GFButtonType.transparent,
-//// ),
-//// GFButton(
-//// onPressed: null,
-//// child: Text("share"),
-//// icon: Icon(Icons.share),
-//// type: GFButtonType.outline,
-//// ),
-//// ],
-//// ),
-// ),
+ GFCard(
+ boxFit: BoxFit.fill,
+ colorFilter: new ColorFilter.mode(
+ Colors.black.withOpacity(0.67), BlendMode.darken),
+ image: Image.asset(
+ "lib/assets/img.png",
+ fit: BoxFit.fitWidth,
+ width: 400.0,
+ ),
+// 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'
+ "Flutter Flutter is Google's mobile UI framework for crafting"
+ "Flutter Flutter is Google's mobile UI framework for crafting",
+ style: TextStyle(color: Colors.grey),
+ ),
+ icon: GFIconButton(
+ onPressed: null,
+ icon: Icon(Icons.favorite),
+ type: GFButtonType.transparent,
+ ),
+ ),
+ content: Text(
+ "Flutter Flutter is Google's mobile UI framework for crafting"
+ "Flutter Flutter is Google's mobile UI framework for crafting"
+ "Flutter Flutter is Google's mobile UI framework for crafting"
+ "Flutter Flutter is Google's mobile UI framework for crafting",
+ style: TextStyle(color: Colors.grey),
+ ),
+ buttonBar: GFButtonBar(
+ children: [
+ GFButton(
+ onPressed: null,
+ child: Text("favorite"),
+ icon: Icon(Icons.favorite_border),
+ type: GFButtonType.transparent,
+ ),
+ GFButton(
+ onPressed: null,
+ child: Text("share"),
+ icon: Icon(Icons.share),
+ type: GFButtonType.outline,
+ ),
+ GFButton(
+ onPressed: null,
+ child: Text("share"),
+ icon: Icon(Icons.share),
+ ),
+ ],
+ ),
+ ),
// GFButtonBar(
// mainAxisSize: MainAxisSize.min,
@@ -1010,24 +1183,24 @@ class _MyHomePageState extends State
// ),
// ),
-// GFIconButton(
-// onPressed: (){},
-// icon: Icon(Icons.ac_unit),
-//// iconSize: 12.0,
-//// type: GFButtonType.solid,
-//// shape: GFIconButtonShape.pills,
-//// size: GFSize.large,
-//// buttonBoxShadow: true,
-//// color: GFColor.warning,
-//// 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),
-// ),
+ GFIconButton(
+ onPressed: () {},
+ icon: Icon(Icons.ac_unit),
+// iconSize: 12.0,
+// type: GFType.solid,
+// shape: GFIconButtonShape.pills,
+// size: GFSize.large,
+// buttonBoxShadow: true,
+// color: GFColor.warning,
+// 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),
+ ),
//
// GFBadge(
// text: '12',
diff --git a/example/pubspec.yaml b/example/pubspec.yaml
index d940393a..6d9bcc20 100644
--- a/example/pubspec.yaml
+++ b/example/pubspec.yaml
@@ -20,6 +20,11 @@ dev_dependencies:
flutter:
uses-material-design: true
+ fonts:
+ - family: icomoon
+ fonts:
+ - asset: lib/fonts/icomoon.ttf
+
assets:
- lib/assets/food.jpeg
- lib/assets/img.png
diff --git a/example/web/index.html b/example/web/index.html
deleted file mode 100644
index 01c86d07..00000000
--- a/example/web/index.html
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
- getflutter_example
-
-
-
-
-
diff --git a/lib/components/appbar/gf_appbar.dart b/lib/components/appbar/gf_appbar.dart
index a3a7af0d..f0326879 100644
--- a/lib/components/appbar/gf_appbar.dart
+++ b/lib/components/appbar/gf_appbar.dart
@@ -1,4 +1,3 @@
-import 'dart:math' as math;
import 'package:flutter/foundation.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
@@ -27,7 +26,7 @@ class GFAppBar extends StatefulWidget implements PreferredSizeWidget {
this.leading,
this.automaticallyImplyLeading = true,
this.title,
- this.trailing,
+ this.actions,
this.flexibleSpace,
this.bottom,
this.elevation,
@@ -73,7 +72,7 @@ class GFAppBar extends StatefulWidget implements PreferredSizeWidget {
/// Typically these widgets are [IconButton]s representing common operations.
/// For less common operations, consider using a [PopupMenuButton] as the
/// last action.
- final List trailing;
+ final List actions;
/// This widget is stacked behind the toolbar and the tab bar. It's height will
/// be the same as the app bar's overall height.
@@ -201,7 +200,7 @@ class GFAppBar extends StatefulWidget implements PreferredSizeWidget {
case TargetPlatform.fuchsia:
return false;
case TargetPlatform.iOS:
- return trailing == null || trailing.length < 2;
+ return actions == null || actions.length < 2;
default:
return false;
}
@@ -311,11 +310,11 @@ class _GFAppBarState extends State {
}
Widget actions;
- if (widget.trailing != null && widget.trailing.isNotEmpty) {
+ if (widget.actions != null && widget.actions.isNotEmpty) {
actions = Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
- children: widget.trailing,
+ children: widget.actions,
);
} else if (hasEndDrawer) {
actions = IconButton(
@@ -325,7 +324,7 @@ class _GFAppBarState extends State {
);
}
- // Allow the trailing actions to have their own theme if necessary.
+ // Allow the actions actions to have their own theme if necessary.
if (actions != null) {
actions = IconTheme.merge(
data: actionsIconTheme,
@@ -396,6 +395,7 @@ class _GFAppBarState extends State {
],
);
}
+
final Brightness brightness = widget.brightness ??
appBarTheme.brightness ??
theme.primaryColorBrightness;
@@ -423,58 +423,6 @@ class _GFAppBarState extends State {
}
}
-class _FloatingGFAppBar extends StatefulWidget {
- const _FloatingGFAppBar({Key key, this.child}) : super(key: key);
-
- final Widget child;
-
- @override
- _FloatingGFAppBarState createState() => _FloatingGFAppBarState();
-}
-
-// A wrapper for the widget created by _SliverGFAppBarDelegate that starts and
-// stops the floating app bar's snap-into-view or snap-out-of-view animation.
-class _FloatingGFAppBarState extends State<_FloatingGFAppBar> {
- ScrollPosition _position;
-
- @override
- void didChangeDependencies() {
- super.didChangeDependencies();
- if (_position != null)
- _position.isScrollingNotifier.removeListener(_isScrollingListener);
- _position = Scrollable.of(context)?.position;
- if (_position != null)
- _position.isScrollingNotifier.addListener(_isScrollingListener);
- }
-
- @override
- void dispose() {
- if (_position != null)
- _position.isScrollingNotifier.removeListener(_isScrollingListener);
- super.dispose();
- }
-
- RenderSliverFloatingPersistentHeader _headerRenderer() {
- return context
- .findAncestorRenderObjectOfType();
- }
-
- void _isScrollingListener() {
- if (_position == null) return;
-
- // When a scroll stops, then maybe snap the appbar into view.
- // Similarly, when a scroll starts, then maybe stop the snap animation.
- final RenderSliverFloatingPersistentHeader header = _headerRenderer();
- if (_position.isScrollingNotifier.value)
- header?.maybeStopSnapAnimation(_position.userScrollDirection);
- else
- header?.maybeStartSnapAnimation(_position.userScrollDirection);
- }
-
- @override
- Widget build(BuildContext context) => widget.child;
-}
-
const double _kLeadingWidth = kToolbarHeight;
class _ToolbarContainerLayout extends SingleChildLayoutDelegate {
@@ -499,576 +447,6 @@ class _ToolbarContainerLayout extends SingleChildLayoutDelegate {
bool shouldRelayout(_ToolbarContainerLayout oldDelegate) => false;
}
-class _SliverGFAppBarDelegate extends SliverPersistentHeaderDelegate {
- _SliverGFAppBarDelegate({
- @required this.leading,
- @required this.automaticallyImplyLeading,
- @required this.title,
- @required this.actions,
- @required this.flexibleSpace,
- @required this.bottom,
- @required this.elevation,
- @required this.forceElevated,
- @required this.backgroundColor,
- @required this.brightness,
- @required this.iconTheme,
- @required this.actionsIconTheme,
- @required this.textTheme,
- @required this.primary,
- @required this.centerTitle,
- @required this.titleSpacing,
- @required this.expandedHeight,
- @required this.collapsedHeight,
- @required this.topPadding,
- @required this.floating,
- @required this.pinned,
- @required this.snapConfiguration,
- @required this.stretchConfiguration,
- @required this.shape,
- }) : assert(primary || topPadding == 0.0),
- _bottomHeight = bottom?.preferredSize?.height ?? 0.0;
-
- final Widget leading;
- final bool automaticallyImplyLeading;
- final Widget title;
- final List actions;
- final Widget flexibleSpace;
- final PreferredSizeWidget bottom;
- final double elevation;
- final bool forceElevated;
- final Color backgroundColor;
- final Brightness brightness;
- final IconThemeData iconTheme;
- final IconThemeData actionsIconTheme;
- final TextTheme textTheme;
- final bool primary;
- final bool centerTitle;
- final double titleSpacing;
- final double expandedHeight;
- final double collapsedHeight;
- final double topPadding;
- final bool floating;
- final bool pinned;
- final ShapeBorder shape;
-
- final double _bottomHeight;
-
- @override
- double get minExtent =>
- collapsedHeight ?? (topPadding + kToolbarHeight + _bottomHeight);
-
- @override
- double get maxExtent => math.max(
- topPadding + (expandedHeight ?? kToolbarHeight + _bottomHeight),
- minExtent);
-
- @override
- final FloatingHeaderSnapConfiguration snapConfiguration;
-
- @override
- final OverScrollHeaderStretchConfiguration stretchConfiguration;
-
- @override
- Widget build(
- BuildContext context, double shrinkOffset, bool overlapsContent) {
- final double visibleMainHeight = maxExtent - shrinkOffset - topPadding;
-
- // Truth table for `toolbarOpacity`:
- // pinned | floating | bottom != null || opacity
- // ----------------------------------------------
- // 0 | 0 | 0 || fade
- // 0 | 0 | 1 || fade
- // 0 | 1 | 0 || fade
- // 0 | 1 | 1 || fade
- // 1 | 0 | 0 || 1.0
- // 1 | 0 | 1 || 1.0
- // 1 | 1 | 0 || 1.0
- // 1 | 1 | 1 || fade
- final double toolbarOpacity = !pinned || (floating && bottom != null)
- ? ((visibleMainHeight - _bottomHeight) / kToolbarHeight).clamp(0.0, 1.0)
- : 1.0;
-
- final Widget appBar = FlexibleSpaceBar.createSettings(
- minExtent: minExtent,
- maxExtent: maxExtent,
- currentExtent: math.max(minExtent, maxExtent - shrinkOffset),
- toolbarOpacity: toolbarOpacity,
- child: GFAppBar(
- leading: leading,
- automaticallyImplyLeading: automaticallyImplyLeading,
- title: title,
- trailing: actions,
- flexibleSpace: (title == null && flexibleSpace != null)
- ? Semantics(child: flexibleSpace, header: true)
- : flexibleSpace,
- bottom: bottom,
- elevation: forceElevated ||
- overlapsContent ||
- (pinned && shrinkOffset > maxExtent - minExtent)
- ? elevation ?? 4.0
- : 0.0,
- backgroundColor: backgroundColor,
- brightness: brightness,
- iconTheme: iconTheme,
- actionsIconTheme: actionsIconTheme,
- textTheme: textTheme,
- primary: primary,
- centerTitle: centerTitle,
- titleSpacing: titleSpacing,
- shape: shape,
- toolbarOpacity: toolbarOpacity,
- bottomOpacity:
- pinned ? 1.0 : (visibleMainHeight / _bottomHeight).clamp(0.0, 1.0),
- ),
- );
- return floating ? _FloatingGFAppBar(child: appBar) : appBar;
- }
-
- @override
- bool shouldRebuild(covariant _SliverGFAppBarDelegate oldDelegate) {
- return leading != oldDelegate.leading ||
- automaticallyImplyLeading != oldDelegate.automaticallyImplyLeading ||
- title != oldDelegate.title ||
- actions != oldDelegate.actions ||
- flexibleSpace != oldDelegate.flexibleSpace ||
- bottom != oldDelegate.bottom ||
- _bottomHeight != oldDelegate._bottomHeight ||
- elevation != oldDelegate.elevation ||
- backgroundColor != oldDelegate.backgroundColor ||
- brightness != oldDelegate.brightness ||
- iconTheme != oldDelegate.iconTheme ||
- actionsIconTheme != oldDelegate.actionsIconTheme ||
- textTheme != oldDelegate.textTheme ||
- primary != oldDelegate.primary ||
- centerTitle != oldDelegate.centerTitle ||
- titleSpacing != oldDelegate.titleSpacing ||
- expandedHeight != oldDelegate.expandedHeight ||
- topPadding != oldDelegate.topPadding ||
- pinned != oldDelegate.pinned ||
- floating != oldDelegate.floating ||
- snapConfiguration != oldDelegate.snapConfiguration ||
- stretchConfiguration != oldDelegate.stretchConfiguration;
- }
-
- @override
- String toString() {
- return '${describeIdentity(this)}(topPadding: ${topPadding.toStringAsFixed(1)}, bottomHeight: ${_bottomHeight.toStringAsFixed(1)}, ...)';
- }
-}
-
-/// A material design app bar that integrates with a [CustomScrollView].
-///
-/// An app bar consists of a toolbar and potentially other widgets, such as a
-/// [TabBar] and a [FlexibleSpaceBar]. App bars typically expose one or more
-/// common actions with [IconButton]s which are optionally followed by a
-/// [PopupMenuButton] for less common operations.
-///
-/// {@youtube 560 315 https://www.youtube.com/watch?v=R9C5KMJKluE}
-///
-/// Sliver app bars are typically used as the first child of a
-/// [CustomScrollView], which lets the app bar integrate with the scroll view so
-/// that it can vary in height according to the scroll offset or float above the
-/// other content in the scroll view. For a fixed-height app bar at the top of
-/// the screen see [GFAppBar], which is used in the [Scaffold.appBar] slot.
-///
-/// The GFAppBar displays the toolbar widgets, [leading], [title], and
-/// [actions], above the [bottom] (if any). If a [flexibleSpace] widget is
-/// specified then it is stacked behind the toolbar and the bottom widget.
-///
-class SliverGFAppBar extends StatefulWidget {
- /// Creates a material design app bar that can be placed in a [CustomScrollView].
- ///
- /// The arguments [forceElevated], [primary], [floating], [pinned], [snap]
- /// and [automaticallyImplyLeading] must not be null.
- const SliverGFAppBar({
- Key key,
- this.leading,
- this.automaticallyImplyLeading = true,
- this.title,
- this.actions,
- this.flexibleSpace,
- this.bottom,
- this.elevation,
- this.forceElevated = false,
- this.backgroundColor,
- this.brightness,
- this.iconTheme,
- this.actionsIconTheme,
- this.textTheme,
- this.primary = true,
- this.centerTitle,
- this.titleSpacing = NavigationToolbar.kMiddleSpacing,
- this.expandedHeight,
- this.floating = false,
- this.pinned = false,
- this.snap = false,
- this.stretch = false,
- this.stretchTriggerOffset = 100.0,
- this.onStretchTrigger,
- this.shape,
- }) : assert(automaticallyImplyLeading != null),
- assert(forceElevated != null),
- assert(primary != null),
- assert(titleSpacing != null),
- assert(floating != null),
- assert(pinned != null),
- assert(snap != null),
- assert(stretch != null),
- assert(floating || !snap,
- 'The "snap" argument only makes sense for floating app bars.'),
- assert(stretchTriggerOffset > 0.0),
- super(key: key);
-
- /// A widget to display before the [title].
- ///
- /// If this is null and [automaticallyImplyLeading] is set to true, the [GFAppBar] will
- /// imply an appropriate widget. For example, if the [GFAppBar] is in a [Scaffold]
- /// that also has a [Drawer], the [Scaffold] will fill this widget with an
- /// [IconButton] that opens the drawer. If there's no [Drawer] and the parent
- /// [Navigator] can go back, the [GFAppBar] will use a [BackButton] that calls
- /// [Navigator.maybePop].
- final Widget leading;
-
- /// Controls whether we should try to imply the leading widget if null.
- ///
- /// If true and [leading] is null, automatically try to deduce what the leading
- /// widget should be. If false and [leading] is null, leading space is given to [title].
- /// If leading widget is not null, this parameter has no effect.
- final bool automaticallyImplyLeading;
-
- /// The primary widget displayed in the app bar.
- ///
- /// Typically a [Text] widget containing a description of the current contents
- /// of the app.
- final Widget title;
-
- /// Widgets to display after the [title] widget.
- ///
- /// Typically these widgets are [IconButton]s representing common operations.
- /// For less common operations, consider using a [PopupMenuButton] as the
- /// last action.
- ///
- /// {@tool sample}
- ///
- /// ```dart
- /// Scaffold(
- /// body: CustomScrollView(
- /// primary: true,
- /// slivers: [
- /// SliverGFAppBar(
- /// title: Text('Hello World'),
- /// actions: [
- /// IconButton(
- /// icon: Icon(Icons.shopping_cart),
- /// tooltip: 'Open shopping cart',
- /// onPressed: () {
- /// // handle the press
- /// },
- /// ),
- /// ],
- /// ),
- /// // ...rest of body...
- /// ],
- /// ),
- /// )
- /// ```
- /// {@end-tool}
- final List actions;
-
- /// This widget is stacked behind the toolbar and the tab bar. It's height will
- /// be the same as the app bar's overall height.
- ///
- /// Typically a [FlexibleSpaceBar]. See [FlexibleSpaceBar] for details.
- final Widget flexibleSpace;
-
- /// This widget appears across the bottom of the app bar.
- ///
- /// Typically a [TabBar]. Only widgets that implement [PreferredSizeWidget] can
- /// be used at the bottom of an app bar.
- ///
- /// See also:
- ///
- /// * [PreferredSize], which can be used to give an arbitrary widget a preferred size.
- final PreferredSizeWidget bottom;
-
- /// The z-coordinate at which to place this app bar when it is above other
- /// content. This controls the size of the shadow below the app bar.
- ///
- /// If this property is null, then [ThemeData.appBarTheme.elevation] is used,
- /// if that is also null, the default value is 4, the appropriate elevation
- /// for app bars.
- ///
- /// If [forceElevated] is false, the elevation is ignored when the app bar has
- /// no content underneath it. For example, if the app bar is [pinned] but no
- /// content is scrolled under it, or if it scrolls with the content, then no
- /// shadow is drawn, regardless of the value of [elevation].
- final double elevation;
-
- /// Whether to show the shadow appropriate for the [elevation] even if the
- /// content is not scrolled under the [GFAppBar].
- ///
- /// Defaults to false, meaning that the [elevation] is only applied when the
- /// [GFAppBar] is being displayed over content that is scrolled under it.
- ///
- /// When set to true, the [elevation] is applied regardless.
- ///
- /// Ignored when [elevation] is zero.
- final bool forceElevated;
-
- /// The color to use for the app bar's material. Typically this should be set
- /// along with [brightness], [iconTheme], [textTheme].
- ///
- /// If this property is null, then [ThemeData.appBarTheme.color] is used,
- /// if that is also null, then [ThemeData.primaryColor] is used.
- final Color backgroundColor;
-
- /// The brightness of the app bar's material. Typically this is set along
- /// with [backgroundColor], [iconTheme], [textTheme].
- ///
- /// If this property is null, then [ThemeData.appBarTheme.brightness] is used,
- /// if that is also null, then [ThemeData.primaryColorBrightness] is used.
- final Brightness brightness;
-
- /// The color, opacity, and size to use for app bar icons. Typically this
- /// is set along with [backgroundColor], [brightness], [textTheme].
- ///
- /// If this property is null, then [ThemeData.appBarTheme.iconTheme] is used,
- /// if that is also null, then [ThemeData.primaryIconTheme] is used.
- final IconThemeData iconTheme;
-
- /// The color, opacity, and size to use for trailing app bar icons. This
- /// should only be used when the trailing icons should be themed differently
- /// than the leading icons.
- ///
- /// If this property is null, then [ThemeData.appBarTheme.actionsIconTheme] is
- /// used, if that is also null, then this falls back to [iconTheme].
- final IconThemeData actionsIconTheme;
-
- /// The typographic styles to use for text in the app bar. Typically this is
- /// set along with [brightness] [backgroundColor], [iconTheme].
- ///
- /// If this property is null, then [ThemeData.appBarTheme.textTheme] is used,
- /// if that is also null, then [ThemeData.primaryTextTheme] is used.
- final TextTheme textTheme;
-
- /// Whether this app bar is being displayed at the top of the screen.
- ///
- /// If this is true, the top padding specified by the [MediaQuery] will be
- /// added to the top of the toolbar.
- final bool primary;
-
- /// Whether the title should be centered.
- ///
- /// Defaults to being adapted to the current [TargetPlatform].
- final bool centerTitle;
-
- /// The spacing around [title] content on the horizontal axis. This spacing is
- /// applied even if there is no [leading] content or [actions]. If you want
- /// [title] to take all the space available, set this value to 0.0.
- ///
- /// Defaults to [NavigationToolbar.kMiddleSpacing].
- final double titleSpacing;
-
- /// The size of the app bar when it is fully expanded.
- ///
- /// By default, the total height of the toolbar and the bottom widget (if
- /// any). If a [flexibleSpace] widget is specified this height should be big
- /// enough to accommodate whatever that widget contains.
- ///
- /// This does not include the status bar height (which will be automatically
- /// included if [primary] is true).
- final double expandedHeight;
-
- /// Whether the app bar should become visible as soon as the user scrolls
- /// towards the app bar.
- ///
- /// Otherwise, the user will need to scroll near the top of the scroll view to
- /// reveal the app bar.
- ///
- /// If [snap] is true then a scroll that exposes the app bar will trigger an
- /// animation that slides the entire app bar into view. Similarly if a scroll
- /// dismisses the app bar, the animation will slide it completely out of view.
- ///
- /// ## Animated Examples
- ///
- /// The following animations show how the app bar changes its scrolling
- /// behavior based on the value of this property.
- ///
- /// * App bar with [floating] set to false:
- /// {@animation 476 400 https://flutter.github.io/assets-for-api-docs/assets/material/app_bar.mp4}
- /// * App bar with [floating] set to true:
- /// {@animation 476 400 https://flutter.github.io/assets-for-api-docs/assets/material/app_bar_floating.mp4}
- ///
- /// See also:
- ///
- /// * [SliverGFAppBar] for more animated examples of how this property changes the
- /// behavior of the app bar in combination with [pinned] and [snap].
- final bool floating;
-
- /// Whether the app bar should remain visible at the start of the scroll view.
- ///
- /// The app bar can still expand and contract as the user scrolls, but it will
- /// remain visible rather than being scrolled out of view.
- ///
- /// ## Animated Examples
- ///
- /// The following animations show how the app bar changes its scrolling
- /// behavior based on the value of this property.
- ///
- /// * App bar with [pinned] set to false:
- /// {@animation 476 400 https://flutter.github.io/assets-for-api-docs/assets/material/app_bar.mp4}
- /// * App bar with [pinned] set to true:
- /// {@animation 476 400 https://flutter.github.io/assets-for-api-docs/assets/material/app_bar_pinned.mp4}
- ///
- /// See also:
- ///
- /// * [SliverGFAppBar] for more animated examples of how this property changes the
- /// behavior of the app bar in combination with [floating].
- final bool pinned;
-
- /// The material's shape as well as its shadow.
- ///
- /// A shadow is only displayed if the [elevation] is greater than zero.
- final ShapeBorder shape;
-
- /// If [snap] and [floating] are true then the floating app bar will "snap"
- /// into view.
- ///
- /// If [snap] is true then a scroll that exposes the floating app bar will
- /// trigger an animation that slides the entire app bar into view. Similarly if
- /// a scroll dismisses the app bar, the animation will slide the app bar
- /// completely out of view.
- ///
- /// Snapping only applies when the app bar is floating, not when the app bar
- /// appears at the top of its scroll view.
- ///
- /// ## Animated Examples
- ///
- /// The following animations show how the app bar changes its scrolling
- /// behavior based on the value of this property.
- ///
- /// * App bar with [snap] set to false:
- /// {@animation 476 400 https://flutter.github.io/assets-for-api-docs/assets/material/app_bar_floating.mp4}
- /// * App bar with [snap] set to true:
- /// {@animation 476 400 https://flutter.github.io/assets-for-api-docs/assets/material/app_bar_floating_snap.mp4}
- ///
- /// See also:
- ///
- /// * [SliverGFAppBar] for more animated examples of how this property changes the
- /// behavior of the app bar in combination with [pinned] and [floating].
- final bool snap;
-
- /// Whether the app bar should stretch to fill the over-scroll area.
- ///
- /// The app bar can still expand and contract as the user scrolls, but it will
- /// also stretch when the user over-scrolls.
- final bool stretch;
-
- /// The offset of overscroll required to activate [onStretchTrigger].
- ///
- /// This defaults to 100.0.
- final double stretchTriggerOffset;
-
- /// The callback function to be executed when a user over-scrolls to the
- /// offset specified by [stretchTriggerOffset].
- final AsyncCallback onStretchTrigger;
-
- @override
- _SliverGFAppBarState createState() => _SliverGFAppBarState();
-}
-
-// This class is only Stateful because it owns the TickerProvider used
-// by the floating appbar snap animation (via FloatingHeaderSnapConfiguration).
-class _SliverGFAppBarState extends State
- with TickerProviderStateMixin {
- FloatingHeaderSnapConfiguration _snapConfiguration;
- OverScrollHeaderStretchConfiguration _stretchConfiguration;
-
- void _updateSnapConfiguration() {
- if (widget.snap && widget.floating) {
- _snapConfiguration = FloatingHeaderSnapConfiguration(
- vsync: this,
- curve: Curves.easeOut,
- duration: const Duration(milliseconds: 200),
- );
- } else {
- _snapConfiguration = null;
- }
- }
-
- void _updateStretchConfiguration() {
- if (widget.stretch) {
- _stretchConfiguration = OverScrollHeaderStretchConfiguration(
- stretchTriggerOffset: widget.stretchTriggerOffset,
- onStretchTrigger: widget.onStretchTrigger,
- );
- } else {
- _stretchConfiguration = null;
- }
- }
-
- @override
- void initState() {
- super.initState();
- _updateSnapConfiguration();
- _updateStretchConfiguration();
- }
-
- @override
- void didUpdateWidget(SliverGFAppBar oldWidget) {
- super.didUpdateWidget(oldWidget);
- if (widget.snap != oldWidget.snap || widget.floating != oldWidget.floating)
- _updateSnapConfiguration();
- if (widget.stretch != oldWidget.stretch) _updateStretchConfiguration();
- }
-
- @override
- Widget build(BuildContext context) {
- assert(!widget.primary || debugCheckHasMediaQuery(context));
- final double topPadding =
- widget.primary ? MediaQuery.of(context).padding.top : 0.0;
- final double collapsedHeight =
- (widget.pinned && widget.floating && widget.bottom != null)
- ? widget.bottom.preferredSize.height + topPadding
- : null;
-
- return MediaQuery.removePadding(
- context: context,
- removeBottom: true,
- child: SliverPersistentHeader(
- floating: widget.floating,
- pinned: widget.pinned,
- delegate: _SliverGFAppBarDelegate(
- leading: widget.leading,
- automaticallyImplyLeading: widget.automaticallyImplyLeading,
- title: widget.title,
- actions: widget.actions,
- flexibleSpace: widget.flexibleSpace,
- bottom: widget.bottom,
- elevation: widget.elevation,
- forceElevated: widget.forceElevated,
- backgroundColor: widget.backgroundColor,
- brightness: widget.brightness,
- iconTheme: widget.iconTheme,
- actionsIconTheme: widget.actionsIconTheme,
- textTheme: widget.textTheme,
- primary: widget.primary,
- centerTitle: widget.centerTitle,
- titleSpacing: widget.titleSpacing,
- expandedHeight: widget.expandedHeight,
- collapsedHeight: collapsedHeight,
- topPadding: topPadding,
- floating: widget.floating,
- pinned: widget.pinned,
- shape: widget.shape,
- snapConfiguration: _snapConfiguration,
- stretchConfiguration: _stretchConfiguration,
- ),
- ),
- );
- }
-}
-
// Layout the GFAppBar's title with unconstrained height, vertically
// center it within its (NavigationToolbar) parent, and allow the
// parent to constrain the title's actual height.
diff --git a/lib/components/avatar/gf_avatar.dart b/lib/components/avatar/gf_avatar.dart
index 9a9c0bec..3890914c 100644
--- a/lib/components/avatar/gf_avatar.dart
+++ b/lib/components/avatar/gf_avatar.dart
@@ -1,10 +1,6 @@
import 'package:flutter/widgets.dart';
import 'package:flutter/material.dart';
-import 'package:getflutter/shape/gf_avatar_shape.dart';
-import 'package:getflutter/size/gf_size.dart';
-import 'package:getflutter/colors/gf_color.dart';
-export 'package:getflutter/shape/gf_avatar_shape.dart';
-export 'package:getflutter/size/gf_size.dart';
+import 'package:getflutter/getflutter.dart';
class GFAvatar extends StatelessWidget {
/// Typically a [Text] widget. If the [CircleAvatar] is to have an image, use [backgroundImage] instead.
diff --git a/lib/components/badge/gf_badge.dart b/lib/components/badge/gf_badge.dart
index a30baabd..b2c37521 100644
--- a/lib/components/badge/gf_badge.dart
+++ b/lib/components/badge/gf_badge.dart
@@ -1,7 +1,5 @@
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';
+import 'package:getflutter/getflutter.dart';
class GFBadge extends StatefulWidget {
/// The border side for the badge's [Material].
diff --git a/lib/components/badge/gf_button_badge.dart b/lib/components/badge/gf_button_badge.dart
index 107cb5e6..8563a1d4 100644
--- a/lib/components/badge/gf_button_badge.dart
+++ b/lib/components/badge/gf_button_badge.dart
@@ -2,12 +2,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
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_button_type.dart';
-import 'package:getflutter/position/gf_position.dart';
-import 'package:getflutter/colors/gf_color.dart';
+import 'package:getflutter/getflutter.dart';
class GFButtonBadge extends GFButton {
/// Called when the button is tapped or otherwise activated.
diff --git a/lib/components/badge/gf_icon_badge.dart b/lib/components/badge/gf_icon_badge.dart
index ba24d4b5..9191d11c 100644
--- a/lib/components/badge/gf_icon_badge.dart
+++ b/lib/components/badge/gf_icon_badge.dart
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
-import 'package:getflutter/components/button/gf_icon_button.dart';
+import 'package:getflutter/getflutter.dart';
class GFIconBadge extends StatefulWidget {
/// child of type [Widget] is used to show icon.
diff --git a/lib/components/button/gf_button.dart b/lib/components/button/gf_button.dart
index 399e0e12..bca0f37d 100644
--- a/lib/components/button/gf_button.dart
+++ b/lib/components/button/gf_button.dart
@@ -4,11 +4,7 @@ import 'package:flutter/gestures.dart';
import 'package:flutter/rendering.dart';
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_button_type.dart';
-import 'package:getflutter/position/gf_position.dart';
-import 'package:getflutter/colors/gf_color.dart';
+import 'package:getflutter/getflutter.dart';
class GFButton extends StatefulWidget {
/// Called when the button is tapped or otherwise activated.
diff --git a/lib/components/button/gf_button_bar.dart b/lib/components/button/gf_button_bar.dart
index b8b0ef33..4108be6e 100644
--- a/lib/components/button/gf_button_bar.dart
+++ b/lib/components/button/gf_button_bar.dart
@@ -1,7 +1,6 @@
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';
+import 'package:getflutter/getflutter.dart';
class GFButtonBar extends StatelessWidget {
/// Create buttons bar for all types of buttons.
diff --git a/lib/components/button/gf_icon_button.dart b/lib/components/button/gf_icon_button.dart
index 4f3049b0..59a22c84 100644
--- a/lib/components/button/gf_icon_button.dart
+++ b/lib/components/button/gf_icon_button.dart
@@ -2,10 +2,7 @@ import 'dart:math' as math;
import 'package:flutter/foundation.dart';
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_button_type.dart';
-import 'package:getflutter/colors/gf_color.dart';
+import 'package:getflutter/getflutter.dart';
class GFIconButton extends StatefulWidget {
/// The size of the icon inside the button.
diff --git a/lib/components/button/gf_social_button.dart b/lib/components/button/gf_social_button.dart
index bef48e38..553bf3d1 100644
--- a/lib/components/button/gf_social_button.dart
+++ b/lib/components/button/gf_social_button.dart
@@ -2,12 +2,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
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_button_type.dart';
-import 'package:getflutter/position/gf_position.dart';
-import 'package:getflutter/colors/gf_color.dart';
+import 'package:getflutter/getflutter.dart';
class GFSocialButton extends GFButton {
/// Called when the button is tapped or otherwise activated.
diff --git a/lib/components/card/gf_card.dart b/lib/components/card/gf_card.dart
index 3957bd07..01ac1176 100644
--- a/lib/components/card/gf_card.dart
+++ b/lib/components/card/gf_card.dart
@@ -1,9 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
-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';
+import 'package:getflutter/getflutter.dart';
/// A material design card. A card has slightly rounded corners and a shadow.
///
@@ -34,11 +31,15 @@ class GFCard extends StatelessWidget {
this.borderRadius,
this.border,
this.boxFit,
- this.colorFilter})
+ this.colorFilter,
+ this.height})
: assert(elevation == null || elevation >= 0.0),
assert(borderOnForeground != null),
super(key: key);
+ /// defines the card's height
+ final double height;
+
/// [GFPosition] titlePosition helps to set titlebar at top of card
final GFPosition titlePosition;
@@ -139,6 +140,7 @@ class GFCard extends StatelessWidget {
);
return Container(
+ height: height,
margin: margin ?? cardTheme.margin ?? const EdgeInsets.all(16.0),
child: Material(
type: MaterialType.card,
diff --git a/lib/components/drawer/gf_drawer.dart b/lib/components/drawer/gf_drawer.dart
index cd2fa757..96af9566 100644
--- a/lib/components/drawer/gf_drawer.dart
+++ b/lib/components/drawer/gf_drawer.dart
@@ -130,18 +130,19 @@ class GFDrawer extends StatelessWidget {
child: Material(
elevation: elevation,
child: Container(
- decoration: new BoxDecoration(
- color: Colors.teal,
- gradient: gradient,
- image: backgroundImage != null
- ? new DecorationImage(
- image: backgroundImage,
- fit: BoxFit.cover,
- colorFilter: colorFilter,
- )
- : null,
- ),
- child: child),
+ decoration: new BoxDecoration(
+ color: Colors.teal,
+ gradient: gradient,
+ image: backgroundImage != null
+ ? new DecorationImage(
+ image: backgroundImage,
+ fit: BoxFit.cover,
+ colorFilter: colorFilter,
+ )
+ : null,
+ ),
+ child: child,
+ ),
),
),
);
diff --git a/lib/components/list_tile/gf_list_tile.dart b/lib/components/list_tile/gf_list_tile.dart
index 9e41fd2e..6a2360e7 100644
--- a/lib/components/list_tile/gf_list_tile.dart
+++ b/lib/components/list_tile/gf_list_tile.dart
@@ -1,7 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
-import 'package:getflutter/colors/gf_color.dart';
-import 'package:getflutter/components/avatar/gf_avatar.dart';
+import 'package:getflutter/getflutter.dart';
class GFListTile extends StatelessWidget {
///type of [String] used to pass text, alternative to title property and gets higher priority than title
@@ -48,7 +47,8 @@ class GFListTile extends StatelessWidget {
Widget build(BuildContext context) {
return Container(
constraints: BoxConstraints(minHeight: 50),
- padding: padding,
+ padding: EdgeInsets.all(8.0),
+// margin: padding,
decoration: BoxDecoration(
color: color,
borderRadius: BorderRadius.all(Radius.circular(5)),
diff --git a/lib/components/tabs/gf_segment_tabs.dart b/lib/components/tabs/gf_segment_tabs.dart
index 2b798bf0..7f51225b 100644
--- a/lib/components/tabs/gf_segment_tabs.dart
+++ b/lib/components/tabs/gf_segment_tabs.dart
@@ -2,8 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
-import 'package:getflutter/colors/gf_color.dart';
-import 'package:getflutter/components/tabs/gf_tabBar.dart';
+import 'package:getflutter/getflutter.dart';
/// Creates pills like structured tab bar. See [GFTabBar]
/// [GFSegmentTabs] are best used as an alternative for [GFTabBar].
diff --git a/lib/components/tabs/gf_tabBar.dart b/lib/components/tabs/gf_tabBar.dart
index 75eee5ad..add820ef 100644
--- a/lib/components/tabs/gf_tabBar.dart
+++ b/lib/components/tabs/gf_tabBar.dart
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
-import 'package:getflutter/colors/gf_color.dart';
+import 'package:getflutter/getflutter.dart';
/// A material design widget that displays a horizontal row of tabs.
///
diff --git a/lib/components/tabs/gf_tabBarView.dart b/lib/components/tabs/gf_tabBarView.dart
index 9b170925..b4251765 100644
--- a/lib/components/tabs/gf_tabBarView.dart
+++ b/lib/components/tabs/gf_tabBarView.dart
@@ -3,7 +3,7 @@ import 'dart:async';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter/gestures.dart' show DragStartBehavior;
-import 'package:getflutter/components/tabs/gf_segment_tabs.dart';
+import 'package:getflutter/getflutter.dart';
/// A page view that displays the widget which corresponds to the currently
/// selected tab.
diff --git a/lib/components/tabs/gf_tabs.dart b/lib/components/tabs/gf_tabs.dart
index 439bd556..d64f9d34 100644
--- a/lib/components/tabs/gf_tabs.dart
+++ b/lib/components/tabs/gf_tabs.dart
@@ -2,9 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
-import 'package:getflutter/colors/gf_color.dart';
-import 'package:getflutter/components/tabs/gf_tabBarView.dart';
-import 'package:getflutter/components/tabs/gf_tabBar.dart';
+import 'package:getflutter/getflutter.dart';
/// Creates a default tab for the given [child] widget.
///
diff --git a/lib/components/toast/gf_floating_widget.dart b/lib/components/toast/gf_floating_widget.dart
index 8afd436e..8a950c81 100644
--- a/lib/components/toast/gf_floating_widget.dart
+++ b/lib/components/toast/gf_floating_widget.dart
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
-import 'package:getflutter/components/toast/gf_toast.dart';
+import 'package:getflutter/getflutter.dart';
class GFFloatingWidget extends StatefulWidget {
/// Creates a Floating body can be used to display the quick messages, warning and erros.
diff --git a/lib/components/toast/gf_toast.dart b/lib/components/toast/gf_toast.dart
index 2a285a10..3b68a762 100644
--- a/lib/components/toast/gf_toast.dart
+++ b/lib/components/toast/gf_toast.dart
@@ -1,9 +1,7 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
-import 'package:getflutter/colors/gf_color.dart';
-import 'package:getflutter/components/toast/gf_floating_widget.dart';
-import 'package:getflutter/types/gf_toast_type.dart';
+import 'package:getflutter/getflutter.dart';
class GFToast extends StatefulWidget {
///Creates [GFToast] that can be used to display quick warning or error messages.
diff --git a/lib/components/toggle/gf_toggle.dart b/lib/components/toggle/gf_toggle.dart
index 1d397cf5..636488a1 100644
--- a/lib/components/toggle/gf_toggle.dart
+++ b/lib/components/toggle/gf_toggle.dart
@@ -1,6 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
-import 'package:getflutter/types/gf_toggle_type.dart';
+import 'package:getflutter/getflutter.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 98b480f4..9aa061d9 100644
--- a/lib/components/typography/gf_typography.dart
+++ b/lib/components/typography/gf_typography.dart
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
-import 'package:getflutter/colors/gf_color.dart';
-import 'package:getflutter/types/gf_typography_type.dart';
+import 'package:getflutter/getflutter.dart';
class GFTypography extends StatelessWidget {
/// Creates simple title with underline. Style of title can be changed using [GFTypographyType]
diff --git a/lib/getflutter.dart b/lib/getflutter.dart
index bf278aab..b3934353 100644
--- a/lib/getflutter.dart
+++ b/lib/getflutter.dart
@@ -1,5 +1,33 @@
library getflutter;
+//exports components
+export 'package:getflutter/components/appbar/gf_appbar.dart';
+export 'package:getflutter/components/avatar/gf_avatar.dart';
+export 'package:getflutter/components/badge/gf_badge.dart';
+export 'package:getflutter/components/badge/gf_button_badge.dart';
+export 'package:getflutter/components/badge/gf_icon_badge.dart';
+export 'package:getflutter/components/button/gf_button.dart';
+export 'package:getflutter/components/button/gf_icon_button.dart';
+export 'package:getflutter/components/button/gf_social_button.dart';
+export 'package:getflutter/components/button/gf_button_bar.dart';
+export 'package:getflutter/components/card/gf_card.dart';
+export 'package:getflutter/components/carousel/gf_carousel.dart';
+export 'package:getflutter/components/carousel/gf_items_carousel.dart';
+export 'package:getflutter/components/drawer/gf_drawer.dart';
+export 'package:getflutter/components/drawer/gf_drawer_header.dart';
+export 'package:getflutter/components/image/gf_image_overlay.dart';
+export 'package:getflutter/components/list_tile/gf_list_tile.dart';
+export 'package:getflutter/components/search_bar/gf_search_bar.dart';
+export 'package:getflutter/components/tabs/gf_tabBar.dart';
+export 'package:getflutter/components/tabs/gf_tabBarView.dart';
+export 'package:getflutter/components/tabs/gf_tabs.dart';
+export 'package:getflutter/components/tabs/gf_segment_tabs.dart';
+export 'package:getflutter/components/toast/gf_floating_widget.dart';
+export 'package:getflutter/components/toast/gf_toast.dart';
+export 'package:getflutter/components/toggle/gf_toggle.dart';
+export 'package:getflutter/components/typography/gf_typography.dart';
+
+// exports shape, color, position, size, types
export 'colors/gf_color.dart';
export 'position/gf_position.dart';
export 'shape/gf_avatar_shape.dart';
@@ -10,3 +38,4 @@ export 'size/gf_size.dart';
export 'types/gf_toggle_type.dart';
export 'types/gf_button_type.dart';
export 'types/gf_typography_type.dart';
+export 'types/gf_toast_type.dart';