-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from michaelfromyeg/navbar
UI changes
- Loading branch information
Showing
6 changed files
with
133 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
client/lib/features/geo_sphere/widgets/geo_sphere_widget.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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), | ||
), | ||
); | ||
}, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters