diff --git a/lib/src/provider/config_provider.dart b/lib/src/provider/config_provider.dart index 4b068d0..30b5c1c 100644 --- a/lib/src/provider/config_provider.dart +++ b/lib/src/provider/config_provider.dart @@ -28,4 +28,8 @@ class PhotoPickerProvider extends InheritedWidget { static AssetProvider assetProviderOf(BuildContext context) => of(context).assetProvider; + + String getSureText(selectedCount) => options.maxSelected == null + ? provider.getSureText(options, selectedCount) + : provider.getSureTextWithMax(options, selectedCount); } diff --git a/lib/src/provider/i18n_provider.dart b/lib/src/provider/i18n_provider.dart index c9e9038..a708563 100644 --- a/lib/src/provider/i18n_provider.dart +++ b/lib/src/provider/i18n_provider.dart @@ -8,6 +8,8 @@ abstract class I18nProvider { String getSureText(Options options, int currentCount); + String getSureTextWithMax(Options options, int currentCount); + String getPreviewText(Options options, SelectedProvider selectedProvider); String getSelectedOptionsText(Options options); @@ -48,6 +50,11 @@ class CNProvider extends I18nProvider { @override String getSureText(Options options, int currentCount) { + return "确定($currentCount)"; + } + + @override + String getSureTextWithMax(Options options, int currentCount) { return "确定($currentCount/${options.maxSelected})"; } @@ -98,6 +105,11 @@ class ENProvider extends I18nProvider { @override String getSureText(Options options, int currentCount) { + return "Save ($currentCount)"; + } + + @override + String getSureTextWithMax(Options options, int currentCount) { return "Save ($currentCount/${options.maxSelected})"; } @@ -140,6 +152,11 @@ class DEProvider extends I18nProvider { @override String getSureText(Options options, int currentCount) { + return "Speichern ($currentCount)"; + } + + @override + String getSureTextWithMax(Options options, int currentCount) { return "Speichern ($currentCount/${options.maxSelected})"; } diff --git a/lib/src/ui/page/photo_main_page.dart b/lib/src/ui/page/photo_main_page.dart index e51f8f9..c3de142 100644 --- a/lib/src/ui/page/photo_main_page.dart +++ b/lib/src/ui/page/photo_main_page.dart @@ -138,7 +138,7 @@ class _PhotoMainPageState extends State FlatButton( splashColor: Colors.transparent, child: Text( - i18nProvider.getSureText(options, selectedCount), + PhotoPickerProvider.of(context).getSureText(selectedCount), style: selectedCount == 0 ? textStyle.copyWith(color: options.disableColor) : textStyle, diff --git a/lib/src/ui/page/photo_preview_page.dart b/lib/src/ui/page/photo_preview_page.dart index f8bee5d..8283d4f 100644 --- a/lib/src/ui/page/photo_preview_page.dart +++ b/lib/src/ui/page/photo_preview_page.dart @@ -151,7 +151,7 @@ class _PhotoPreviewPageState extends State { splashColor: Colors.transparent, onPressed: selectedList.length == 0 ? null : sure, child: Text( - config.provider.getSureText(options, selectedList.length), + config.getSureText(selectedList.length), style: selectedList.length == 0 ? textStyle.copyWith(color: options.disableColor) : textStyle,