@marcos_feitoza/personal-finance-frontend-core-ui 1.0.0

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.
Files changed (139) hide show
  1. package/.circleci/config.yml +23 -0
  2. package/.metadata +45 -0
  3. package/CHANGELOG.md +26 -0
  4. package/README.md +16 -0
  5. package/analysis_options.yaml +28 -0
  6. package/android/app/build.gradle.kts +44 -0
  7. package/android/app/src/debug/AndroidManifest.xml +7 -0
  8. package/android/app/src/main/AndroidManifest.xml +45 -0
  9. package/android/app/src/main/kotlin/com/example/personal_finance_frontend_core_ui/MainActivity.kt +5 -0
  10. package/android/app/src/main/res/drawable/launch_background.xml +12 -0
  11. package/android/app/src/main/res/drawable-v21/launch_background.xml +12 -0
  12. package/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  13. package/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  14. package/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  15. package/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  16. package/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  17. package/android/app/src/main/res/values/styles.xml +18 -0
  18. package/android/app/src/main/res/values-night/styles.xml +18 -0
  19. package/android/app/src/profile/AndroidManifest.xml +7 -0
  20. package/android/build.gradle.kts +21 -0
  21. package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
  22. package/android/gradle.properties +3 -0
  23. package/android/settings.gradle.kts +25 -0
  24. package/ios/Flutter/AppFrameworkInfo.plist +26 -0
  25. package/ios/Flutter/Debug.xcconfig +1 -0
  26. package/ios/Flutter/Release.xcconfig +1 -0
  27. package/ios/Runner/AppDelegate.swift +13 -0
  28. package/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +122 -0
  29. package/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png +0 -0
  30. package/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png +0 -0
  31. package/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png +0 -0
  32. package/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png +0 -0
  33. package/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png +0 -0
  34. package/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png +0 -0
  35. package/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png +0 -0
  36. package/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png +0 -0
  37. package/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png +0 -0
  38. package/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png +0 -0
  39. package/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png +0 -0
  40. package/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png +0 -0
  41. package/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png +0 -0
  42. package/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png +0 -0
  43. package/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png +0 -0
  44. package/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json +23 -0
  45. package/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png +0 -0
  46. package/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png +0 -0
  47. package/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png +0 -0
  48. package/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md +5 -0
  49. package/ios/Runner/Base.lproj/LaunchScreen.storyboard +37 -0
  50. package/ios/Runner/Base.lproj/Main.storyboard +26 -0
  51. package/ios/Runner/Info.plist +49 -0
  52. package/ios/Runner/Runner-Bridging-Header.h +1 -0
  53. package/ios/Runner.xcodeproj/project.pbxproj +619 -0
  54. package/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  55. package/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  56. package/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
  57. package/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +101 -0
  58. package/ios/Runner.xcworkspace/contents.xcworkspacedata +7 -0
  59. package/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  60. package/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
  61. package/ios/RunnerTests/RunnerTests.swift +12 -0
  62. package/lib/main.dart +122 -0
  63. package/lib/personal_finance_frontend_core_ui.dart +1 -0
  64. package/lib/utils/currency_input_formatter.dart +49 -0
  65. package/lib/utils/currency_utils.dart +14 -0
  66. package/lib/utils/theme_notifier.dart +33 -0
  67. package/lib/widgets/app_widgets.dart +405 -0
  68. package/lib/widgets/crypto_trade_form.dart +357 -0
  69. package/lib/widgets/dividend_log_form.dart +151 -0
  70. package/lib/widgets/edit_transaction_dialog.dart +112 -0
  71. package/lib/widgets/expense_form.dart +238 -0
  72. package/lib/widgets/investment_form.dart +223 -0
  73. package/lib/widgets/rrsp_contribution_form.dart +157 -0
  74. package/lib/widgets/salary_form.dart +152 -0
  75. package/lib/widgets/trade_form.dart +374 -0
  76. package/lib/widgets/user_profile_avatar.dart +60 -0
  77. package/linux/CMakeLists.txt +128 -0
  78. package/linux/flutter/CMakeLists.txt +88 -0
  79. package/linux/flutter/generated_plugin_registrant.cc +11 -0
  80. package/linux/flutter/generated_plugin_registrant.h +15 -0
  81. package/linux/flutter/generated_plugins.cmake +23 -0
  82. package/linux/runner/CMakeLists.txt +26 -0
  83. package/linux/runner/main.cc +6 -0
  84. package/linux/runner/my_application.cc +130 -0
  85. package/linux/runner/my_application.h +18 -0
  86. package/macos/Flutter/Flutter-Debug.xcconfig +1 -0
  87. package/macos/Flutter/Flutter-Release.xcconfig +1 -0
  88. package/macos/Flutter/GeneratedPluginRegistrant.swift +10 -0
  89. package/macos/Runner/AppDelegate.swift +13 -0
  90. package/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +68 -0
  91. package/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png +0 -0
  92. package/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png +0 -0
  93. package/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png +0 -0
  94. package/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png +0 -0
  95. package/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png +0 -0
  96. package/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png +0 -0
  97. package/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png +0 -0
  98. package/macos/Runner/Base.lproj/MainMenu.xib +343 -0
  99. package/macos/Runner/Configs/AppInfo.xcconfig +14 -0
  100. package/macos/Runner/Configs/Debug.xcconfig +2 -0
  101. package/macos/Runner/Configs/Release.xcconfig +2 -0
  102. package/macos/Runner/Configs/Warnings.xcconfig +13 -0
  103. package/macos/Runner/DebugProfile.entitlements +12 -0
  104. package/macos/Runner/Info.plist +32 -0
  105. package/macos/Runner/MainFlutterWindow.swift +15 -0
  106. package/macos/Runner/Release.entitlements +8 -0
  107. package/macos/Runner.xcodeproj/project.pbxproj +705 -0
  108. package/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  109. package/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +99 -0
  110. package/macos/Runner.xcworkspace/contents.xcworkspacedata +7 -0
  111. package/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  112. package/macos/RunnerTests/RunnerTests.swift +12 -0
  113. package/package.json +29 -0
  114. package/pubspec.yaml +94 -0
  115. package/test/widget_test.dart +30 -0
  116. package/web/favicon.png +0 -0
  117. package/web/icons/Icon-192.png +0 -0
  118. package/web/icons/Icon-512.png +0 -0
  119. package/web/icons/Icon-maskable-192.png +0 -0
  120. package/web/icons/Icon-maskable-512.png +0 -0
  121. package/web/index.html +38 -0
  122. package/web/manifest.json +35 -0
  123. package/windows/CMakeLists.txt +108 -0
  124. package/windows/flutter/CMakeLists.txt +109 -0
  125. package/windows/flutter/generated_plugin_registrant.cc +11 -0
  126. package/windows/flutter/generated_plugin_registrant.h +15 -0
  127. package/windows/flutter/generated_plugins.cmake +23 -0
  128. package/windows/runner/CMakeLists.txt +40 -0
  129. package/windows/runner/Runner.rc +121 -0
  130. package/windows/runner/flutter_window.cpp +71 -0
  131. package/windows/runner/flutter_window.h +33 -0
  132. package/windows/runner/main.cpp +43 -0
  133. package/windows/runner/resource.h +16 -0
  134. package/windows/runner/resources/app_icon.ico +0 -0
  135. package/windows/runner/runner.exe.manifest +14 -0
  136. package/windows/runner/utils.cpp +65 -0
  137. package/windows/runner/utils.h +19 -0
  138. package/windows/runner/win32_window.cpp +288 -0
  139. package/windows/runner/win32_window.h +102 -0
