Skip to content

Commit

Permalink
Merge pull request #135 from TechnionTDK/fix/radius-and-app-bar-in-se…
Browse files Browse the repository at this point in the history
…arch-page

Fix/radius and app bar in search page
  • Loading branch information
raz-levi authored May 17, 2022
2 parents 1001131 + ff02a1f commit 33bac68
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 59 deletions.
2 changes: 1 addition & 1 deletion .packages
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# For more info see: https://dart.dev/go/dot-packages-deprecation
#
# Generated by pub on 2022-05-17 12:47:19.405834.
# Generated by pub on 2022-05-17 15:38:18.089021.
archive:file:///Users/raz/flutter/.pub-cache/hosted/pub.dartlang.org/archive-3.3.0/lib/
args:file:///Users/raz/flutter/.pub-cache/hosted/pub.dartlang.org/args-2.3.0/lib/
async:file:///Users/raz/flutter/.pub-cache/hosted/pub.dartlang.org/async-2.8.2/lib/
Expand Down
4 changes: 3 additions & 1 deletion lib/controllers/store_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class StoreController extends GetxController {

void updateRadius(String newRadius) {
radius.value = newRadius;
radius.refresh();
update();
GoogleAnalytics.instance.logRadiusChanged();
}
Expand All @@ -79,7 +80,7 @@ class StoreController extends GetxController {

Future<bool> updatePlaceToOtherMode({required String otherPlace}) async {
PlaceDetails placeDetails = await ClientRequests.instance.getPlaceDetailsByPartiallyName(place: otherPlace);
if (placeDetails.coordinates != null && placeDetails.name != null) {
if (placeDetails.coordinates != null) {
placeCoordinates.value = placeDetails.coordinates!;
placeName.value = placeDetails.name;
placeMode.value = EPlaceMode.other;
Expand Down Expand Up @@ -112,6 +113,7 @@ class StoreController extends GetxController {
}

placesCollection.value = PlacesPageCollection.fromJson(placeJson, placeFilters.value);
placesCollection.refresh();
update();

if (reportToGA) {
Expand Down
2 changes: 1 addition & 1 deletion lib/global/config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class ProjectConfig {

// Project Config
static const String projectName = "WikiPo";
static const String projectVersion = "v1.1.0";
static const String projectVersion = "v1.1.1";

// Backend Config
static const String serverAddress = "132.69.8.15:80";
Expand Down
8 changes: 4 additions & 4 deletions lib/pages/home/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
FlutterNativeSplash.remove();
}

Widget _openCurrentPage() {
Widget get _getCurrentPage {
switch (_storeController.currentMainAppPage.value) {
case EAppPages.map:
return MapPage();
return const MapPage();

case EAppPages.places:
default:
return PlacesPage();
return const PlacesPage();
}
}

Expand All @@ -72,7 +72,7 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
children: [
Padding(
padding: const EdgeInsets.only(bottom: 45.0),
child: _openCurrentPage(),
child: _getCurrentPage,
),
const Positioned(bottom: 0, left: 0, child: BottomNavigation()),
],
Expand Down
19 changes: 14 additions & 5 deletions lib/pages/places/places_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@ import 'package:wiki_places/widgets/place/place_card.dart';
import 'package:wiki_places/widgets/search_places_fab.dart';
import 'package:wiki_places/widgets/about_the_app.dart';

class PlacesPage extends StatelessWidget {
PlacesPage({Key? key}) : super(key: key);
class PlacesPage extends StatefulWidget {
const PlacesPage({Key? key}) : super(key: key);

@override
State<PlacesPage> createState() => _PlacesPageState();
}

class _PlacesPageState extends State<PlacesPage> {
final _storeController = Get.put(StoreController());

List<Widget> get _getPlaces {
Expand Down Expand Up @@ -41,17 +47,20 @@ class PlacesPage extends StatelessWidget {
_storeController.updateGlobalIsLoading(false);
}

void _rebuildPage() {
setState(() {});
}

@override
Widget build(BuildContext context) {
return GetX<StoreController>(
builder: (store) =>
_storeController.placesCollection.value.isEmpty ?
builder: (store) => _storeController.placesCollection.value.isEmpty ?
PlaceholderPage(
content: 'strNoPlacesAvailable'.tr,
appBar: const SearchPlaceAppbar(showAppTitle: true),
) : Scaffold(
extendBodyBehindAppBar: true,
appBar: const SearchPlaceAppbar(),
appBar: SearchPlaceAppbar(afterSearchCallback: _rebuildPage),
body: Stack(
children: [
Container(
Expand Down
1 change: 1 addition & 0 deletions lib/pages/search_place/search_place.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ class _SearchPlacePageState extends State<SearchPlacePage> {
return LoadingOverlay(
isLoading: _isLoading,
child: Scaffold(
resizeToAvoidBottomInset: false,
appBar: WikiPlacesAppBar(title: 'strSearchPlaceAround'.tr),
body: Stack(
children: [
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/appbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class SearchPlaceAppbar extends StatelessWidget implements PreferredSizeWidget {
@override
Size get preferredSize => const Size.fromHeight(kToolbarHeight);

void _openChangeRadiusDialog() {
void _openSearchPlacePage() {
navigateToPage(SearchPlacePage(afterSearchCallback: afterSearchCallback));
}

Expand All @@ -31,7 +31,7 @@ class SearchPlaceAppbar extends StatelessWidget implements PreferredSizeWidget {
icon: Icon(GlobalConstants.infoIcon, size: 25, color: Get.isDarkMode ? Colors.white : const Color(0xff393F36)),
),
IconButton(
onPressed: _openChangeRadiusDialog,
onPressed: _openSearchPlacePage,
icon: Icon(GlobalConstants.searchIcon, size: 25, color: Get.isDarkMode ? Colors.white : const Color(0xff393F36)),
),
],
Expand Down
33 changes: 0 additions & 33 deletions lib/widgets/neumorphic_rectangle.dart

This file was deleted.

13 changes: 2 additions & 11 deletions lib/widgets/search_place/change_radius_slider.dart
Original file line number Diff line number Diff line change
@@ -1,27 +1,18 @@
// ================= Change Radius Slider =================
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:wiki_places/controllers/store_controller.dart';
import 'package:wiki_places/global/constants.dart';
import 'package:wiki_places/global/types.dart';

class ChangeRadiusSlider extends StatefulWidget {
ChangeRadiusSlider({required this.controller, Key? key}) : super(key: key);
PrimitiveWrapper controller;
const ChangeRadiusSlider({required this.controller, Key? key}) : super(key: key);
final PrimitiveWrapper controller;

@override
State<ChangeRadiusSlider> createState() => _ChangeRadiusSliderState();
}

class _ChangeRadiusSliderState extends State<ChangeRadiusSlider> {
final _storeController = Get.put(StoreController());

@override
void initState() {
super.initState();
widget.controller = PrimitiveWrapper(double.parse(_storeController.radius.value));
}

void _updateSlider(double value) {
setState(() {
widget.controller.value = value;
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: wiki_places
description: WikiPo app.

publish_to: 'none'
version: 1.1.0+1
version: 1.1.1+1

environment:
sdk: ">=2.15.1 <3.0.0"
Expand Down

0 comments on commit 33bac68

Please sign in to comment.