Skip to content

Commit

Permalink
Merge pull request #37 from Modernism-in-Architecture/upgrade-libraries
Browse files Browse the repository at this point in the history
Upgrade libraries
  • Loading branch information
normade authored Jan 1, 2024
2 parents ccfe79e + 3e29b49 commit 6e36c53
Show file tree
Hide file tree
Showing 31 changed files with 272 additions and 301 deletions.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ android {

defaultConfig {
applicationId "org.modernism_in_architecture.mia"
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
minSdkVersion localProperties.getProperty('flutter.minSdkVersion').toInteger()
targetSdkVersion localProperties.getProperty('flutter.targetSdkVersion').toInteger()
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand Down
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.6.10'
ext.kotlin_version = '1.9.10'
repositories {
google()
mavenCentral()
Expand Down Expand Up @@ -28,6 +28,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Future<void> main() async {


class Mia extends HookConsumerWidget {
const Mia({Key? key}) : super(key: key);
const Mia({super.key});

@override
Widget build(BuildContext context, WidgetRef ref) {
Expand Down
6 changes: 5 additions & 1 deletion lib/src/providers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dart:convert';
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:mia/src/widgets/custom_title_bar.dart';

Expand Down Expand Up @@ -104,7 +105,10 @@ final searchQueryProvider = StateProvider<String>((ref) {
});

final appBarIcon = StateProvider<Icon>((ref) {
return const Icon(CupertinoIcons.search);
return const Icon(
CupertinoIcons.search,
color: Colors.white,
);
});

final appBarType = StateProvider<Widget>((ref) {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/views/architect_detail_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import '../widgets/building_list/building_list_card.dart';


class ArchitectDetailView extends ConsumerStatefulWidget {
const ArchitectDetailView({Key? key, required this.architectId}) : super(key: key);
const ArchitectDetailView({super.key, required this.architectId});
final int architectId;

@override
Expand Down
15 changes: 9 additions & 6 deletions lib/src/views/architects_list_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import '../widgets/loading_screen.dart';


class ArchitectsListView extends ConsumerStatefulWidget {
const ArchitectsListView({Key? key}) : super(key: key);
const ArchitectsListView({super.key});

@override
ArchitectsListViewState createState() => ArchitectsListViewState();
Expand Down Expand Up @@ -94,11 +94,14 @@ class ArchitectsListViewState extends ConsumerState<ArchitectsListView> {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ArchitectIndexBar(
alphabet: _alphabet,
resultArchitects: filteredArchitectList,
itemSizeHeight: itemSizeHeight,
jumpToPosition: _jumpToSelectedLetter
Expanded(
flex: 10,
child: ArchitectIndexBar(
alphabet: _alphabet,
resultArchitects: filteredArchitectList,
itemSizeHeight: itemSizeHeight,
jumpToPosition: _jumpToSelectedLetter
)
)
]
),
Expand Down
2 changes: 1 addition & 1 deletion lib/src/views/bookmark_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'building_detail_view.dart';


class BookmarkView extends ConsumerStatefulWidget {
const BookmarkView({Key? key}) : super(key: key);
const BookmarkView({super.key});

@override
BookmarkViewState createState() => BookmarkViewState();
Expand Down
6 changes: 4 additions & 2 deletions lib/src/views/building_detail_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import 'architect_detail_view.dart';


class BuildingDetailView extends ConsumerStatefulWidget {
const BuildingDetailView({Key? key, required this.buildingId}) : super(key: key);
const BuildingDetailView({super.key, required this.buildingId});
final int buildingId;

@override
Expand Down Expand Up @@ -200,9 +200,11 @@ class BuildingDetailViewState extends ConsumerState<BuildingDetailView> {
snapshot.data!.name,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.normal
fontWeight: FontWeight.normal,
color: Colors.white
)
),
foregroundColor: Colors.white,
backgroundColor: Colors.black,
actions: <Widget>[
IconButton(
Expand Down
2 changes: 1 addition & 1 deletion lib/src/views/buildings_list_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import '../widgets/loading_screen.dart';


class BuildingsListView extends ConsumerStatefulWidget {
const BuildingsListView({Key? key}) : super(key: key);
const BuildingsListView({super.key});

@override
BuildingsListViewState createState() => BuildingsListViewState();
Expand Down
46 changes: 15 additions & 31 deletions lib/src/views/home_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import 'buildings_list_view.dart';


class HomeView extends ConsumerStatefulWidget {
const HomeView({Key? key}) : super(key: key);
const HomeView({super.key});

@override
HomeViewState createState() => HomeViewState();
Expand Down Expand Up @@ -50,8 +50,8 @@ class HomeViewState extends ConsumerState<HomeView> {
final titleBarIcon = ref.watch(appBarIcon);
final globalScaffold = ref.watch(scaffoldHomeViewKey);

return WillPopScope(
onWillPop: showExitPopup,
return PopScope(
canPop: false,
child: Scaffold(
backgroundColor: const Color.fromRGBO(241, 241, 241, 1),
bottomNavigationBar: BottomNavigationBar(
Expand Down Expand Up @@ -84,12 +84,18 @@ class HomeViewState extends ConsumerState<HomeView> {
(viewIndex == 0 || viewIndex == 2) ? IconButton(
onPressed: () {
if (titleBarIcon.icon == CupertinoIcons.search) {
ref.read(appBarIcon.notifier).state = const Icon(CupertinoIcons.xmark_circle);
ref.read(appBarIcon.notifier).state = const Icon(
CupertinoIcons.xmark_circle,
color: Colors.white
);
ref.read(appBarType.notifier).state = const CustomSearchBar();
} else {
ref
.read(appBarIcon.notifier)
.state = const Icon(CupertinoIcons.search);
.state = const Icon(
CupertinoIcons.search,
color: Colors.white,
);
ref
.read(appBarType.notifier)
.state = const CustomTitleBar();
Expand All @@ -113,34 +119,12 @@ class HomeViewState extends ConsumerState<HomeView> {
void _onBottomNavbarItemTapped(int index) {
ref.read(selectedViewIndex.notifier).state = index;
ref.read(appBarType.notifier).state = const CustomTitleBar();
ref.read(appBarIcon.notifier).state = const Icon(CupertinoIcons.search);
ref.read(appBarIcon.notifier).state = const Icon(
CupertinoIcons.search,
color: Colors.white,
);
final viewIndex = ref.watch(selectedViewIndex);
ref.read(appBarTitleProvider.notifier).state = titles[viewIndex];
}

Future<bool> showExitPopup() async {
return await showDialog(
context: context,
builder: (context) => AlertDialog(
title: const Text('EXIT YOUR FAVORITE APP'),
content: const Text('Do you really want to exit MIA?'),
actions:[
ElevatedButton(
onPressed: () => Navigator.of(context).pop(false),
style: ButtonStyle(
backgroundColor: MaterialStatePropertyAll<Color>(Colors.blue[900]!),
),
child: const Text('No'),
),
ElevatedButton(
onPressed: () => Navigator.of(context).pop(true),
style: const ButtonStyle(
backgroundColor: MaterialStatePropertyAll<Color>(Colors.red),
),
child: const Text('Yes'),
),
],
),
) ?? false;
}
}
138 changes: 69 additions & 69 deletions lib/src/views/map_view.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:flutter_map_marker_cluster/flutter_map_marker_cluster.dart';
Expand All @@ -9,16 +10,14 @@ import '../providers.dart';
import '../widgets/loading_screen.dart';
import '../widgets/maps/map_marker.dart';


class MapView extends ConsumerStatefulWidget {
const MapView({Key? key}) : super(key: key);
const MapView({super.key});

@override
MapViewState createState() => MapViewState();
}

class MapViewState extends ConsumerState<MapView> {

@override
Widget build(BuildContext context) {
final listBuildings = ref.watch(buildingsListDataProvider);
Expand All @@ -35,9 +34,7 @@ class MapViewState extends ConsumerState<MapView> {
markers.add(
Marker(
point: LatLng(building.latitude, building.longitude),
builder: (BuildContext context) {
return MapMarker(buildingId: building.id);
}
child: MapMarker(buildingId: building.id),
)
);
}
Expand All @@ -49,16 +46,17 @@ class MapViewState extends ConsumerState<MapView> {
List<Marker> getDefaultMarkerList () {
List<Marker> defaultMarkerList = [];
if (userGrantedLocationPermission) {
defaultMarkerList.add(Marker(
width: 80,
height: 80,
point: LatLng(
userLocation.latitude!,
userLocation.longitude!
),
builder: (context) =>
const DefaultLocationMarker()
));
defaultMarkerList.add(
Marker(
width: 80,
height: 80,
point: LatLng(
userLocation.latitude!,
userLocation.longitude!
),
child: const DefaultLocationMarker(),
)
);
}
return defaultMarkerList;
}
Expand All @@ -67,67 +65,69 @@ class MapViewState extends ConsumerState<MapView> {
children: <Widget>[
FlutterMap(
mapController: mapController,
layers: [
TileLayerOptions(
urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
subdomains: ['a', 'b', 'c'],
userAgentPackageName: 'org.architecture-in-modernism',
),
MarkerClusterLayerOptions(
maxClusterRadius: 80,
size: const Size(40, 40),
fitBoundsOptions: const FitBoundsOptions(
padding: EdgeInsets.all(50),
),
markers: markers,
polygonOptions: PolygonOptions(
borderColor: Colors.blue[900]!,
color: Colors.black12,
borderStrokeWidth: 1
),
builder: (context, markers) {
return FloatingActionButton(
heroTag: UniqueKey(),
backgroundColor: Colors.blue[900]!,
onPressed: null,
child: Text(markers.length.toString()),
);
},
),
MarkerLayerOptions(
markers: getDefaultMarkerList()
)
],
options: MapOptions(
plugins: [
MarkerClusterPlugin(),
],
center: LatLng(
initialCenter: LatLng(
currentLocation.latitude!,
currentLocation.longitude!
),
interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
zoom: 14,
interactionOptions: const InteractionOptions(
flags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
),
initialZoom: 14,
maxZoom: 19,
minZoom: 3,
),
),
Align(
alignment: Alignment.bottomRight,
child: Padding(
padding: const EdgeInsets.all(20.0),
child: FloatingActionButton(
backgroundColor: Colors.blue[900],
onPressed: () {
mapController.move(
LatLng(
userLocation.latitude!,
userLocation.longitude!
), 14);
},
child: const Icon(Icons.gps_fixed),
children: [
TileLayer(
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
userAgentPackageName: 'org.architecture-in-modernism',
),
),
MarkerLayer(
markers: getDefaultMarkerList()
),
MarkerClusterLayerWidget(
options: MarkerClusterLayerOptions(
maxClusterRadius: 80,
size: const Size(30, 30),
markers: markers,
builder: (context, markers) {
return FloatingActionButton(
heroTag: UniqueKey(),
backgroundColor: Colors.blue[900]!,
onPressed: null,
child: Text(
markers.length.toString(),
style: const TextStyle(
color: Colors.white,
fontSize: 11,
)
),
);
},
),
),
Align(
alignment: Alignment.bottomRight,
child: Padding(
padding: const EdgeInsets.all(10.0),
child: FloatingActionButton.small(
backgroundColor: Colors.blue[900]?.withOpacity(0.6),
onPressed: () {
mapController.move(
LatLng(
userLocation.latitude!,
userLocation.longitude!
), 14);
},
child:
const Icon(
CupertinoIcons.location,
color: Colors.white60,
),
),
),
),
],
)
]
);
Expand Down
Loading

0 comments on commit 6e36c53

Please sign in to comment.