Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 22 additions & 23 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -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<String> imageList = [
"https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg",
Expand Down Expand Up @@ -60,9 +59,7 @@ class _MyHomePageState extends State<MyHomePage>
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) {
Expand Down Expand Up @@ -304,18 +301,17 @@ class _MyHomePageState extends State<MyHomePage>
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: <Widget>[
Expand Down Expand Up @@ -788,18 +784,15 @@ class _MyHomePageState extends State<MyHomePage>
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;
});
},
),
Expand Down Expand Up @@ -888,7 +881,8 @@ class _MyHomePageState extends State<MyHomePage>
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,
Expand All @@ -901,9 +895,14 @@ class _MyHomePageState extends State<MyHomePage>
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),
Expand Down
46 changes: 26 additions & 20 deletions lib/components/card/gf_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
);
}
}
115 changes: 58 additions & 57 deletions lib/components/search_bar/gf_search_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import 'package:flutter/material.dart';
typedef QueryListItemBuilder<T> = Widget Function(T item);
typedef OnItemSelected<T> = void Function(T item);
typedef SelectedItemBuilder<T> = Widget Function(
T item,
VoidCallback deleteSelectedItem,
);
T item,
VoidCallback deleteSelectedItem,
);
typedef QueryBuilder<T> = List<T> Function(
String query,
List<T> list,
);
String query,
List<T> list,
);
typedef TextFieldBuilder = Widget Function(
TextEditingController controller,
FocusNode focus,
);
TextEditingController controller,
FocusNode focus,
);

class GFSearchBar<T> extends StatefulWidget {
const GFSearchBar({
Expand Down Expand Up @@ -142,34 +142,34 @@ class MySingleChoiceSearchState<T> extends State<GFSearchBar<T>> {
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,
Expand Down Expand Up @@ -259,29 +259,30 @@ class MySingleChoiceSearchState<T> extends State<GFSearchBar<T>> {
),
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"),
),
),
),
),
Expand Down