Skip to content

Commit

Permalink
Add advanced search settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonavichus committed Feb 12, 2024
1 parent f77d09d commit da07dc2
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 12 deletions.
25 changes: 22 additions & 3 deletions lib/app/modules/geolocation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ import 'package:rain/app/widgets/text_form.dart';
import 'package:rain/main.dart';

class SelectGeolocation extends StatefulWidget {
const SelectGeolocation({super.key});
const SelectGeolocation({
super.key,
required this.isStart,
});
final bool isStart;

@override
State<SelectGeolocation> createState() => _SelectGeolocationState();
Expand Down Expand Up @@ -63,6 +67,19 @@ class _SelectGeolocationState extends State<SelectGeolocation> {
resizeToAvoidBottomInset: true,
appBar: AppBar(
centerTitle: true,
leading: widget.isStart
? null
: IconButton(
onPressed: () {
Get.back();
},
icon: const Icon(
Iconsax.arrow_left_1,
size: 20,
),
splashColor: Colors.transparent,
highlightColor: Colors.transparent,
),
automaticallyImplyLeading: false,
title: Text(
'searchCity'.tr,
Expand Down Expand Up @@ -359,8 +376,10 @@ class _SelectGeolocationState extends State<SelectGeolocation> {
_controllerDistrict.text,
_controllerCity.text,
);
Get.off(() => const HomePage(),
transition: Transition.downToUp);
widget.isStart
? Get.off(() => const HomePage(),
transition: Transition.downToUp)
: Get.back();
} catch (error) {
Future.error(error);
}
Expand Down
13 changes: 10 additions & 3 deletions lib/app/modules/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:rain/app/controller/controller.dart';
import 'package:rain/app/data/weather.dart';
import 'package:rain/app/modules/cards/view/list_weather_card.dart';
import 'package:rain/app/modules/cards/widgets/create_card_weather.dart';
import 'package:rain/app/modules/geolocation.dart';
import 'package:rain/app/modules/main/view/weather.dart';
import 'package:rain/app/modules/settings/view/settings.dart';
import 'package:rain/app/services/utils.dart';
Expand Down Expand Up @@ -81,9 +82,15 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
centerTitle: true,
automaticallyImplyLeading: false,
leading: switch (tabIndex) {
0 => const Icon(
Iconsax.global_search,
size: 18,
0 => IconButton(
onPressed: () {
Get.to(() => const SelectGeolocation(isStart: false),
transition: Transition.downToUp);
},
icon: const Icon(
Iconsax.global_search,
size: 18,
),
),
int() => null,
},
Expand Down
3 changes: 2 additions & 1 deletion lib/app/modules/onboarding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ class _OnBordingState extends State<OnBording> {
void onBoardHome() {
settings.onboard = true;
isar.writeTxnSync(() => isar.settings.putSync(settings));
Get.off(() => const SelectGeolocation(), transition: Transition.downToUp);
Get.off(() => const SelectGeolocation(isStart: true),
transition: Transition.downToUp);
}

@override
Expand Down
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ class _MyAppState extends State<MyApp> {
(locationCache.district == null) ||
(locationCache.lat == null) ||
(locationCache.lon == null)
? const SelectGeolocation()
? const SelectGeolocation(isStart: true)
: const HomePage()
: const OnBording(),
);
Expand Down
8 changes: 4 additions & 4 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -441,10 +441,10 @@ packages:
dependency: "direct main"
description:
name: geolocator
sha256: e946395fc608842bb2f6c914807e9183f86f3cb787f6b8f832753e5251036f02
sha256: f4efb8d3c4cdcad2e226af9661eb1a0dd38c71a9494b22526f9da80ab79520e5
url: "https://pub.dev"
source: hosted
version: "10.1.0"
version: "10.1.1"
geolocator_android:
dependency: transitive
description:
Expand All @@ -457,10 +457,10 @@ packages:
dependency: transitive
description:
name: geolocator_apple
sha256: "79babf44b692ec5e789d322dc736ef71586056e8e6828f747c9e005456b248bf"
sha256: "2f2d4ee16c4df269e93c0e382be075cc01d5db6703c3196e4af20a634fe49ef4"
url: "https://pub.dev"
source: hosted
version: "2.3.5"
version: "2.3.6"
geolocator_platform_interface:
dependency: transitive
description:
Expand Down

0 comments on commit da07dc2

Please sign in to comment.