-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
244 additions
and
151 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
export 'source/namaz_times_local_data_source.dart'; | ||
export 'source/namaz_times_remote_data_source.dart'; | ||
export 'source/remote/namaz_time_remote_data_source_impl.dart'; | ||
export 'model/namaz_times_response.dart'; | ||
export 'model/namaz_times_model_response.dart'; | ||
export 'model/continent_model_response.dart'; | ||
export 'model/region_model_response.dart'; |
54 changes: 54 additions & 0 deletions
54
app/lib/modules/namaz_time/data/model/namaz_times_model_response.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,54 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:json_annotation/json_annotation.dart'; | ||
|
||
part 'namaz_times_model_response.g.dart'; | ||
|
||
@JsonSerializable() | ||
@immutable | ||
class NamazTimesResponse { | ||
const NamazTimesResponse({ | ||
required this.id, | ||
this.title, | ||
this.titleRu, | ||
this.titleEn, | ||
this.lat, | ||
this.lon, | ||
this.bagymdatOffset, | ||
this.sunriseOffset, | ||
this.zuhrOffset, | ||
this.asrOffset, | ||
this.magribOffset, | ||
this.ishaOffset, | ||
this.useFormula, | ||
this.validUntil, | ||
this.startDateTz, | ||
this.startDateSecondTz, | ||
this.timezone, | ||
this.secondTimezone, | ||
this.times, | ||
}); | ||
|
||
factory NamazTimesResponse.fromJson(Map<String, dynamic> json) => _$NamazTimesResponseFromJson(json); | ||
|
||
Map<String, dynamic> toJson() => _$NamazTimesResponseToJson(this); | ||
|
||
final int id; | ||
final String? title; | ||
final String? titleRu; | ||
final String? titleEn; | ||
final double? lat; | ||
final double? lon; | ||
final int? bagymdatOffset; | ||
final int? sunriseOffset; | ||
final int? zuhrOffset; | ||
final int? asrOffset; | ||
final int? magribOffset; | ||
final int? ishaOffset; | ||
final int? useFormula; | ||
final String? validUntil; | ||
final String? startDateTz; | ||
final String? startDateSecondTz; | ||
final int? timezone; | ||
final int? secondTimezone; | ||
final Map<String, List<String>>? times; | ||
} |
33 changes: 16 additions & 17 deletions
33
...me/data/model/namaz_times_response.g.dart → ...a/model/namaz_times_model_response.g.dart
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
95 changes: 0 additions & 95 deletions
95
app/lib/modules/namaz_time/data/model/namaz_times_response.dart
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export 'cubit/namaz_time_cubit.dart'; | ||
export 'view/choose_continent_view.dart'; | ||
export 'view/choose_regions_view.dart'; | ||
export 'view/choose_city_view.dart'; | ||
export 'view/namaz_time_view.dart'; | ||
export 'view/regions_view.dart'; |
53 changes: 53 additions & 0 deletions
53
app/lib/modules/namaz_time/presentation/view/choose_city_view.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,53 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_bloc/flutter_bloc.dart'; | ||
import 'package:my_quran/core/core.dart'; | ||
import 'package:my_quran/modules/modules.dart'; | ||
|
||
class CityView extends StatelessWidget { | ||
const CityView({required this.regionId, super.key}); | ||
|
||
final int regionId; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: const Text('City'), | ||
), | ||
body: BlocProvider( | ||
create: (context) => context.read<NamazTimeCubit>()..getRegions(regionId), | ||
child: BlocBuilder<NamazTimeCubit, NamazTimeState>( | ||
builder: (context, state) { | ||
if (state.status == FetchStatus.loading) { | ||
return const Center(child: CircularProgressIndicator()); | ||
} else if (state.status == FetchStatus.error) { | ||
return const Center(child: Text('Error fetching regions.')); | ||
} else if (state.status == FetchStatus.success) { | ||
final regions = state.regionsEntity?.list ?? []; | ||
|
||
return ListView.builder( | ||
itemCount: regions.length, | ||
itemBuilder: (context, index) { | ||
final region = regions[index]; | ||
return ListTile( | ||
title: Text(region.title ?? ''), | ||
onTap: () { | ||
Navigator.push<ChooseContinentView>( | ||
context, | ||
MaterialPageRoute<ChooseContinentView>( | ||
builder: (context) => NamazTimeView(cityId: region.id), | ||
), | ||
); | ||
// context.read<NamazTimeCubit>().getRegions(region.id); | ||
}, | ||
); | ||
}, | ||
); | ||
} | ||
return const Center(child: Text('No regions found.')); | ||
}, | ||
), | ||
), | ||
); | ||
} | ||
} |
Oops, something went wrong.