Skip to content

Commit

Permalink
Merge pull request #13 from michaelfromyeg/navbar
Browse files Browse the repository at this point in the history
UI changes
  • Loading branch information
oltimaloku authored Feb 6, 2024
2 parents 48d72f5 + 67e9be3 commit f296d75
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 93 deletions.
2 changes: 2 additions & 0 deletions client/lib/features/gallery/views/geo_sphere_gallery.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:georeal/features/gallery/view_model/gallery_view_model.dart';
import 'package:georeal/features/gallery/widgets/gallery_navbar.dart';
import 'package:georeal/global_variables.dart';
import 'package:georeal/models/geo_sphere_model.dart';
import 'package:provider/provider.dart';

Expand All @@ -23,6 +24,7 @@ class GeoSphereGallery extends StatelessWidget {
galleryViewModel.getPhotosFromGallery(geoSphere.geoSphereId);

return Scaffold(
backgroundColor: GlobalVariables.backgroundColor,
body: SafeArea(
child: Column(
children: [
Expand Down
19 changes: 16 additions & 3 deletions client/lib/features/gallery/widgets/gallery_navbar.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:georeal/global_variables.dart';
import 'package:provider/provider.dart';

import '../../../models/geo_sphere_model.dart';
Expand All @@ -22,9 +23,18 @@ class GalleryNavBar extends StatelessWidget {
Navigator.pop(context);
},
iconSize: 24,
icon: const Icon(Icons.arrow_back_ios_new_rounded),
icon: const Icon(
Icons.arrow_back_ios_new_rounded,
color: Colors.white,
),
),
Text(
geoSphere.name,
style: const TextStyle(
fontSize: 20,
color: GlobalVariables.secondaryColor,
fontWeight: FontWeight.bold),
),
Text(geoSphere.name, style: const TextStyle(fontSize: 20)),
IconButton(
onPressed: () async {
final confirmDelete = await showDialog(
Expand Down Expand Up @@ -57,7 +67,10 @@ class GalleryNavBar extends StatelessWidget {
}
},
iconSize: 24,
icon: const Icon(Icons.delete_rounded),
icon: const Icon(
Icons.delete_rounded,
color: Colors.white,
),
),
],
);
Expand Down
97 changes: 14 additions & 83 deletions client/lib/features/geo_sphere/views/geo_spheres_view.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:georeal/features/gallery/views/geo_sphere_gallery.dart';
import 'package:georeal/features/geo_sphere/widgets/geo_sphere_widget.dart';
import 'package:georeal/global_variables.dart';
import 'package:provider/provider.dart';

Expand All @@ -15,98 +15,29 @@ class GeoSphereView extends StatelessWidget {
//final geoSphereViewModel =
// Provider.of<GeoSphereViewModel>(context, listen: false);
return Scaffold(
backgroundColor: const Color.fromARGB(255, 18, 18, 26),
appBar: AppBar(
title: const Text(
"GeoSpheres in your area",
style: TextStyle(
color: GlobalVariables.secondaryColor,
fontWeight: FontWeight.bold),
),
backgroundColor: GlobalVariables.backgroundColor,
),
backgroundColor: GlobalVariables.backgroundColor,
body: SafeArea(
child: Column(
children: [
const Text(
"Geo spheres in your area",
style: GlobalVariables.headerStyle,
),
const Divider(),
Expanded(
child: Consumer<GeoSphereViewModel>(
builder: (context, geoSphereViewModel, child) {
return ListView.builder(
itemCount: geoSphereViewModel.geoSpheres.length,
itemBuilder: (context, index) {
var geoSphere = geoSphereViewModel.geoSpheres[index];
return GestureDetector(
child: Container(
decoration: BoxDecoration(
border: Border.all(color: Colors.transparent)),
child: Column(
children: [
Padding(
padding: const EdgeInsets.fromLTRB(20, 8, 20, 8),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
geoSphere.name,
style: GlobalVariables.headerStyle,
),
Row(
children: [
FutureBuilder<String>(
future:
geoSphereViewModel.getNeighborhood(
geoSphere.latitude,
geoSphere.longitude),
builder: (BuildContext context,
AsyncSnapshot<String> snapshot) {
if (snapshot.connectionState ==
ConnectionState.waiting) {
return const CircularProgressIndicator();
} else if (snapshot.hasError) {
return const Text('Error');
} else {
return Text(
snapshot.data ?? 'Unknown');
}
},
),
const Text(","),
const SizedBox(
width: 8,
),
FutureBuilder<double>(
future: geoSphereViewModel
.getDistanceToGeoSphere(geoSphere),
builder: (BuildContext context,
AsyncSnapshot<double> snapshot) {
if (snapshot.connectionState ==
ConnectionState.waiting) {
return const CircularProgressIndicator();
} else if (snapshot.hasError) {
return const Text('Error');
} else {
return Text(
'${snapshot.data.toString()} km' ??
'Unknown');
}
},
),
],
),
],
),
),
const Divider(),
],
),
),
// Takes you to the gallery of the selected geo sphere
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
GeoSphereGallery(geoSphere: geoSphere),
),
);
},
return Padding(
padding: const EdgeInsets.fromLTRB(20, 8, 20, 8),
child: GeoSphereWidget(geoSphere: geoSphere),
);
},
);
Expand Down
96 changes: 96 additions & 0 deletions client/lib/features/geo_sphere/widgets/geo_sphere_widget.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import 'package:flutter/material.dart';
import 'package:georeal/global_variables.dart';
import 'package:provider/provider.dart';

import '../../../models/geo_sphere_model.dart';
import '../../gallery/views/geo_sphere_gallery.dart';
import '../view_model/geo_sphere_view_model.dart';

class GeoSphereWidget extends StatelessWidget {
final GeoSphere geoSphere;
const GeoSphereWidget({super.key, required this.geoSphere});

@override
Widget build(BuildContext context) {
final geoSphereViewModel = Provider.of<GeoSphereViewModel>(context);
return GestureDetector(
child: Container(
height: 50,
decoration: const BoxDecoration(
color: Color.fromRGBO(22, 24, 31, 1),
borderRadius: BorderRadius.all(
Radius.circular(10),
),
),
child: Padding(
padding: const EdgeInsets.fromLTRB(20, 8, 20, 8),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
geoSphere.name,
style: const TextStyle(
color: GlobalVariables.secondaryColor,
fontWeight: FontWeight.bold),
),
Row(
children: [
FutureBuilder<String>(
future: geoSphereViewModel.getNeighborhood(
geoSphere.latitude, geoSphere.longitude),
builder:
(BuildContext context, AsyncSnapshot<String> snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const CircularProgressIndicator();
} else if (snapshot.hasError) {
return const Text('Error');
} else {
return Text(
snapshot.data ?? 'Unknown',
style: const TextStyle(color: Colors.white),
);
}
},
),
const Text(
",",
style: TextStyle(color: Colors.white),
),
const SizedBox(
width: 8,
),
FutureBuilder<double>(
future:
geoSphereViewModel.getDistanceToGeoSphere(geoSphere),
builder:
(BuildContext context, AsyncSnapshot<double> snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const CircularProgressIndicator();
} else if (snapshot.hasError) {
return const Text('Error');
} else {
return Text(
'${snapshot.data.toString()} km' ?? 'Unknown',
style: const TextStyle(color: Colors.white),
);
}
},
),
],
),
],
),
),
),
// Takes you to the gallery of the selected geo sphere
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => GeoSphereGallery(geoSphere: geoSphere),
),
);
},
);
}
}
5 changes: 2 additions & 3 deletions client/lib/global_variables.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';

