Skip to content

Commit 8f5ad01

Browse files
authored
search bar open/close callback. (#28)
* search open/close callback. * fix undeclared heigh of container. * fix undeclared heigh of container.
1 parent 852600d commit 8f5ad01

File tree

3 files changed

+115
-63
lines changed

3 files changed

+115
-63
lines changed

example/pubspec.lock

+55-30
Original file line numberDiff line numberDiff line change
@@ -7,47 +7,53 @@ packages:
77
path: ".."
88
relative: true
99
source: path
10-
version: "2.0.3"
10+
version: "2.1.3"
1111
async:
1212
dependency: transitive
1313
description:
1414
name: async
15-
url: "https://pub.dartlang.org"
15+
sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0
16+
url: "https://pub.dev"
1617
source: hosted
17-
version: "2.9.0"
18+
version: "2.10.0"
1819
boolean_selector:
1920
dependency: transitive
2021
description:
2122
name: boolean_selector
22-
url: "https://pub.dartlang.org"
23+
sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
24+
url: "https://pub.dev"
2325
source: hosted
24-
version: "2.1.0"
26+
version: "2.1.1"
2527
characters:
2628
dependency: transitive
2729
description:
2830
name: characters
29-
url: "https://pub.dartlang.org"
31+
sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c
32+
url: "https://pub.dev"
3033
source: hosted
3134
version: "1.2.1"
3235
clock:
3336
dependency: transitive
3437
description:
3538
name: clock
36-
url: "https://pub.dartlang.org"
39+
sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
40+
url: "https://pub.dev"
3741
source: hosted
3842
version: "1.1.1"
3943
collection:
4044
dependency: transitive
4145
description:
4246
name: collection
43-
url: "https://pub.dartlang.org"
47+
sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0
48+
url: "https://pub.dev"
4449
source: hosted
45-
version: "1.16.0"
50+
version: "1.17.0"
4651
fake_async:
4752
dependency: transitive
4853
description:
4954
name: fake_async
50-
url: "https://pub.dartlang.org"
55+
sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
56+
url: "https://pub.dev"
5157
source: hosted
5258
version: "1.3.1"
5359
flutter:
@@ -60,32 +66,44 @@ packages:
6066
description: flutter
6167
source: sdk
6268
version: "0.0.0"
69+
js:
70+
dependency: transitive
71+
description:
72+
name: js
73+
sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7"
74+
url: "https://pub.dev"
75+
source: hosted
76+
version: "0.6.5"
6377
matcher:
6478
dependency: transitive
6579
description:
6680
name: matcher
67-
url: "https://pub.dartlang.org"
81+
sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72"
82+
url: "https://pub.dev"
6883
source: hosted
69-
version: "0.12.12"
84+
version: "0.12.13"
7085
material_color_utilities:
7186
dependency: transitive
7287
description:
7388
name: material_color_utilities
74-
url: "https://pub.dartlang.org"
89+
sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724
90+
url: "https://pub.dev"
7591
source: hosted
76-
version: "0.1.5"
92+
version: "0.2.0"
7793
meta:
7894
dependency: transitive
7995
description:
8096
name: meta
81-
url: "https://pub.dartlang.org"
97+
sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42"
98+
url: "https://pub.dev"
8299
source: hosted
83100
version: "1.8.0"
84101
path:
85102
dependency: transitive
86103
description:
87104
name: path
88-
url: "https://pub.dartlang.org"
105+
sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b
106+
url: "https://pub.dev"
89107
source: hosted
90108
version: "1.8.2"
91109
sky_engine:
@@ -97,51 +115,58 @@ packages:
97115
dependency: transitive
98116
description:
99117
name: source_span
100-
url: "https://pub.dartlang.org"
118+
sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250
119+
url: "https://pub.dev"
101120
source: hosted
102-
version: "1.9.0"
121+
version: "1.9.1"
103122
stack_trace:
104123
dependency: transitive
105124
description:
106125
name: stack_trace
107-
url: "https://pub.dartlang.org"
126+
sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5
127+
url: "https://pub.dev"
108128
source: hosted
109-
version: "1.10.0"
129+
version: "1.11.0"
110130
stream_channel:
111131
dependency: transitive
112132
description:
113133
name: stream_channel
114-
url: "https://pub.dartlang.org"
134+
sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8"
135+
url: "https://pub.dev"
115136
source: hosted
116-
version: "2.1.0"
137+
version: "2.1.1"
117138
string_scanner:
118139
dependency: transitive
119140
description:
120141
name: string_scanner
121-
url: "https://pub.dartlang.org"
142+
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
143+
url: "https://pub.dev"
122144
source: hosted
123-
version: "1.1.1"
145+
version: "1.2.0"
124146
term_glyph:
125147
dependency: transitive
126148
description:
127149
name: term_glyph
128-
url: "https://pub.dartlang.org"
150+
sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
151+
url: "https://pub.dev"
129152
source: hosted
130153
version: "1.2.1"
131154
test_api:
132155
dependency: transitive
133156
description:
134157
name: test_api
135-
url: "https://pub.dartlang.org"
158+
sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206
159+
url: "https://pub.dev"
136160
source: hosted
137-
version: "0.4.12"
161+
version: "0.4.16"
138162
vector_math:
139163
dependency: transitive
140164
description:
141165
name: vector_math
142-
url: "https://pub.dartlang.org"
166+
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
167+
url: "https://pub.dev"
143168
source: hosted
144-
version: "2.1.2"
169+
version: "2.1.4"
145170
sdks:
146-
dart: ">=2.17.0-0 <3.0.0"
171+
dart: ">=2.18.0 <3.0.0"
147172
flutter: ">=1.17.0"

lib/src/anim_search_widget.dart

+6-4
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ class AnimSearchBar extends StatefulWidget {
4242
final bool boxShadow;
4343
final Function(String) onSubmitted;
4444
final TextInputAction textInputAction;
45-
45+
final Function(int) searchBarOpen;
4646
const AnimSearchBar({
4747
Key? key,
4848

4949
/// The width cannot be null
5050
required this.width,
51-
51+
required this.searchBarOpen,
5252
/// The textController cannot be null
5353
required this.textController,
5454
this.suffixIcon,
@@ -137,15 +137,15 @@ class _AnimSearchBarState extends State<AnimSearchBar>
137137
@override
138138
Widget build(BuildContext context) {
139139
return Container(
140-
height: height,
140+
height: widget.height,
141141

142142
///if the rtl is true, search bar will be from right to left
143143
alignment: widget.rtl ? Alignment.centerRight : Alignment(-1.0, 0.0),
144144

145145
///Using Animated container to expand and shrink the widget
146146
child: AnimatedContainer(
147147
duration: Duration(milliseconds: widget.animationDurationInMilli),
148-
height: 48.0,
148+
height: widget.height,
149149
width: (toggle == 0) ? 48.0 : widget.width,
150150
curve: Curves.easeOut,
151151
decoration: BoxDecoration(
@@ -360,7 +360,9 @@ class _AnimSearchBarState extends State<AnimSearchBar>
360360
_con.reverse();
361361
}
362362
},
363+
363364
);
365+
widget.searchBarOpen(toggle);
364366
},
365367
),
366368
),

0 commit comments

Comments
 (0)