agent-flutter 0.1.12 → 0.1.15

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.12",
3
+ "version": "0.1.15",
4
4
  "description": "Portable Flutter skill/rule pack initializer for multiple AI IDEs.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env bash
2
- set -euo pipefail
2
+ set -Eeuo pipefail
3
+ trap 'echo "Error at line $LINENO: $BASH_COMMAND" >&2' ERR
3
4
 
4
5
  usage() {
5
6
  cat <<'EOF'
@@ -261,18 +262,30 @@ echo "- App package name: $APP_PACKAGE_NAME"
261
262
  echo "- Org: $ORG_ID"
262
263
  echo "- Flutter version: $FLUTTER_VERSION"
263
264
 
265
+ echo "Preparing Flutter toolchain..."
264
266
  ensure_fvm
267
+ echo "- FVM binary: $FVM_BIN"
265
268
 
266
269
  mkdir -p "$PROJECT_DIR"
267
270
  cd "$PROJECT_DIR"
268
271
 
269
- run_fvm use "$FLUTTER_VERSION" --force
272
+ echo "Running: fvm use $FLUTTER_VERSION --force"
273
+ if ! run_fvm use "$FLUTTER_VERSION" --force; then
274
+ echo "Error: fvm use failed. Please verify your Flutter version and FVM setup." >&2
275
+ echo "Try manually: $FVM_BIN use $FLUTTER_VERSION --force" >&2
276
+ exit 1
277
+ fi
270
278
 
271
279
  create_args=(run_fvm flutter create . --org "$ORG_ID" --project-name "$APP_PACKAGE_NAME")
272
280
  if [[ "$FORCE" -eq 1 ]]; then
273
281
  create_args+=(--overwrite)
274
282
  fi
275
- "${create_args[@]}"
283
+
284
+ echo "Running: flutter create"
285
+ if ! "${create_args[@]}"; then
286
+ echo "Error: flutter create failed. Please verify Flutter SDK and project arguments." >&2
287
+ exit 1
288
+ fi
276
289
 
277
290
  mkdir -p .vscode
278
291
  cat >.vscode/settings.json <<'JSON'
@@ -290,6 +303,8 @@ JSON
290
303
  run_fvm flutter pub add get flutter_bloc equatable dio retrofit json_annotation flutter_dotenv flutter_svg intl
291
304
  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
305
  run_fvm flutter pub add carousel_slider:^5.1.1 smooth_page_indicator:^2.0.1
306
+ run_fvm flutter pub add shared_preferences
307
+ run_fvm flutter pub add percent_indicator:^4.2.2
293
308
  run_fvm flutter pub add common_widget --git-url https://github.com/tuan-urani/common_widget --git-ref main
294
309
  run_fvm flutter pub add --dev build_runner retrofit_generator json_serializable
295
310
 
@@ -305,9 +320,11 @@ mkdir -p \
305
320
  lib/src/helper \
306
321
  lib/src/locale \
307
322
  lib/src/ui/base \
323
+ lib/src/ui/base/interactor \
308
324
  lib/src/ui/main \
309
325
  lib/src/ui/home/binding \
310
326
  lib/src/ui/home/bloc \
327
+ lib/src/ui/splash \
311
328
  lib/src/ui/routing \
312
329
  lib/src/ui/widgets \
313
330
  lib/src/utils
@@ -333,7 +350,7 @@ class App extends StatelessWidget {
333
350
  Widget build(BuildContext context) {
334
351
  return GetMaterialApp(
335
352
  debugShowCheckedModeBanner: false,
336
- initialRoute: AppPages.main,
353
+ initialRoute: AppPages.splash,
337
354
  getPages: AppPages.pages,
338
355
  translations: TranslationManager(),
339
356
  locale: TranslationManager.defaultLocale,
@@ -850,20 +867,98 @@ extension DouleWithoutDecimal on double? {
850
867
  }
851
868
  EOF
852
869
 
870
+ cat >lib/src/ui/base/interactor/page_states.dart <<'EOF'
871
+ enum PageState { initial, loading, failure, success }
872
+ EOF
873
+
874
+ cat >lib/src/enums/toast_type.dart <<'EOF'
875
+ import 'package:flutter/material.dart';
876
+
877
+ import '../utils/app_colors.dart';
878
+
879
+ enum ToastType {
880
+ success(Colors.green),
881
+ error(AppColors.error);
882
+
883
+ final Color color;
884
+ const ToastType(this.color);
885
+ }
886
+ EOF
887
+
888
+ cat >lib/src/utils/app_shared.dart <<'EOF'
889
+ import 'dart:async';
890
+
891
+ import 'package:shared_preferences/shared_preferences.dart';
892
+
893
+ class AppShared {
894
+ static const String keyName = 'app';
895
+ static const String keyBox = '${keyName}_shared';
896
+
897
+ static const String _keyFcmToken = '${keyName}_keyFCMToken';
898
+ static const String _keyTokenValue = '${keyName}_keyTokenValue';
899
+ static const String _keyLanguageCode = '${keyName}_keyLanguageCode';
900
+
901
+ final SharedPreferences _prefs;
902
+ final StreamController<String?> _tokenValueController =
903
+ StreamController<String?>.broadcast();
904
+
905
+ AppShared(this._prefs);
906
+
907
+ Future<void> setTokenFcm(String firebaseToken) async {
908
+ await _prefs.setString(_keyFcmToken, firebaseToken);
909
+ }
910
+
911
+ String? getTokenFcm() => _prefs.getString(_keyFcmToken);
912
+
913
+ Future<void> setLanguageCode(String languageCode) async {
914
+ await _prefs.setString(_keyLanguageCode, languageCode);
915
+ }
916
+
917
+ String? getLanguageCode() => _prefs.getString(_keyLanguageCode);
918
+
919
+ Future<void> setTokenValue(String tokenValue) async {
920
+ await _prefs.setString(_keyTokenValue, tokenValue);
921
+ _tokenValueController.add(tokenValue);
922
+ }
923
+
924
+ String? getTokenValue() => _prefs.getString(_keyTokenValue);
925
+
926
+ Stream<String?> watchTokenValue() => _tokenValueController.stream;
927
+
928
+ Future<int> clear() async {
929
+ await _prefs.remove(_keyFcmToken);
930
+ await _prefs.remove(_keyTokenValue);
931
+ await _prefs.remove(_keyLanguageCode);
932
+ _tokenValueController.add(null);
933
+ return 1;
934
+ }
935
+
936
+ void dispose() {
937
+ _tokenValueController.close();
938
+ }
939
+ }
940
+ EOF
941
+
853
942
  cat >lib/src/utils/app_pages.dart <<EOF
854
943
  import 'package:get/get.dart';
855
944
 
856
945
  import 'package:$APP_PACKAGE_NAME/src/ui/home/binding/home_binding.dart';
857
946
  import 'package:$APP_PACKAGE_NAME/src/ui/home/home_page.dart';
858
947
  import 'package:$APP_PACKAGE_NAME/src/ui/main/main_page.dart';
948
+ import 'package:$APP_PACKAGE_NAME/src/ui/splash/splash_page.dart';
859
949
 
860
950
  class AppPages {
861
951
  AppPages._();
862
952
 
953
+ static const String splash = '/splash';
863
954
  static const String main = '/';
864
955
  static const String home = '/home';
865
956
 
866
957
  static final List<GetPage<dynamic>> pages = <GetPage<dynamic>>[
958
+ GetPage(
959
+ name: splash,
960
+ page: () => const SplashPage(),
961
+ ),
867
962
  GetPage(
868
963
  name: main,
869
964
  page: () => const MainPage(),
@@ -878,11 +973,49 @@ class AppPages {
878
973
  }
879
974
  EOF
880
975
 
976
+ cat >lib/src/ui/splash/splash_page.dart <<EOF
977
+ import 'package:flutter/material.dart';
978
+ import 'package:get/get.dart';
979
+
980
+ import 'package:$APP_PACKAGE_NAME/src/utils/app_pages.dart';
981
+
982
+ class SplashPage extends StatefulWidget {
983
+ const SplashPage({super.key});
984
+
985
+ @override
986
+ State<SplashPage> createState() => _SplashPageState();
987
+ }
988
+
989
+ class _SplashPageState extends State<SplashPage> {
990
+ @override
991
+ void initState() {
992
+ super.initState();
993
+ WidgetsBinding.instance.addPostFrameCallback((_) async {
994
+ await Future<void>.delayed(const Duration(seconds: 2));
995
+ if (!mounted) return;
996
+ Get.offNamed(AppPages.main);
997
+ });
998
+ }
999
+
1000
+ @override
1001
+ Widget build(BuildContext context) {
1002
+ return const Scaffold(
1003
+ body: Center(
1004
+ child: CircularProgressIndicator(),
1005
+ ),
1006
+ );
1007
+ }
1008
+ }
1009
+ EOF
1010
+
881
1011
  cat >lib/src/locale/locale_key.dart <<'EOF'
882
1012
  class LocaleKey {
883
1013
  LocaleKey._();
884
1014
 
885
1015
  static const String homeTitle = 'home_title';
1016
+ static const String loginSessionExpires = 'loginSessionExpires';
1017
+ static const String ok = 'ok';
1018
+ static const String cancel = 'cancel';
886
1019
  static const String widgetCancel = 'widgetCancel';
887
1020
  static const String widgetConfirm = 'widgetConfirm';
888
1021
  }
@@ -893,6 +1026,9 @@ import 'locale_key.dart';
893
1026
 
894
1027
  final Map<String, String> enUs = <String, String>{
895
1028
  LocaleKey.homeTitle: 'Home',
1029
+ LocaleKey.loginSessionExpires: 'Login session expires!',
1030
+ LocaleKey.ok: 'OK',
1031
+ LocaleKey.cancel: 'Cancel',
896
1032
  LocaleKey.widgetCancel: 'Cancel',
897
1033
  LocaleKey.widgetConfirm: 'Confirm',
898
1034
  };
@@ -903,6 +1039,9 @@ import 'locale_key.dart';
903
1039
 
904
1040
  final Map<String, String> jaJp = <String, String>{
905
1041
  LocaleKey.homeTitle: 'ホーム',
1042
+ LocaleKey.loginSessionExpires: 'ログインセッションが期限切れです!',
1043
+ LocaleKey.ok: 'OK',
1044
+ LocaleKey.cancel: 'キャンセル',
906
1045
  LocaleKey.widgetCancel: 'キャンセル',
907
1046
  LocaleKey.widgetConfirm: '決定する',
908
1047
  };