-
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.
fix: missing build number ds-12 (#13)
* feat(lib-domain): add location data entity ds-12 * fix(lib-interfaces): fix presist FloatingActionButton on post story page ds-12 * refactor(lib-interfaces): refactor some widgets ds-12 * fix(github): add missing build number on cd workflow ds-12
- Loading branch information
Showing
17 changed files
with
334 additions
and
191 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
export "entities/app_exception_entity.dart"; | ||
export "entities/location_data_entity.dart"; | ||
export "entities/story_entity.dart"; | ||
export "entities/user_entity.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,42 @@ | ||
import "package:freezed_annotation/freezed_annotation.dart"; | ||
|
||
part "location_data_entity.freezed.dart"; | ||
|
||
@Freezed(copyWith: true) | ||
class LocationData with _$LocationData { | ||
const factory LocationData({ | ||
/// Stands for latitude. | ||
required double lat, | ||
|
||
/// Stands for longitude. | ||
required double lon, | ||
LocationPlaceData? placeData, | ||
}) = _LocationData; | ||
|
||
const LocationData._(); | ||
|
||
/// [lat], [lon] formatted as "lat, lon". | ||
String get latLon => "$lat, $lon"; | ||
|
||
/// Get address from [placeData]. | ||
/// | ||
/// return [latLon] if address not found. | ||
String get address => placeData?.address ?? latLon; | ||
|
||
/// Get display name from [placeData]. | ||
/// | ||
/// return [address] if display name not found. | ||
String get displayName => placeData?.displayName ?? address; | ||
} | ||
|
||
/// [g-maps-places-api]: https://developers.google.com/maps/documentation/places/web-service | ||
/// | ||
/// [Google Maps Places API data][g-maps-places-api]. | ||
@Freezed(copyWith: true) | ||
class LocationPlaceData with _$LocationPlaceData { | ||
const factory LocationPlaceData({ | ||
required String id, | ||
String? address, | ||
String? displayName, | ||
}) = _LocationPlaceData; | ||
} |
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,8 +1,10 @@ | ||
export "widgets/app_about_list_tile.dart"; | ||
export "widgets/common_network_image.dart"; | ||
export "widgets/custom_camera.dart"; | ||
export "widgets/email_text_field.dart"; | ||
export "widgets/image_from_x_file.dart"; | ||
export "widgets/list_tile/app_about_list_tile.dart"; | ||
export "widgets/list_tile/locale_list_tile.dart"; | ||
export "widgets/list_tile/theme_list_tile.dart"; | ||
export "widgets/media/common_network_image.dart"; | ||
export "widgets/media/custom_camera.dart"; | ||
export "widgets/media/image_from_x_file.dart"; | ||
export "widgets/password_text_field.dart"; | ||
export "widgets/sized_error_widget.dart"; | ||
export "widgets/story_card.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
47 changes: 47 additions & 0 deletions
47
lib/interfaces/libs/widgets/list_tile/locale_list_tile.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,47 @@ | ||
import "package:flutter/material.dart"; | ||
import "package:provider/provider.dart"; | ||
|
||
import "package:dicoding_story_fl/interfaces/libs/l10n.dart"; | ||
import "package:dicoding_story_fl/interfaces/libs/providers.dart"; | ||
|
||
class LocaleListTile extends StatelessWidget { | ||
const LocaleListTile({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final appL10n = AppL10n.of(context)!; | ||
|
||
return ListTile( | ||
leading: const Icon(Icons.language_outlined), | ||
title: Text(appL10n.language), | ||
trailing: Builder(builder: (context) { | ||
final localeProvider = context.watch<LocaleProvider>(); | ||
|
||
String localeString(String localeString) { | ||
return switch (localeString) { | ||
"en" => "English", | ||
"id" => "Bahasa Indonesia", | ||
_ => appL10n.flThemeMode(ThemeMode.system.name), | ||
}; | ||
} | ||
|
||
return DropdownButton<Locale?>( | ||
value: localeProvider.value, | ||
onChanged: (value) => localeProvider.value = value, | ||
items: [ | ||
DropdownMenuItem( | ||
value: null, | ||
child: Text(localeString("system")), | ||
), | ||
...AppL10n.supportedLocales.map((e) { | ||
return DropdownMenuItem( | ||
value: e, | ||
child: Text(localeString("$e")), | ||
); | ||
}) | ||
], | ||
); | ||
}), | ||
); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
lib/interfaces/libs/widgets/list_tile/theme_list_tile.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,47 @@ | ||
import "package:flutter/material.dart"; | ||
import "package:provider/provider.dart"; | ||
|
||
import "package:dicoding_story_fl/interfaces/libs/l10n.dart"; | ||
import "package:dicoding_story_fl/interfaces/libs/providers.dart"; | ||
|
||
class ThemeListTile extends StatelessWidget { | ||
const ThemeListTile({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final appL10n = AppL10n.of(context)!; | ||
|
||
return ListTile( | ||
leading: const Icon(Icons.color_lens_outlined), | ||
title: Text(appL10n.appTheme), | ||
trailing: Builder(builder: (context) { | ||
final themeModeProvider = context.watch<ThemeModeProvider>(); | ||
|
||
final icons = ThemeMode.values.map((e) { | ||
return switch (e) { | ||
ThemeMode.system => Icons.settings_outlined, | ||
ThemeMode.light => Icons.light_mode_outlined, | ||
ThemeMode.dark => Icons.dark_mode_outlined, | ||
}; | ||
}).toList(); | ||
|
||
return DropdownButton<ThemeMode>( | ||
value: themeModeProvider.value, | ||
items: ThemeMode.values.map((e) { | ||
return DropdownMenuItem<ThemeMode>( | ||
value: e, | ||
child: Row( | ||
children: [ | ||
Icon(icons[e.index]), | ||
const SizedBox(width: 8.0), | ||
Text(appL10n.flThemeMode(e.name)), | ||
], | ||
), | ||
); | ||
}).toList(), | ||
onChanged: (value) => themeModeProvider.value = value!, | ||
); | ||
}), | ||
); | ||
} | ||
} |
File renamed without changes.
Oops, something went wrong.