diff --git a/example/lib/main.dart b/example/lib/main.dart index 786b1543..abced5e8 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; import 'package:getflutter/getflutter.dart'; -import 'package:getflutter/components/search_bar/gf_search_bar.dart'; final List imageList = [ "https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg", @@ -60,9 +59,7 @@ class _MyHomePageState extends State Widget appBarTitle = new Text("UI Kit"); Icon actionIcon = new Icon(Icons.search); - List list = [ - "Flutter","Flutterjjk","Flutterhy","jhFlutter" - ]; + List list = ["Flutter", "Flutterjjk", "Flutterhy", "jhFlutter"]; @override Widget build(BuildContext context) { @@ -304,18 +301,17 @@ class _MyHomePageState extends State height: 130.0, width: 105.0, decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8.0), - gradient: LinearGradient( - begin: FractionalOffset.bottomLeft, - end: FractionalOffset.topRight, - colors: [ - const Color(0x5a0b486b), - const Color(0xFFF56217), - ]), + borderRadius: BorderRadius.circular(8.0), + gradient: LinearGradient( + begin: FractionalOffset.bottomLeft, + end: FractionalOffset.topRight, + colors: [ + const Color(0x5a0b486b), + const Color(0xFFF56217), + ]), ), ), - // GFCard( // content: Column( // children: [ @@ -788,18 +784,15 @@ class _MyHomePageState extends State margin: EdgeInsets.all(8.0), child: ClipRRect( borderRadius: BorderRadius.all(Radius.circular(5.0)), - child: Image.network( - url, - fit: BoxFit.cover, - width: 1000.0 - ), + child: + Image.network(url, fit: BoxFit.cover, width: 1000.0), ), ); }, ).toList(), onPageChanged: (index) { setState(() { - index; + // index; }); }, ), @@ -888,7 +881,8 @@ class _MyHomePageState extends State const Color(0xFFF56217), ]), boxFit: BoxFit.fill, - colorFilter: new ColorFilter.mode(Colors.black.withOpacity(0.67), BlendMode.darken), + colorFilter: new ColorFilter.mode( + Colors.black.withOpacity(0.67), BlendMode.darken), // image: Image.asset( // "lib/assets/img.png", // fit: BoxFit.fitWidth, @@ -901,9 +895,14 @@ class _MyHomePageState extends State backgroundColor: Color(0x5a0b486b), child: Text("tb"), ), - title: Text('Flutter',), - subTitle: Text("Flutter is Google's mobile UI",), - description: Text("Flutter Flutter is Google's mobile UI framework for crafting"), + title: Text( + 'Flutter', + ), + subTitle: Text( + "Flutter is Google's mobile UI", + ), + description: Text( + "Flutter Flutter is Google's mobile UI framework for crafting"), icon: GFIconButton( onPressed: null, icon: Icon(Icons.favorite), diff --git a/lib/components/card/gf_card.dart b/lib/components/card/gf_card.dart index acd4affe..527dc97f 100644 --- a/lib/components/card/gf_card.dart +++ b/lib/components/card/gf_card.dart @@ -36,10 +36,10 @@ class GFCard extends StatelessWidget { this.gradient}) : assert(elevation == null || elevation >= 0.0), assert(borderOnForeground != null), - assert(color == null || gradient == null, - 'Cannot provide both a color and a decoration\n' - 'The color argument is just a shorthand for "decoration: new BoxDecoration(color: color)".' - ), + assert( + color == null || gradient == null, + 'Cannot provide both a color and a decoration\n' + 'The color argument is just a shorthand for "decoration: new BoxDecoration(color: color)".'), super(key: key); /// defines the card's height @@ -149,23 +149,29 @@ class GFCard extends StatelessWidget { return Container( height: height, margin: margin ?? cardTheme.margin ?? const EdgeInsets.all(16.0), - decoration: gradient != null ? BoxDecoration( - gradient: gradient, - borderRadius: BorderRadius.all(Radius.circular(4.0)), - ) : null, - child: gradient == null ? Material( - type: MaterialType.card, - color: color ?? cardTheme.color ?? Theme.of(context).cardColor, - elevation: elevation ?? cardTheme.elevation ?? _defaultElevation, - shape: shape ?? - cardTheme.shape ?? - const RoundedRectangleBorder( + decoration: gradient != null + ? BoxDecoration( + gradient: gradient, borderRadius: BorderRadius.all(Radius.circular(4.0)), - ), - borderOnForeground: borderOnForeground, - clipBehavior: clipBehavior ?? cardTheme.clipBehavior ?? _defaultClipBehavior, - child: imageOverlay == null ? cardChild : overlayImage, - ) : imageOverlay == null ? cardChild : overlayImage, + ) + : null, + child: gradient == null + ? Material( + type: MaterialType.card, + color: color ?? cardTheme.color ?? Theme.of(context).cardColor, + elevation: elevation ?? cardTheme.elevation ?? _defaultElevation, + shape: shape ?? + cardTheme.shape ?? + const RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(4.0)), + ), + borderOnForeground: borderOnForeground, + clipBehavior: clipBehavior ?? + cardTheme.clipBehavior ?? + _defaultClipBehavior, + child: imageOverlay == null ? cardChild : overlayImage, + ) + : imageOverlay == null ? cardChild : overlayImage, ); } } diff --git a/lib/components/search_bar/gf_search_bar.dart b/lib/components/search_bar/gf_search_bar.dart index b3dc4926..3e35cec3 100644 --- a/lib/components/search_bar/gf_search_bar.dart +++ b/lib/components/search_bar/gf_search_bar.dart @@ -3,17 +3,17 @@ import 'package:flutter/material.dart'; typedef QueryListItemBuilder = Widget Function(T item); typedef OnItemSelected = void Function(T item); typedef SelectedItemBuilder = Widget Function( - T item, - VoidCallback deleteSelectedItem, - ); + T item, + VoidCallback deleteSelectedItem, +); typedef QueryBuilder = List Function( - String query, - List list, - ); + String query, + List list, +); typedef TextFieldBuilder = Widget Function( - TextEditingController controller, - FocusNode focus, - ); + TextEditingController controller, + FocusNode focus, +); class GFSearchBar extends StatefulWidget { const GFSearchBar({ @@ -142,34 +142,34 @@ class MySingleChoiceSearchState extends State> { textField = widget.textFieldBuilder != null ? widget.textFieldBuilder(_controller, _focusNode) : Padding( - padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16), - child: TextField( - controller: _controller, - focusNode: _focusNode, - style: TextStyle(fontSize: 16, color: Colors.grey[600]), - decoration: InputDecoration( - enabledBorder: const OutlineInputBorder( - borderSide: BorderSide( - color: Color(0x4437474F), - ), - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Theme.of(context).primaryColor, + padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16), + child: TextField( + controller: _controller, + focusNode: _focusNode, + style: TextStyle(fontSize: 16, color: Colors.grey[600]), + decoration: InputDecoration( + enabledBorder: const OutlineInputBorder( + borderSide: BorderSide( + color: Color(0x4437474F), + ), + ), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Theme.of(context).primaryColor, + ), + ), + suffixIcon: Icon(Icons.search), + border: InputBorder.none, + hintText: "Search here...", + contentPadding: const EdgeInsets.only( + left: 16, + right: 20, + top: 14, + bottom: 14, + ), + ), ), - ), - suffixIcon: Icon(Icons.search), - border: InputBorder.none, - hintText: "Search here...", - contentPadding: const EdgeInsets.only( - left: 16, - right: 20, - top: 14, - bottom: 14, - ), - ), - ), - ); + ); final column = Column( mainAxisSize: MainAxisSize.min, @@ -259,29 +259,30 @@ class MySingleChoiceSearchState extends State> { ), child: _tempList.isNotEmpty ? Scrollbar( - child: ListView.separated( - padding: const EdgeInsets.symmetric(vertical: 4), - separatorBuilder: (context, index) => const Divider( - height: 1, - ), - itemBuilder: (context, index) => Material( - color: Colors.transparent, - child: InkWell( - onTap: () => onDropDownItemTap(_tempList[index]), - child: widget.popupListItemBuilder( - _tempList.elementAt(index), + child: ListView.separated( + padding: const EdgeInsets.symmetric(vertical: 4), + separatorBuilder: (context, index) => const Divider( + height: 1, + ), + itemBuilder: (context, index) => Material( + color: Colors.transparent, + child: InkWell( + onTap: () => onDropDownItemTap(_tempList[index]), + child: widget.popupListItemBuilder( + _tempList.elementAt(index), + ), + ), + ), + itemCount: _tempList.length, ), - ), - ), - itemCount: _tempList.length, - ), - ) + ) : widget.noItemsFoundWidget != null - ? Center( - child: widget.noItemsFoundWidget, - ) : Container( - child: Text("no items found"), - ), + ? Center( + child: widget.noItemsFoundWidget, + ) + : Container( + child: Text("no items found"), + ), ), ), ),