Skip to content

Commit

Permalink
Merge pull request #6 from hkk97/dev-klaus
Browse files Browse the repository at this point in the history
Set Search TextField fillColor to white
  • Loading branch information
hkk97 committed Mar 22, 2024
2 parents f0bd2dd + 80de4d5 commit 16cde4e
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 45 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,7 @@
## 0.1.1

* Add withDialCode feature

## 0.1.2

* Set Search TextField fillColor to white
2 changes: 1 addition & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
4 changes: 2 additions & 2 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class App extends StatelessWidget {
context,
country,
);
},
}, onBuilded: (){}, onClosed: (){},
);
},
child: Center(
Expand Down Expand Up @@ -112,7 +112,7 @@ class App extends StatelessWidget {
context,
country,
);
},
}, onBuilded: (){},
),
);
}
Expand Down
140 changes: 100 additions & 40 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
@@ -1,60 +1,75 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
after_layout:
dependency: transitive
description:
name: after_layout
sha256: "95a1cb2ca1464f44f14769329fbf15987d20ab6c88f8fc5d359bd362be625f29"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
url: "https://pub.dev"
source: hosted
version: "2.9.0"
version: "2.11.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
url: "https://pub.dev"
source: hosted
version: "2.1.0"
version: "2.1.1"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
url: "https://pub.dev"
source: hosted
version: "1.2.1"
version: "1.3.0"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
url: "https://pub.dev"
source: hosted
version: "1.1.1"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
url: "https://pub.dev"
source: hosted
version: "1.16.0"
version: "1.18.0"
country_selector_widget:
dependency: "direct dev"
description:
path: ".."
relative: true
source: path
version: "0.1.0"
version: "0.1.1"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
url: "https://pub.dartlang.org"
sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d
url: "https://pub.dev"
source: hosted
version: "1.0.5"
version: "1.0.6"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
url: "https://pub.dev"
source: hosted
version: "1.3.1"
flutter:
Expand All @@ -66,49 +81,79 @@ packages:
dependency: "direct dev"
description:
name: flutter_lints
url: "https://pub.dartlang.org"
sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04
url: "https://pub.dev"
source: hosted
version: "2.0.1"
version: "2.0.3"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
leak_tracker:
dependency: transitive
description:
name: leak_tracker
sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa"
url: "https://pub.dev"
source: hosted
version: "10.0.0"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0
url: "https://pub.dev"
source: hosted
version: "2.0.1"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47
url: "https://pub.dev"
source: hosted
version: "2.0.1"
lints:
dependency: transitive
description:
name: lints
url: "https://pub.dartlang.org"
sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452"
url: "https://pub.dev"
source: hosted
version: "2.0.1"
version: "2.1.1"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
url: "https://pub.dev"
source: hosted
version: "0.12.12"
version: "0.12.16+1"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
url: "https://pub.dev"
source: hosted
version: "0.1.5"
version: "0.8.0"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
url: "https://pub.dev"
source: hosted
version: "1.8.0"
version: "1.11.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
url: "https://pub.dev"
source: hosted
version: "1.8.2"
version: "1.9.0"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -118,51 +163,66 @@ packages:
dependency: transitive
description:
name: source_span
url: "https://pub.dartlang.org"
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
url: "https://pub.dev"
source: hosted
version: "1.9.0"
version: "1.10.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
url: "https://pub.dev"
source: hosted
version: "1.10.0"
version: "1.11.1"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
url: "https://pub.dev"
source: hosted
version: "2.1.0"
version: "2.1.2"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
url: "https://pub.dev"
source: hosted
version: "1.1.1"
version: "1.2.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
url: "https://pub.dev"
source: hosted
version: "1.2.1"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
url: "https://pub.dev"
source: hosted
version: "0.4.12"
version: "0.6.1"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
url: "https://pub.dev"
source: hosted
version: "2.1.2"
version: "2.1.4"
vm_service:
dependency: transitive
description:
name: vm_service
sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957
url: "https://pub.dev"
source: hosted
version: "13.0.0"
sdks:
dart: ">=2.18.4 <3.0.0"
flutter: ">=1.17.0"
dart: ">=3.2.0-0 <4.0.0"
flutter: ">=3.0.0"
19 changes: 18 additions & 1 deletion lib/country_selector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export 'const/enum.dart';
export 'const/country.dart';