@@ -0,0 +1,101 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Scheme
3
+ LastUpgradeVersion = "1510"
4
+ version = "1.3">
5
+ <BuildAction
6
+ parallelizeBuildables = "YES"
7
+ buildImplicitDependencies = "YES">
8
+ <BuildActionEntries>
9
+ <BuildActionEntry
10
+ buildForTesting = "YES"
11
+ buildForRunning = "YES"
12
+ buildForProfiling = "YES"
13
+ buildForArchiving = "YES"
14
+ buildForAnalyzing = "YES">
15
+ <BuildableReference
16
+ BuildableIdentifier = "primary"
17
+ BlueprintIdentifier = "97C146ED1CF9000F007C117D"
18
+ BuildableName = "Runner.app"
19
+ BlueprintName = "Runner"
20
+ ReferencedContainer = "container:Runner.xcodeproj">
21
+ </BuildableReference>
22
+ </BuildActionEntry>
23
+ </BuildActionEntries>
24
+ </BuildAction>
25
+ <TestAction
26
+ buildConfiguration = "Debug"
27
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29
+ customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
30
+ shouldUseLaunchSchemeArgsEnv = "YES">
31
+ <MacroExpansion>
32
+ <BuildableReference
33
+ BuildableIdentifier = "primary"
34
+ BlueprintIdentifier = "97C146ED1CF9000F007C117D"
35
+ BuildableName = "Runner.app"
36
+ BlueprintName = "Runner"
37
+ ReferencedContainer = "container:Runner.xcodeproj">
38
+ </BuildableReference>
39
+ </MacroExpansion>
40
+ <Testables>
41
+ <TestableReference
42
+ skipped = "NO"
43
+ parallelizable = "YES">
44
+ <BuildableReference
45
+ BuildableIdentifier = "primary"
46
+ BlueprintIdentifier = "331C8080294A63A400263BE5"
47
+ BuildableName = "RunnerTests.xctest"
48
+ BlueprintName = "RunnerTests"
49
+ ReferencedContainer = "container:Runner.xcodeproj">
50
+ </BuildableReference>
51
+ </TestableReference>
52
+ </Testables>
53
+ </TestAction>
54
+ <LaunchAction
55
+ buildConfiguration = "Debug"
56
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
57
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
58
+ customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
59
+ launchStyle = "0"
60
+ useCustomWorkingDirectory = "NO"
61
+ ignoresPersistentStateOnLaunch = "NO"
62
+ debugDocumentVersioning = "YES"
63
+ debugServiceExtension = "internal"
64
+ enableGPUValidationMode = "1"
65
+ allowLocationSimulation = "YES">
66
+ <BuildableProductRunnable
67
+ runnableDebuggingMode = "0">
68
+ <BuildableReference
69
+ BuildableIdentifier = "primary"
70
+ BlueprintIdentifier = "97C146ED1CF9000F007C117D"
71
+ BuildableName = "Runner.app"
72
+ BlueprintName = "Runner"
73
+ ReferencedContainer = "container:Runner.xcodeproj">
74
+ </BuildableReference>
75
+ </BuildableProductRunnable>
76
+ </LaunchAction>
77
+ <ProfileAction
78
+ buildConfiguration = "Profile"
79
+ shouldUseLaunchSchemeArgsEnv = "YES"
80
+ savedToolIdentifier = ""
81
+ useCustomWorkingDirectory = "NO"
82
+ debugDocumentVersioning = "YES">
83
+ <BuildableProductRunnable
84
+ runnableDebuggingMode = "0">
85
+ <BuildableReference
86
+ BuildableIdentifier = "primary"
87
+ BlueprintIdentifier = "97C146ED1CF9000F007C117D"
88
+ BuildableName = "Runner.app"
89
+ BlueprintName = "Runner"
90
+ ReferencedContainer = "container:Runner.xcodeproj">
91
+ </BuildableReference>
92
+ </BuildableProductRunnable>
93
+ </ProfileAction>
94
+ <AnalyzeAction
95
+ buildConfiguration = "Debug">
96
+ </AnalyzeAction>
97
+ <ArchiveAction
98
+ buildConfiguration = "Release"
99
+ revealArchiveInOrganizer = "YES">
100
+ </ArchiveAction>
101
+ </Scheme>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ <FileRef
5
+ location = "group:Runner.xcodeproj">
6
+ </FileRef>
7
+ </Workspace>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>IDEDidComputeMac32BitWarning</key>
6
+ <true/>
7
+ </dict>
8
+ </plist>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>PreviewsEnabled</key>
6
+ <false/>
7
+ </dict>
8
+ </plist>
@@ -0,0 +1,12 @@
1
+ import Flutter
2
+ import UIKit
3
+ import XCTest
4
+
5
+ class RunnerTests: XCTestCase {
6
+
7
+ func testExample() {
8
+ // If you add code to the Runner application, consider adding tests here.
9
+ // See https://developer.apple.com/documentation/xctest for more information about using XCTest.
10
+ }
11
+
12
+ }
package/lib/main.dart ADDED
@@ -0,0 +1,122 @@
1
+ import 'package:flutter/material.dart';
2
+
3
+ void main() {
4
+ runApp(const MyApp());
5
+ }
6
+
7
+ class MyApp extends StatelessWidget {
8
+ const MyApp({super.key});
9
+
10
+ // This widget is the root of your application.
11
+ @override
12
+ Widget build(BuildContext context) {
13
+ return MaterialApp(
14
+ title: 'Flutter Demo',
15
+ theme: ThemeData(
16
+ // This is the theme of your application.
17
+ //
18
+ // TRY THIS: Try running your application with "flutter run". You'll see
19
+ // the application has a purple toolbar. Then, without quitting the app,
20
+ // try changing the seedColor in the colorScheme below to Colors.green
21
+ // and then invoke "hot reload" (save your changes or press the "hot
22
+ // reload" button in a Flutter-supported IDE, or press "r" if you used
23
+ // the command line to start the app).
24
+ //
25
+ // Notice that the counter didn't reset back to zero; the application
26
+ // state is not lost during the reload. To reset the state, use hot
27
+ // restart instead.
28
+ //
29
+ // This works for code too, not just values: Most code changes can be
30
+ // tested with just a hot reload.
31
+ colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
32
+ ),
33
+ home: const MyHomePage(title: 'Flutter Demo Home Page'),
34
+ );
35
+ }
36
+ }
37
+
38
+ class MyHomePage extends StatefulWidget {
39
+ const MyHomePage({super.key, required this.title});
40
+
41
+ // This widget is the home page of your application. It is stateful, meaning
42
+ // that it has a State object (defined below) that contains fields that affect
43
+ // how it looks.
44
+
45
+ // This class is the configuration for the state. It holds the values (in this
46
+ // case the title) provided by the parent (in this case the App widget) and
47
+ // used by the build method of the State. Fields in a Widget subclass are
48
+ // always marked "final".
49
+
50
+ final String title;
51
+
52
+ @override
53
+ State<MyHomePage> createState() => _MyHomePageState();
54
+ }
55
+
56
+ class _MyHomePageState extends State<MyHomePage> {
57
+ int _counter = 0;
58
+
59
+ void _incrementCounter() {
60
+ setState(() {
61
+ // This call to setState tells the Flutter framework that something has
62
+ // changed in this State, which causes it to rerun the build method below
63
+ // so that the display can reflect the updated values. If we changed
64
+ // _counter without calling setState(), then the build method would not be
65
+ // called again, and so nothing would appear to happen.
66
+ _counter++;
67
+ });
68
+ }
69
+
70
+ @override
71
+ Widget build(BuildContext context) {
72
+ // This method is rerun every time setState is called, for instance as done
73
+ // by the _incrementCounter method above.
74
+ //
75
+ // The Flutter framework has been optimized to make rerunning build methods
76
+ // fast, so that you can just rebuild anything that needs updating rather
77
+ // than having to individually change instances of widgets.
78
+ return Scaffold(
79
+ appBar: AppBar(
80
+ // TRY THIS: Try changing the color here to a specific color (to
81
+ // Colors.amber, perhaps?) and trigger a hot reload to see the AppBar
82
+ // change color while the other colors stay the same.
83
+ backgroundColor: Theme.of(context).colorScheme.inversePrimary,
84
+ // Here we take the value from the MyHomePage object that was created by
85
+ // the App.build method, and use it to set our appbar title.
86
+ title: Text(widget.title),
87
+ ),
88
+ body: Center(
89
+ // Center is a layout widget. It takes a single child and positions it
90
+ // in the middle of the parent.
91
+ child: Column(
92
+ // Column is also a layout widget. It takes a list of children and
93
+ // arranges them vertically. By default, it sizes itself to fit its
94
+ // children horizontally, and tries to be as tall as its parent.
95
+ //
96
+ // Column has various properties to control how it sizes itself and
97
+ // how it positions its children. Here we use mainAxisAlignment to
98
+ // center the children vertically; the main axis here is the vertical
99
+ // axis because Columns are vertical (the cross axis would be
100
+ // horizontal).
101
+ //
102
+ // TRY THIS: Invoke "debug painting" (choose the "Toggle Debug Paint"
103
+ // action in the IDE, or press "p" in the console), to see the
104
+ // wireframe for each widget.
105
+ mainAxisAlignment: MainAxisAlignment.center,
106
+ children: <Widget>[
107
+ const Text('You have pushed the button this many times:'),
108
+ Text(
109
+ '$_counter',
110
+ style: Theme.of(context).textTheme.headlineMedium,
111
+ ),
112
+ ],
113
+ ),
114
+ ),
115
+ floatingActionButton: FloatingActionButton(
116
+ onPressed: _incrementCounter,
117
+ tooltip: 'Increment',
118
+ child: const Icon(Icons.add),
119
+ ), // This trailing comma makes auto-formatting nicer for build methods.
120
+ );
121
+ }
122
+ }
@@ -0,0 +1 @@
1
+ export 'widgets/app_widgets.dart';
@@ -0,0 +1,49 @@
1
+ import 'package:flutter/services.dart';
2
+ import 'package:intl/intl.dart';
3
+
4
+ class CurrencyInputFormatter extends TextInputFormatter {
5
+ // Formatter for the text field, without a currency symbol.
6
+ final NumberFormat _formatter = NumberFormat.currency(
7
+ locale: 'en_US',
8
+ symbol: '', // No symbol in the text field's value.
9
+ decimalDigits: 2,
10
+ );
11
+
12
+ /// Takes a formatted currency string (e.g., "1,234.56") and returns a double.
13
+ static double unformat(String text) {
14
+ if (text.isEmpty) {
15
+ return 0.0;
16
+ }
17
+ // Remove thousands separators (commas) and parse.
18
+ // This assumes '.' is the decimal separator, which is true for 'en_US'.
19
+ String unformatted = text.replaceAll(',', '');
20
+ double? parsedValue = double.tryParse(unformatted);
21
+ return parsedValue ?? 0.0;
22
+ }
23
+
24
+ @override
25
+ TextEditingValue formatEditUpdate(
26
+ TextEditingValue oldValue, TextEditingValue newValue) {
27
+ // Get only the digits from the new input.
28
+ String digitsOnly = newValue.text.replaceAll(RegExp(r'[\D]'), '');
29
+
30
+ if (digitsOnly.isEmpty) {
31
+ return const TextEditingValue(
32
+ text: '0.00',
33
+ selection: TextSelection.collapsed(offset: 4), // cursor at the end
34
+ );
35
+ }
36
+
37
+ // Convert the digits into a numeric value (representing cents).
38
+ double value = double.parse(digitsOnly) / 100.0;
39
+
40
+ // Format the numeric value into a currency string.
41
+ String newText = _formatter.format(value).trim();
42
+
43
+ // Return the new value and position the cursor at the end.
44
+ return TextEditingValue(
45
+ text: newText,
46
+ selection: TextSelection.collapsed(offset: newText.length),
47
+ );
48
+ }
49
+ }
@@ -0,0 +1,14 @@
1
+ import 'package:intl/intl.dart';
2
+
3
+ class CurrencyUtils {
4
+ static const String currencySymbol = r'$';
5
+
6
+ static String format(double value) {
7
+ final format = NumberFormat.currency(
8
+ locale: 'en_US',
9
+ symbol: currencySymbol,
10
+ decimalDigits: 2,
11
+ );
12
+ return format.format(value);
13
+ }
14
+ }
@@ -0,0 +1,33 @@
1
+ import 'package:flutter/material.dart';
2
+ import 'package:shared_preferences/shared_preferences.dart';
3
+
4
+ class ThemeNotifier extends ChangeNotifier {
5
+ ThemeMode _themeMode = ThemeMode.system;
6
+
7
+ ThemeMode get themeMode => _themeMode;
8
+
9
+ ThemeNotifier() {
10
+ _loadThemeMode();
11
+ }
12
+
13
+ void _loadThemeMode() async {
14
+ SharedPreferences prefs = await SharedPreferences.getInstance();
15
+ String? themeModeString = prefs.getString('themeMode');
16
+ if (themeModeString == 'light') {
17
+ _themeMode = ThemeMode.light;
18
+ } else if (themeModeString == 'dark') {
19
+ _themeMode = ThemeMode.dark;
20
+ } else {
21
+ _themeMode = ThemeMode.system;
22
+ }
23
+ notifyListeners();
24
+ }
25
+
26
+ void setThemeMode(ThemeMode mode) async {
27
+ if (_themeMode == mode) return;
28
+ _themeMode = mode;
29
+ SharedPreferences prefs = await SharedPreferences.getInstance();
30
+ await prefs.setString('themeMode', mode.toString().split('.').last);
31
+ notifyListeners();
32
+ }
33
+ }