agent-flutter 0.1.11 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-flutter",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "description": "Portable Flutter skill/rule pack initializer for multiple AI IDEs.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -290,6 +290,7 @@ JSON
290
290
  run_fvm flutter pub add get flutter_bloc equatable dio retrofit json_annotation flutter_dotenv flutter_svg intl
291
291
  run_fvm flutter pub add flutter_keyboard_visibility:^6.0.0 cached_network_image:^3.3.1 flutter_inappwebview:^6.1.5 pin_code_fields:^8.0.1 gif:^2.3.0
292
292
  run_fvm flutter pub add carousel_slider:^5.1.1 smooth_page_indicator:^2.0.1
293
+ run_fvm flutter pub add shared_preferences
293
294
  run_fvm flutter pub add common_widget --git-url https://github.com/tuan-urani/common_widget --git-ref main
294
295
  run_fvm flutter pub add --dev build_runner retrofit_generator json_serializable
295
296
 
@@ -305,9 +306,11 @@ mkdir -p \
305
306
  lib/src/helper \
306
307
  lib/src/locale \
307
308
  lib/src/ui/base \
309
+ lib/src/ui/base/interactor \
308
310
  lib/src/ui/main \
309
311
  lib/src/ui/home/binding \
310
312
  lib/src/ui/home/bloc \
313
+ lib/src/ui/splash \
311
314
  lib/src/ui/routing \
312
315
  lib/src/ui/widgets \
313
316
  lib/src/utils