import 'dart:async';
import 'package:after_layout/after_layout.dart';
import 'package:flutter/material.dart';
import 'package:country_selector_widget/country_selector.dart';
import 'package:country_selector_widget/data/coutnry_list.dart';
Expand All @@ -13,6 +14,8 @@ import 'package:country_selector_widget/util/text_util.dart';
// func to show countryselectorbottom sheet
Future<void> showCountrySelectorBottomSheet({
required BuildContext context,
required Function onBuilded,
required Function onClosed,
// Used to determine whether show the dialCode of country or not
bool withDialCode = false,
// The refCountryCode used to indicate the default selected country
Expand Down Expand Up @@ -99,6 +102,7 @@ Future<void> showCountrySelectorBottomSheet({
child: SizedBox(
height: bottomSheetHeight ?? MediaQuery.of(context).size.height * 0.8,
child: CountrySelectorWidget(
onBuilded: onBuilded,
customAppBar: customAppBar,
withDialCode: withDialCode,
refCountryCode: refCountryCode,
Expand All @@ -110,6 +114,7 @@ Future<void> showCountrySelectorBottomSheet({
onSelectedCountry: (country) {
Navigator.pop(context);
onSelectedCountry(country);
onClosed();
},
appBarText: appBarText,
searchText: searchText,
Expand All @@ -135,6 +140,8 @@ Future<void> showCountrySelectorBottomSheet({
}

class CountrySelectorWidget extends StatefulWidget {
final Function onBuilded;

// Used to determine whether show the dialCode of country or not
final bool withDialCode;
// The refCountryCode used to indicate the default selected country
Expand Down Expand Up @@ -195,6 +202,7 @@ class CountrySelectorWidget extends StatefulWidget {

const CountrySelectorWidget({
super.key,
required this.onBuilded,
this.withDialCode = false,
this.refCountryCode,
this.customAppBar,
Expand Down Expand Up @@ -241,7 +249,8 @@ class CountrySelectorWidget extends StatefulWidget {
CountrySelectorWidgetState createState() => CountrySelectorWidgetState();
}

class CountrySelectorWidgetState extends State<CountrySelectorWidget> {
class CountrySelectorWidgetState extends State<CountrySelectorWidget>
with AfterLayoutMixin {
late ScrollController _scrollController;
late List<Country> _countries;
late ValueNotifier<List<Country>?> _countriesNotifi;
Expand Down Expand Up @@ -309,6 +318,7 @@ class CountrySelectorWidgetState extends State<CountrySelectorWidget> {
appBar: widget.customAppBar ??
AppBar(
backgroundColor: Colors.white,
surfaceTintColor: Colors.white,
elevation: 0.0,
centerTitle: true,
title: Text(
Expand Down Expand Up @@ -351,6 +361,7 @@ class CountrySelectorWidgetState extends State<CountrySelectorWidget> {
filled: true,
hintText:
widget.searchText ?? _textUtil.searchStr() ?? "",
fillColor: Colors.white,
prefixIcon: const Icon(
Icons.search,
color: Colors.grey,
Expand Down Expand Up @@ -577,6 +588,11 @@ class CountrySelectorWidgetState extends State<CountrySelectorWidget> {
),
);
}

@override
FutureOr<void> afterFirstLayout(BuildContext context) {
widget.onBuilded();
}
}

// the widget used to visualize the country object
Expand Down Expand Up @@ -653,6 +669,7 @@ class CountryCardWidgetState extends State<CountryCardWidget>
onTap: () => widget.onClickSelected(),
child: Card(
color: Colors.white,
surfaceTintColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: const BorderRadius.all(
Radius.circular(
Expand Down
Loading

0 comments on commit 16cde4e

Please sign in to comment.