class GlobalVariables {

static String get URI => dotenv.env['SERVER_URI'] ?? 'http://localhost:3000';
static String get GOOGLE_API_KEY => dotenv.env['GOOGLE_API_KEY'] ?? '';

// COLORS
static const accentColor = Colors.red;
static const backgroundColor = Color.fromRGBO(255, 255, 255, 1);
static const foregroundColor = Color.fromRGBO(17, 45, 78, 1);
static const backgroundColor = Color.fromRGBO(12, 12, 12, 1);
static const foregroundColor = Color.fromRGBO(33, 33, 33, 1);
static const primaryColor = Color.fromRGBO(2, 11, 30, 1);
static const secondaryColor = Color.fromRGBO(63, 114, 175, 1);

Expand Down
7 changes: 3 additions & 4 deletions client/lib/home_router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,8 @@ class _HomeRouterState extends State<HomeRouter> {
extendBody: true,
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
floatingActionButton: FloatingActionButton(
foregroundColor:
GlobalVariables.secondaryColor, //Color.fromARGB(255, 3, 179, 0),
backgroundColor: const Color.fromARGB(255, 10, 10, 10),
foregroundColor: Colors.black, //Color.fromARGB(255, 3, 179, 0),
backgroundColor: GlobalVariables.secondaryColor,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(50.0)),
),
Expand All @@ -68,7 +67,7 @@ class _HomeRouterState extends State<HomeRouter> {
),
bottomNavigationBar: BottomAppBar(
height: 64,
color: const Color.fromARGB(255, 10, 10, 10),
color: const Color.fromARGB(255, 12, 12, 12),
shape: const CircularNotchedRectangle(),
child: Container(
child: Row(
Expand Down

0 comments on commit f296d75

Please sign in to comment.