Skip to content

Commit fc998d2

Browse files
committed
GFSearchBar completd
2 parents c3f3466 + 0e04167 commit fc998d2

File tree

7 files changed

+363
-50
lines changed

7 files changed

+363
-50
lines changed

README.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![pub package](https://img.shields.io/pub/v/getflutter.svg)](https://pub.dartlang.org/packages/getflutter) [![Build Status](https://travis-ci.org/ionicfirebaseapp/getflutter.svg?branch=master)](https://travis-ci.com/ionicfirebaseapp/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)
1+
[![pub package](https://img.shields.io/pub/v/getflutter.svg)](https://pub.dartlang.org/packages/getflutter) [![Build Status](https://travis-ci.org/ionicfirebaseapp/getflutter.svg?branch=master)](https://travis-ci.com/ionicfirebaseapp/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) [![Gitter](https://badges.gitter.im/getflutterdev/getflutter.svg)](https://gitter.im/getflutterdev/getflutter) [![Twitter Follow](https://img.shields.io/twitter/follow/getflutterdev.svg?style=social)](https://twitter.com/getflutterdev)
22

33

44
<p align="center">
@@ -7,7 +7,7 @@
77
</a>
88
</p>
99

10-
[**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.
10+
[**GetFlutter**](https://www.getflutter.dev) is a 100% free Flutter open-source UI library that is built to make Flutter development easier and more joyful than ever. GetFlutter has 1000+ pre-build widgets that you can reuse to develop both Flutter mobile app and web app. Our motto is to provide the best Flutter UI library to the Flutter community to speed up their development process and build awesome apps with pre-build Flutter Library Components.
1111

1212
## Table of contents
1313

@@ -23,7 +23,7 @@
2323
## Screenshot
2424
<p align="center">
2525
<a target="_blank" href="https://www.getflutter.dev/">
26-
<img src="https://ik.imagekit.io/ionicfirebaseapp/github_all_screens_scMyu9vXg.png" alt="Get Flutter">
26+
<img src="https://ik.imagekit.io/ionicfirebaseapp/tr:dpr-auto,tr:w-auto/GitHub_WHeammEIl.png" alt="Get Flutter">
2727
</a>
2828
</p>
2929

@@ -33,7 +33,7 @@ Read the [Getting started page](https://docs.getflutter.dev)
3333
Forum [Support and discussion ](https://forum.getflutter.dev)
3434

3535
## Features
36-
In this beta release we are going to launch the library with following components :
36+
In this beta release, we are going to launch the library with the following components :
3737

3838
#### [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)
3939

@@ -53,22 +53,21 @@ In this beta release we are going to launch the library with following component
5353

5454
## Contributing
5555

56-
GetFlutter is **100% free** and **open source**. We encourage and support an active, healthy community that accepts contributions from the public &ndash; including you. There are couple of ways in which you can contribute to the growing community of `getflutter`.
56+
GetFlutter is **100% free** and **open source**. We encourage and support an active, healthy community that accepts contributions from the public &ndash; including you. There are a couple of ways in which you can contribute to the growing community of `getflutter`.
5757

5858
* 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)
5959
* Fix a bug
60-
* 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.
60+
* Write and improve some **documentation**. Documentation is very critical to us. We would appreciate help in adding multiple languages to our docs.
6161
* If you are a developer, feel free to check out the source and submit pull requests.
6262
* Dig into [**CONTRIBUTING.MD**](CONTRIBUTING.md), which covers submitting bugs, requesting new features, preparing your code for a pull request, etc.
63-
* 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.
63+
* 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 GetFlutter development.
6464
* Not sure what to work on? [**We've got lots ideas.**](https://roadmap.getflutter.dev)
6565

6666

6767
## Documentation
6868

6969
[**Installation Guide**](https://docs.getflutter.dev)
70-
71-
[**NOTE**] Our library will also work on flutter web but since flutter didn't released stable version for Flutter web and it is still in Beta release so you might get some rendering problem and hence we will update our library as flutter comes with the stable release for Flutter Web.
70+
7271

7372
### Social Media
7473

@@ -82,4 +81,4 @@ Instagram: <https://www.instagram.com/getflutter.dev/>
8281

8382

8483
## Copyright-and-license
85-
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/).
84+
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/).

example/lib/main.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import 'package:flutter/material.dart';
22
import 'package:getflutter/getflutter.dart';
3-
import 'package:getflutter/components/search_bar/gf_search_bar.dart';
43

54
final List<String> imageList = [
65
"https://cdn.pixabay.com/photo/2017/12/03/18/04/christmas-balls-2995437_960_720.jpg",
@@ -779,7 +778,7 @@ class _MyHomePageState extends State<MyHomePage>
779778
).toList(),
780779
onPageChanged: (index) {
781780
setState(() {
782-
// index;
781+
// index;
783782
});
784783
},
785784
),
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:getflutter/colors/gf_color.dart';
3+
4+
class GFAccordion extends StatefulWidget {
5+
const GFAccordion(
6+
{Key key,
7+
this.child,
8+
this.content,
9+
this.titlebackgroundColor,
10+
this.collapsedIcon = const Icon(Icons.keyboard_arrow_down),
11+
this.expandedIcon =
12+
const Icon(Icons.keyboard_arrow_up, color: Colors.red),
13+
this.title,
14+
this.textStyle = const TextStyle(color: Colors.black, fontSize: 16),
15+
this.titlePadding,
16+
this.descriptionPadding,
17+
this.descriptionbackgroundColor,
18+
this.contentChild,
19+
this.margin})
20+
: super(key: key);
21+
22+
/// child of type [Widget]is alternative to title key. title will get priority over child
23+
final Widget child;
24+
25+
/// content of type[String] which shows the messages after the [GFAccordion] is expanded
26+
final String content;
27+
28+
/// contentChild of type [Widget]is alternative to content key. content will get priority over contentChild
29+
final Widget contentChild;
30+
31+
/// type of [Color] or [GFColor] which is used to change the background color of the [GFAccordion] title
32+
final dynamic titlebackgroundColor;
33+
34+
///collapsedIcon of type [Widget] which is used to show when the [GFAccordion] is collapsed
35+
final Widget collapsedIcon;
36+
37+
///expandedIcon of type[Widget] which is used when the [GFAccordion] is expanded
38+
final Widget expandedIcon;
39+
40+
/// text of type [String] is alternative to child. text will get priority over child
41+
final String title;
42+
43+
/// textStyle of type [textStyle] will be applicable to text only and not for the child
44+
final TextStyle textStyle;
45+
46+
///titlePadding of type [EdgeInsets] which is used to set the padding of the [GFAccordion] title
47+
final EdgeInsets titlePadding;
48+
49+
///descriptionPadding of type [EdgeInsets] which is used to set the padding of the [GFAccordion] description
50+
final EdgeInsets descriptionPadding;
51+
52+
/// type of [Color] or [GFColor] which is used to change the background color of the [GFAccordion] description
53+
final dynamic descriptionbackgroundColor;
54+
55+
///margin of type [EdgeInsets] which is used to set the margin of the [GFAccordion]
56+
final EdgeInsets margin;
57+
58+
@override
59+
_GFAccordionState createState() => _GFAccordionState();
60+
}
61+
62+
class _GFAccordionState extends State<GFAccordion>
63+
with TickerProviderStateMixin {
64+
AnimationController animationController;
65+
AnimationController controller;
66+
Animation<Offset> offset;
67+
68+
@override
69+
void initState() {
70+
super.initState();
71+
animationController =
72+
AnimationController(duration: Duration(seconds: 2), vsync: this);
73+
controller =
74+
AnimationController(vsync: this, duration: Duration(milliseconds: 300));
75+
offset = Tween(begin: Offset(0.0, -0.06), end: Offset.zero).animate(
76+
CurvedAnimation(
77+
parent: controller,
78+
curve: Curves.fastOutSlowIn,
79+
),
80+
);
81+
}
82+
83+
bool showAccordion = false;
84+
85+
@override
86+
Widget build(BuildContext context) {
87+
return Container(
88+
margin: widget.margin != null ? widget.margin : EdgeInsets.all(10),
89+
child: Column(
90+
crossAxisAlignment: CrossAxisAlignment.start,
91+
children: <Widget>[
92+
GestureDetector(
93+
onTap: () {
94+
setState(() {
95+
switch (controller.status) {
96+
case AnimationStatus.completed:
97+
controller.forward(from: 0);
98+
break;
99+
case AnimationStatus.dismissed:
100+
controller.forward();
101+
break;
102+
default:
103+
}
104+
showAccordion = !showAccordion;
105+
});
106+
},
107+
child: Container(
108+
color: widget.titlebackgroundColor != null
109+
? widget.titlebackgroundColor
110+
: Colors.white,
111+
padding: widget.titlePadding != null
112+
? widget.titlePadding
113+
: EdgeInsets.all(10),
114+
child: Row(
115+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
116+
children: <Widget>[
117+
Expanded(
118+
child: widget.title != null
119+
? Text(widget.title, style: widget.textStyle)
120+
: (widget.child ?? Container()),
121+
),
122+
showAccordion ? widget.expandedIcon : widget.collapsedIcon
123+
],
124+
),
125+
),
126+
),
127+
showAccordion
128+
? Container(
129+
width: MediaQuery.of(context).size.width,
130+
color: widget.descriptionbackgroundColor != null
131+
? widget.descriptionbackgroundColor
132+
: Colors.white70,
133+
padding: widget.descriptionPadding != null
134+
? widget.descriptionPadding
135+
: EdgeInsets.all(10),
136+
child: SlideTransition(
137+
position: offset,
138+
child: widget.content != null
139+
? Text(widget.content)
140+
: (widget.contentChild ?? Container()),
141+
))
142+
: Container()
143+
],
144+
),
145+
);
146+
}
147+
}

lib/components/alert/gf_alert.dart

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:flutter/widgets.dart';
3+
import 'package:getflutter/getflutter.dart';
4+
import 'package:getflutter/types/gf_alert_type.dart';
5+
6+
class GFAlert extends StatefulWidget {
7+
/// Alert has to be wrap inside the body like [GFFloatingWidget]. See [GFFloatingWidget]
8+
GFAlert(
9+
{Key key,
10+
this.child,
11+
this.backgroundColor,
12+
this.content,
13+
this.width,
14+
this.type = GFAlertType.basic,
15+
this.alignment,
16+
this.contentChild,
17+
this.title,
18+
this.bottombar,
19+
this.animationDuration = const Duration(milliseconds: 300),
20+
this.textStyle = const TextStyle(color: Colors.black87),
21+
this.titleTextStyle = const TextStyle(
22+
color: Colors.black87, fontSize: 17, fontWeight: FontWeight.w500)})
23+
: super(key: key);
24+
25+
/// child of type [Widget]is alternative to text key. text will get priority over child
26+
final Widget child;
27+
28+
/// title of type [String] used to descripe the title of the [GFAlert]
29+
final String title;
30+
31+
/// child of type [Widget]is alternative to title key. title will get priority over contentchild
32+
final Widget contentChild;
33+
34+
/// title of type [String] used to describe the content of the [GFAlert]
35+
final String content;
36+
37+
final TextStyle titleTextStyle;
38+
39+
///pass color of type [Color] or [GFColor] for background of [GFAlert]
40+
final dynamic backgroundColor;
41+
42+
/// textStyle of type [textStyle] will be applicable to text only and not for the child
43+
final TextStyle textStyle;
44+
45+
/// width of type [double] used to control the width of the [GFAlert]
46+
final double width;
47+
48+
///type of [GFAlertType] which takes the type ie, basic, rounded and fullWidth for the [GFAlert]
49+
final GFAlertType type;
50+
51+
///type of [Duration] which takes the duration of the fade in animation
52+
final Duration animationDuration;
53+
54+
/// type of [Alignment] used to align the text inside the toast
55+
final Alignment alignment;
56+
57+
///type of [Widget] used for the buttons ie, OK, Cancel for the action in [GFAlert]
58+
final Widget bottombar;
59+
@override
60+
_GFAlertState createState() => _GFAlertState();
61+
}
62+
63+
class _GFAlertState extends State<GFAlert> with TickerProviderStateMixin {
64+
AnimationController animationController;
65+
Animation<double> animation;
66+
67+
@override
68+
void initState() {
69+
animationController = AnimationController(
70+
duration: const Duration(milliseconds: 300), vsync: this);
71+
animation = CurvedAnimation(
72+
parent: animationController, curve: Curves.fastOutSlowIn);
73+
74+
animationController.forward();
75+
super.initState();
76+
}
77+
78+
@override
79+
void dispose() {
80+
animationController.dispose();
81+
super.dispose();
82+
}
83+
84+
@override
85+
Widget build(BuildContext context) {
86+
return Stack(
87+
children: <Widget>[
88+
Container(
89+
height: MediaQuery.of(context).size.height,
90+
),
91+
FadeTransition(
92+
opacity: animation,
93+
child: Column(
94+
children: <Widget>[
95+
Container(
96+
width: widget.type == GFAlertType.fullWidth
97+
? MediaQuery.of(context).size.width
98+
: widget.width,
99+
constraints: BoxConstraints(minHeight: 50.0),
100+
margin: widget.type == GFAlertType.fullWidth
101+
? EdgeInsets.only(left: 0, right: 0)
102+
: EdgeInsets.only(left: 20, right: 20),
103+
padding: EdgeInsets.all(15),
104+
decoration: BoxDecoration(
105+
borderRadius: widget.type == GFAlertType.basic
106+
? BorderRadius.circular(3.0)
107+
: widget.type == GFAlertType.rounded
108+
? BorderRadius.circular(10.0)
109+
: BorderRadius.zero,
110+
color: widget.backgroundColor != null
111+
? GFColors.getGFColor(widget.backgroundColor)
112+
: GFColors.getGFColor(GFColor.white),
113+
boxShadow: [
114+
BoxShadow(
115+
color: Colors.black.withOpacity(0.40),
116+
blurRadius: 3.0)
117+
]),
118+
child: Column(
119+
crossAxisAlignment: CrossAxisAlignment.start,
120+
children: <Widget>[
121+
widget.title != null
122+
? Text(widget.title, style: widget.titleTextStyle)
123+
: (widget.child ?? Container()),
124+
SizedBox(
125+
height: 10,
126+
),
127+
Align(
128+
alignment: widget.alignment != null
129+
? widget.alignment
130+
: Alignment.topLeft,
131+
child: widget.content != null
132+
? Text(widget.content, style: widget.textStyle)
133+
: (widget.contentChild ?? Container()),
134+
),
135+
SizedBox(
136+
height: 10,
137+
),
138+
widget.bottombar != null ? widget.bottombar : Container(),
139+
],
140+
),
141+
),
142+
],
143+
),
144+
),
145+
],
146+
);
147+
}
148+
}

0 commit comments

Comments
 (0)