@@ -333,7 +336,7 @@ class App extends StatelessWidget {
333
336
  Widget build(BuildContext context) {
334
337
  return GetMaterialApp(
335
338
  debugShowCheckedModeBanner: false,
336
- initialRoute: AppPages.main,
339
+ initialRoute: AppPages.splash,
337
340
  getPages: AppPages.pages,
338
341
  translations: TranslationManager(),
339
342
  locale: TranslationManager.defaultLocale,
@@ -713,6 +716,8 @@ class AppAssets {
713
716
  'assets/images/icons/radio_check.svg';
714
717
  static const String iconsRadioUncheckSvg =
715
718
  'assets/images/icons/radio_uncheck.svg';
719
+ static const String iconsHideEyeSvg = 'assets/images/icons/hide_eye.svg';
720
+ static const String iconsShowEyeSvg = 'assets/images/icons/show_eye.svg';
716
721
  }
717
722
  EOF
718
723
 
@@ -848,20 +853,84 @@ extension DouleWithoutDecimal on double? {
848
853
  }
849
854
  EOF
850
855
 
856
+ cat >lib/src/ui/base/interactor/page_states.dart <<'EOF'
857
+ enum PageState { initial, loading, failure, success }
858
+ EOF
859
+
860
+ cat >lib/src/utils/app_shared.dart <<'EOF'
861
+ import 'dart:async';
862
+
863
+ import 'package:shared_preferences/shared_preferences.dart';
864
+
865
+ class AppShared {
866
+ static const String keyName = 'app';
867
+ static const String keyBox = '${keyName}_shared';
868
+
869
+ static const String _keyFcmToken = '${keyName}_keyFCMToken';
870
+ static const String _keyTokenValue = '${keyName}_keyTokenValue';
871
+ static const String _keyLanguageCode = '${keyName}_keyLanguageCode';
872
+
873
+ final SharedPreferences _prefs;
874
+ final StreamController<String?> _tokenValueController =
875
+ StreamController<String?>.broadcast();
876
+
877
+ AppShared(this._prefs);
878
+
879
+ Future<void> setTokenFcm(String firebaseToken) async {
880
+ await _prefs.setString(_keyFcmToken, firebaseToken);
881
+ }
882
+
883
+ String? getTokenFcm() => _prefs.getString(_keyFcmToken);
884
+
885
+ Future<void> setLanguageCode(String languageCode) async {
886
+ await _prefs.setString(_keyLanguageCode, languageCode);
887
+ }
888
+
889
+ String? getLanguageCode() => _prefs.getString(_keyLanguageCode);
890
+
891
+ Future<void> setTokenValue(String tokenValue) async {
892
+ await _prefs.setString(_keyTokenValue, tokenValue);
893
+ _tokenValueController.add(tokenValue);
894
+ }
895
+
896
+ String? getTokenValue() => _prefs.getString(_keyTokenValue);
897
+
898
+ Stream<String?> watchTokenValue() => _tokenValueController.stream;
899
+
900
+ Future<int> clear() async {
901
+ await _prefs.remove(_keyFcmToken);
902
+ await _prefs.remove(_keyTokenValue);
903
+ await _prefs.remove(_keyLanguageCode);
904
+ _tokenValueController.add(null);
905
+ return 1;
906
+ }
907
+
908
+ void dispose() {
909
+ _tokenValueController.close();
910
+ }
911
+ }
912
+ EOF
913
+
851
914
  cat >lib/src/utils/app_pages.dart <<EOF
852
915
  import 'package:get/get.dart';
853
916
 
854
917
  import 'package:$APP_PACKAGE_NAME/src/ui/home/binding/home_binding.dart';
855
918
  import 'package:$APP_PACKAGE_NAME/src/ui/home/home_page.dart';
856
919
  import 'package:$APP_PACKAGE_NAME/src/ui/main/main_page.dart';
920
+ import 'package:$APP_PACKAGE_NAME/src/ui/splash/splash_page.dart';
857
921
 
858
922
  class AppPages {
859
923
  AppPages._();
860
924
 
925
+ static const String splash = '/splash';
861
926
  static const String main = '/';
862
927
  static const String home = '/home';
863
928
 
864
929
  static final List<GetPage<dynamic>> pages = <GetPage<dynamic>>[
930
+ GetPage(
931
+ name: splash,
932
+ page: () => const SplashPage(),
933
+ ),
865
934
  GetPage(
866
935
  name: main,
867
936
  page: () => const MainPage(),
@@ -876,11 +945,47 @@ class AppPages {
876
945
  }
877
946
  EOF
878
947
 
948
+ cat >lib/src/ui/splash/splash_page.dart <<EOF
949
+ import 'package:flutter/material.dart';
950
+ import 'package:get/get.dart';
951
+
952
+ import 'package:$APP_PACKAGE_NAME/src/utils/app_pages.dart';
953
+
954
+ class SplashPage extends StatefulWidget {
955
+ const SplashPage({super.key});
956
+
957
+ @override
958
+ State<SplashPage> createState() => _SplashPageState();
959
+ }
960
+
961
+ class _SplashPageState extends State<SplashPage> {
962
+ @override
963
+ void initState() {
964
+ super.initState();
965
+ WidgetsBinding.instance.addPostFrameCallback((_) async {
966
+ await Future<void>.delayed(const Duration(seconds: 2));
967
+ if (!mounted) return;
968
+ Get.offNamed(AppPages.main);
969
+ });
970
+ }
971
+
972
+ @override
973
+ Widget build(BuildContext context) {
974
+ return const Scaffold(
975
+ body: Center(
976
+ child: CircularProgressIndicator(),
977
+ ),
978
+ );
979
+ }
980
+ }
981
+ EOF
982
+
879
983
  cat >lib/src/locale/locale_key.dart <<'EOF'
880
984
  class LocaleKey {
881
985
  LocaleKey._();
882
986
 
883
987
  static const String homeTitle = 'home_title';
988
+ static const String loginSessionExpires = 'loginSessionExpires';
884
989
  static const String widgetCancel = 'widgetCancel';
885
990
  static const String widgetConfirm = 'widgetConfirm';
886
991
  }
@@ -891,6 +996,7 @@ import 'locale_key.dart';
891
996
 
892
997
  final Map<String, String> enUs = <String, String>{
893
998
  LocaleKey.homeTitle: 'Home',
999
+ LocaleKey.loginSessionExpires: 'Login session expires!',
894
1000
  LocaleKey.widgetCancel: 'Cancel',
895
1001
  LocaleKey.widgetConfirm: 'Confirm',
896
1002
  };
@@ -901,6 +1007,7 @@ import 'locale_key.dart';
901
1007
 
902
1008
  final Map<String, String> jaJp = <String, String>{
903
1009
  LocaleKey.homeTitle: 'ホーム',
1010
+ LocaleKey.loginSessionExpires: 'ログインセッションが期限切れです!',
904
1011
  LocaleKey.widgetCancel: 'キャンセル',
905
1012
  LocaleKey.widgetConfirm: '決定する',
906
1013
  };