Skip to content

Commit

Permalink
Merge pull request #36 from OpenPecha/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
CodingWithTashi authored Nov 27, 2024
2 parents b56be0b + c36a1e8 commit 34e5722
Show file tree
Hide file tree
Showing 8 changed files with 117 additions and 19 deletions.
Binary file added assets/images/country.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 11 additions & 1 deletion lib/l10n/app_bo.arb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@
"scanQrCode": "ཚབ་ཨང་ཕབ་སྒྱུར།",
"address": "ཁ་བྱང་",
"location": "ས་གནས།",
"noRecordFound": "གྲོས་བསྒྲིག་མི་འདུག"
"noRecordFound": "གྲོས་བསྒྲིག་མི་འདུག",
"noRecentSearch": "ཉེ་ཆར་གྱི་འཚོལ་བཤེར་ལོ་རྒྱུས་",
"buddha": "སངས།",
"king": "རྒྱལ།",
"gaden": "དགའ་ལྡན།",
"arya": "ཨརྱ།",
"acharya": "སློབ་དཔོན་",
"milarepa": "མི་ལ་རེ་པ།",
"india": "རྒྱ་གར།",
"nepal": "བལ་ཡུལ།",
"bhutan": "འབྲུག་ཡུལ།"

}
12 changes: 11 additions & 1 deletion lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,17 @@
"scanQrCode": "Scan QR Code",
"address": "Address",
"location": "Location",
"noRecordFound": "No Record Found"
"noRecordFound": "No Record Found",
"noRecentSearch": "No Recent Search",
"buddha": "Buddha",
"king": "King",
"gaden": "Gaden",
"arya": "Arya",
"acharya": "Acharya",
"milarepa": "Milarepa",
"india": "India",
"nepal": "Nepal",
"bhutan": "Bhutan"



Expand Down
30 changes: 19 additions & 11 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:gompa_tour/states/global_audio_state.dart';
import 'package:gompa_tour/states/language_state.dart';
import 'package:gompa_tour/states/theme_mode_state.dart';
import 'package:gompa_tour/ui/widget/persistent_audio_player.dart';
Expand Down Expand Up @@ -52,17 +53,24 @@ class MyApp extends ConsumerWidget {
debugShowCheckedModeBanner: false,
routerConfig: router,
builder: (context, child) {
return Stack(
children: [
child!,
Positioned(
top: 0,
left: 0,
right: 0,
child: PersistentAudioPlayer(),
),
],
);
final audioState = ref.watch(globalAudioPlayerProvider);
if (audioState.currentAudioUrl != null) {
return Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
PersistentAudioPlayer(),
Expanded(
child: MediaQuery(
data: MediaQuery.of(context).copyWith(
padding: EdgeInsets.symmetric(vertical: 8),
),
child: child!,
),
),
],
);
}
return child!;
},
);
}
Expand Down
39 changes: 36 additions & 3 deletions lib/ui/screen/map_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:gompa_tour/helper/database_helper.dart';
import 'package:gompa_tour/helper/localization_helper.dart';
import 'package:gompa_tour/models/organization_model.dart';
import 'package:gompa_tour/ui/screen/organization_detail_screen.dart';
import 'package:gompa_tour/ui/widget/country_marker.dart';
import 'package:gompa_tour/ui/widget/gonpa_cache_image.dart';
import 'package:latlong2/latlong.dart';

Expand Down Expand Up @@ -49,6 +50,7 @@ class _MapScreenState extends ConsumerState<MapScreen> {
options: const MapOptions(
initialCenter: LatLng(20.5937, 78.9629),
initialZoom: 5,
minZoom: 4,
),
children: [
GestureDetector(
Expand All @@ -65,9 +67,13 @@ class _MapScreenState extends ConsumerState<MapScreen> {
final state = ref.watch(organizationNotifierProvider);
logger.info("Organization:$state");
return MarkerLayer(
markers: state.organizations
.map((location) => _buildMarker(location))
.toList(),
markers: [
...state.organizations
.where((location) => location.map.trim().isNotEmpty)
.map((location) => _buildMarker(location))
.toList(),
..._buildCountryMarker(),
],
);
},
)
Expand Down Expand Up @@ -186,4 +192,31 @@ class _MapScreenState extends ConsumerState<MapScreen> {
),
);
}

_buildCountryMarker() {
// get and return india, bhutan and nepal coordinates
final countries = [
{
'name': AppLocalizations.of(context)!.india,
'coordinates': LatLng(20.5937, 78.9629),
},
{
'name': AppLocalizations.of(context)!.bhutan,
'coordinates': LatLng(27.5142, 90.4336),
},
{
'name': AppLocalizations.of(context)!.nepal,
'coordinates': LatLng(28.3949, 84.1240),
},
];

return countries.map((country) {
return Marker(
point: country['coordinates'] as LatLng,
width: 40,
height: 40,
child: CountryMarker(country: country),
);
}).toList();
}
}
6 changes: 4 additions & 2 deletions lib/ui/screen/search_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,11 @@ class _SearchScreenState extends ConsumerState<SearchScreen> {
),

recentSearches.isEmpty
? const Padding(
? Padding(
padding: EdgeInsets.symmetric(vertical: 16.0),
child: Center(child: Text('No recent searches')),
child: Center(
child:
Text(AppLocalizations.of(context)!.noRecentSearch)),
)
: SingleChildScrollView(
scrollDirection: Axis.horizontal,
Expand Down
4 changes: 3 additions & 1 deletion lib/ui/screen/settings_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ class SettingsScreen extends ConsumerWidget {
String currentLanguage,
) {
return ListTile(
title: Text(title),
title: Text(
title,
),
subtitle: Text(subtitle),
trailing: Radio<String>(
value: code,
Expand Down
33 changes: 33 additions & 0 deletions lib/ui/widget/country_marker.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import 'package:flutter/material.dart';

class CountryMarker extends StatefulWidget {
final Map<String, dynamic> country;
const CountryMarker({super.key, required this.country});

@override
State<CountryMarker> createState() => _CountryMarkerState();
}

class _CountryMarkerState extends State<CountryMarker> {
final GlobalKey key = GlobalKey();
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () {
final dynamic tooltip = key.currentState;
tooltip.ensureTooltipVisible();
},
child: Tooltip(
key: key,
message: widget.country['name'] as String,
textStyle: TextStyle(
color: Theme.of(context).colorScheme.onSurface,
),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surfaceContainer,
borderRadius: BorderRadius.circular(8)),
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
child: Image.asset('assets/images/country.png')),
);
}
}

0 comments on commit 34e5722

Please sign in to comment.