├── git ├── linux ├── .gitignore ├── main.cc ├── flutter │ ├── generated_plugin_registrant.h │ ├── generated_plugin_registrant.cc │ ├── generated_plugins.cmake │ └── CMakeLists.txt ├── my_application.h ├── my_application.cc └── CMakeLists.txt ├── ios ├── Flutter │ ├── Debug.xcconfig │ ├── Release.xcconfig │ └── AppFrameworkInfo.plist ├── Runner │ ├── Runner-Bridging-Header.h │ ├── Assets.xcassets │ │ ├── LaunchImage.imageset │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ ├── README.md │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ ├── Icon-App-20x20@1x.png │ │ │ ├── Icon-App-20x20@2x.png │ │ │ ├── Icon-App-20x20@3x.png │ │ │ ├── Icon-App-29x29@1x.png │ │ │ ├── Icon-App-29x29@2x.png │ │ │ ├── Icon-App-29x29@3x.png │ │ │ ├── Icon-App-40x40@1x.png │ │ │ ├── Icon-App-40x40@2x.png │ │ │ ├── Icon-App-40x40@3x.png │ │ │ ├── Icon-App-50x50@1x.png │ │ │ ├── Icon-App-50x50@2x.png │ │ │ ├── Icon-App-57x57@1x.png │ │ │ ├── Icon-App-57x57@2x.png │ │ │ ├── Icon-App-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-72x72@1x.png │ │ │ ├── Icon-App-72x72@2x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ └── Contents.json │ ├── AppDelegate.swift │ ├── Base.lproj │ │ ├── Main.storyboard │ │ └── LaunchScreen.storyboard │ └── Info.plist ├── Runner.xcodeproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── WorkspaceSettings.xcsettings │ │ └── IDEWorkspaceChecks.plist └── .gitignore ├── macos ├── Flutter │ ├── Flutter-Debug.xcconfig │ ├── Flutter-Release.xcconfig │ └── GeneratedPluginRegistrant.swift ├── Runner │ ├── Configs │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ ├── Warnings.xcconfig │ │ └── AppInfo.xcconfig │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ ├── app_icon_16.png │ │ │ ├── app_icon_32.png │ │ │ ├── app_icon_64.png │ │ │ ├── app_icon_1024.png │ │ │ ├── app_icon_128.png │ │ │ ├── app_icon_256.png │ │ │ ├── app_icon_512.png │ │ │ └── Contents.json │ ├── AppDelegate.swift │ ├── Release.entitlements │ ├── DebugProfile.entitlements │ ├── MainFlutterWindow.swift │ └── Info.plist ├── .gitignore ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── Runner.xcodeproj │ ├── project.xcworkspace │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist │ └── xcshareddata │ └── xcschemes │ └── Runner.xcscheme ├── sign.png ├── .vscode ├── settings.json └── launch.json ├── Cambria.ttf ├── flutter_01.png ├── flutter_02.png ├── icons └── icons.png ├── web ├── favicon.png ├── icons │ ├── Icon-192.png │ ├── Icon-512.png │ ├── Icon-maskable-192.png │ └── Icon-maskable-512.png ├── manifest.json └── index.html ├── fonts ├── Cambria.ttf └── cambriab.ttf ├── android ├── gradle.properties ├── app │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ ├── drawable │ │ │ │ │ ├── splash.png │ │ │ │ │ └── launch_background.xml │ │ │ │ ├── drawable-v21 │ │ │ │ │ ├── splash.png │ │ │ │ │ └── launch_background.xml │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ ├── splash.png │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ ├── splash.png │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ ├── splash.png │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ ├── splash.png │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ ├── splash.png │ │ │ │ │ └── ic_launcher.png │ │ │ │ ├── xml │ │ │ │ │ └── provider_paths.xml │ │ │ │ ├── values │ │ │ │ │ └── styles.xml │ │ │ │ └── values-night │ │ │ │ │ └── styles.xml │ │ │ ├── kotlin │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── gsheet │ │ │ │ │ └── MainActivity.kt │ │ │ └── AndroidManifest.xml │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ └── profile │ │ │ └── AndroidManifest.xml │ ├── google-services.json │ └── build.gradle ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── .gitignore ├── settings.gradle └── build.gradle ├── asset └── images │ ├── icons.png │ └── sign.png ├── windows ├── runner │ ├── resources │ │ └── app_icon.ico │ ├── resource.h │ ├── utils.h │ ├── runner.exe.manifest │ ├── flutter_window.h │ ├── main.cpp │ ├── CMakeLists.txt │ ├── utils.cpp │ ├── flutter_window.cpp │ ├── Runner.rc │ ├── win32_window.h │ └── win32_window.cpp ├── .gitignore ├── flutter │ ├── generated_plugin_registrant.cc │ ├── generated_plugin_registrant.h │ ├── generated_plugins.cmake │ └── CMakeLists.txt └── CMakeLists.txt ├── lib ├── models │ ├── invoice_item.dart │ ├── customer.dart │ ├── product.dart │ └── invoice.dart ├── main.dart ├── screens │ ├── home │ │ └── home_screen.dart │ ├── drawer.dart │ ├── invoice_form │ │ └── invoice_form.dart │ ├── past.dart │ └── manageProducts.dart ├── services │ └── firebase_service.dart └── providers │ └── invoice_provider.dart ├── README_BASE_401.md ├── README_LOCAL_401.md ├── .gitignore ├── test ├── widget_test.dart ├── screens │ └── invoice_form_test.dart └── providers │ └── invoice_provider_test.dart ├── analysis_options.yaml ├── .metadata ├── README_REMOTE_401.md ├── README_BACKUP_401.md ├── README.md ├── pubspec.yaml └── pubspec.lock /git: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /linux/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral 2 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /macos/Flutter/Flutter-Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "ephemeral/Flutter-Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /sign.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/sign.png -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "java.configuration.updateBuildConfiguration": "interactive" 3 | } -------------------------------------------------------------------------------- /Cambria.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/Cambria.ttf -------------------------------------------------------------------------------- /flutter_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/flutter_01.png -------------------------------------------------------------------------------- /flutter_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/flutter_02.png -------------------------------------------------------------------------------- /icons/icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/icons/icons.png -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/web/favicon.png -------------------------------------------------------------------------------- /fonts/Cambria.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/fonts/Cambria.ttf -------------------------------------------------------------------------------- /fonts/cambriab.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/fonts/cambriab.ttf -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /asset/images/icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/asset/images/icons.png -------------------------------------------------------------------------------- /asset/images/sign.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/asset/images/sign.png -------------------------------------------------------------------------------- /macos/Runner/Configs/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Debug.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/web/icons/Icon-512.png -------------------------------------------------------------------------------- /macos/Runner/Configs/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "../../Flutter/Flutter-Release.xcconfig" 2 | #include "Warnings.xcconfig" 3 | -------------------------------------------------------------------------------- /macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/android/app/src/main/res/drawable/splash.png -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/android/app/src/main/res/drawable-v21/splash.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/android/app/src/main/res/mipmap-hdpi/splash.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/android/app/src/main/res/mipmap-mdpi/splash.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/android/app/src/main/res/mipmap-xhdpi/splash.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/android/app/src/main/res/mipmap-xxhdpi/splash.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/android/app/src/main/res/mipmap-xxxhdpi/splash.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /linux/main.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | int main(int argc, char** argv) { 4 | g_autoptr(MyApplication) app = my_application_new(); 5 | return g_application_run(G_APPLICATION(app), argc, argv); 6 | } 7 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/gsheet/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.myproject.invoicegenertor 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tanvir-robin/Invoice-Generator-Mobile-App/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /android/app/src/main/res/xml/provider_paths.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip 6 | -------------------------------------------------------------------------------- /macos/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | @NSApplicationMain 5 | class AppDelegate: FlutterAppDelegate { 6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 7 | return true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /macos/Runner/Release.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /lib/models/invoice_item.dart: -------------------------------------------------------------------------------- 1 | import 'package:gsheet/models/product.dart'; 2 | 3 | class InvoiceItem { 4 | final Product product; 5 | final int quantity; 6 | final int bonus; 7 | 8 | InvoiceItem({ 9 | required this.product, 10 | required this.quantity, 11 | this.bonus = 0, 12 | }); 13 | 14 | double get totalPrice => product.unitPrice * quantity; 15 | } 16 | -------------------------------------------------------------------------------- /windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | 11 | void RegisterPlugins(flutter::PluginRegistry* registry) { 12 | PrintingPluginRegisterWithRegistrar( 13 | registry->GetRegistrarForPlugin("PrintingPlugin")); 14 | } 15 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /lib/models/customer.dart: -------------------------------------------------------------------------------- 1 | class Customer { 2 | final String name; 3 | final String address; 4 | 5 | Customer({required this.name, required this.address}); 6 | 7 | factory Customer.fromMap(Map map) { 8 | return Customer( 9 | name: map['Party Name'], 10 | address: map['Address'], 11 | ); 12 | } 13 | 14 | @override 15 | String toString() => '$name-$address'; 16 | } 17 | -------------------------------------------------------------------------------- /macos/Runner/DebugProfile.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.cs.allow-jit 8 | 9 | com.apple.security.network.server 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /linux/my_application.h: -------------------------------------------------------------------------------- 1 | #ifndef FLUTTER_MY_APPLICATION_H_ 2 | #define FLUTTER_MY_APPLICATION_H_ 3 | 4 | #include 5 | 6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, 7 | GtkApplication) 8 | 9 | /** 10 | * my_application_new: 11 | * 12 | * Creates a new Flutter-based application. 13 | * 14 | * Returns: a new #MyApplication. 15 | */ 16 | MyApplication* my_application_new(); 17 | 18 | #endif // FLUTTER_MY_APPLICATION_H_ 19 | -------------------------------------------------------------------------------- /macos/Runner/MainFlutterWindow.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | import FlutterMacOS 3 | 4 | class MainFlutterWindow: NSWindow { 5 | override func awakeFromNib() { 6 | let flutterViewController = FlutterViewController.init() 7 | let windowFrame = self.frame 8 | self.contentViewController = flutterViewController 9 | self.setFrame(windowFrame, display: true) 10 | 11 | RegisterGeneratedPlugins(registry: flutterViewController) 12 | 13 | super.awakeFromNib() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | 11 | void fl_register_plugins(FlPluginRegistry* registry) { 12 | g_autoptr(FlPluginRegistrar) printing_registrar = 13 | fl_plugin_registry_get_registrar_for_plugin(registry, "PrintingPlugin"); 14 | printing_plugin_register_with_registrar(printing_registrar); 15 | } 16 | -------------------------------------------------------------------------------- /windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /lib/models/product.dart: -------------------------------------------------------------------------------- 1 | class Product { 2 | final String name; 3 | final String type; 4 | final String packSize; 5 | final double unitPrice; 6 | 7 | Product({ 8 | required this.name, 9 | required this.type, 10 | required this.packSize, 11 | required this.unitPrice, 12 | }); 13 | 14 | factory Product.fromMap(Map map) { 15 | return Product( 16 | name: map['Product Name'], 17 | type: map['Type'], 18 | packSize: map['Pack size'], 19 | unitPrice: double.parse(map['Unit Price'].toString()), 20 | ); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /README_BASE_401.md: -------------------------------------------------------------------------------- 1 | # gsheet 2 | 3 | A new Flutter project. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) 13 | 14 | For help getting started with Flutter development, view the 15 | [online documentation](https://docs.flutter.dev/), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /README_LOCAL_401.md: -------------------------------------------------------------------------------- 1 | # gsheet 2 | 3 | A new Flutter project. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) 13 | 14 | For help getting started with Flutter development, view the 15 | [online documentation](https://docs.flutter.dev/), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | "# Invoice-Generator-Flutter" 18 | -------------------------------------------------------------------------------- /macos/Runner/Configs/Warnings.xcconfig: -------------------------------------------------------------------------------- 1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings 2 | GCC_WARN_UNDECLARED_SELECTOR = YES 3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES 4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE 5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES 6 | CLANG_WARN_PRAGMA_PACK = YES 7 | CLANG_WARN_STRICT_PROTOTYPES = YES 8 | CLANG_WARN_COMMA = YES 9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES 10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES 11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES 12 | GCC_WARN_SHADOW = YES 13 | CLANG_WARN_UNREACHABLE_CODE = YES 14 | -------------------------------------------------------------------------------- /macos/Runner/Configs/AppInfo.xcconfig: -------------------------------------------------------------------------------- 1 | // Application-level settings for the Runner target. 2 | // 3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the 4 | // future. If not, the values below would default to using the project name when this becomes a 5 | // 'flutter create' template. 6 | 7 | // The application's name. By default this is also the title of the Flutter window. 8 | PRODUCT_NAME = gsheet 9 | 10 | // The application's bundle identifier 11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.gsheet 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2022 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /lib/models/invoice.dart: -------------------------------------------------------------------------------- 1 | import 'package:gsheet/models/customer.dart'; 2 | import 'package:gsheet/models/invoice_item.dart'; 3 | 4 | class Invoice { 5 | final String invoiceNumber; 6 | final Customer customer; 7 | final DateTime date; 8 | final List items; 9 | final String signUrl; 10 | 11 | Invoice({ 12 | required this.invoiceNumber, 13 | required this.customer, 14 | required this.date, 15 | required this.items, 16 | required this.signUrl, 17 | }); 18 | 19 | double get subtotal { 20 | return items.fold(0.0, (sum, item) => sum + item.totalPrice); 21 | } 22 | 23 | double get tax => subtotal * 0.15; 24 | 25 | double get total => subtotal + tax; 26 | } 27 | -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.8.0' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.google.gms:google-services:4.3.15' 10 | classpath 'com.android.tools.build:gradle:7.1.2' 11 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | google() 18 | mavenCentral() 19 | } 20 | } 21 | 22 | rootProject.buildDir = '../build' 23 | subprojects { 24 | project.buildDir = "${rootProject.buildDir}/${project.name}" 25 | } 26 | subprojects { 27 | project.evaluationDependsOn(':app') 28 | } 29 | 30 | task clean(type: Delete) { 31 | delete rootProject.buildDir 32 | } 33 | -------------------------------------------------------------------------------- /linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | printing 7 | ) 8 | 9 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 10 | ) 11 | 12 | set(PLUGIN_BUNDLED_LIBRARIES) 13 | 14 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 19 | endforeach(plugin) 20 | 21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 24 | endforeach(ffi_plugin) 25 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | printing 7 | ) 8 | 9 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 10 | ) 11 | 12 | set(PLUGIN_BUNDLED_LIBRARIES) 13 | 14 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 19 | endforeach(plugin) 20 | 21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 24 | endforeach(ffi_plugin) 25 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 11.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | 8 | { 9 | "name": "gsheet", 10 | "request": "launch", 11 | "type": "dart", 12 | "args": [ 13 | "--no-sound-null-safety" 14 | ] 15 | }, 16 | { 17 | "name": "gsheet (profile mode)", 18 | "request": "launch", 19 | "type": "dart", 20 | "flutterMode": "profile" 21 | }, 22 | { 23 | "name": "gsheet (release mode)", 24 | "request": "launch", 25 | "type": "dart", 26 | "flutterMode": "release" 27 | }, 28 | 29 | ] 30 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | /build/ 34 | 35 | # Symbolication related 36 | app.*.symbols 37 | **/android/key.properties 38 | 39 | # Obfuscation related 40 | app.*.map.json 41 | 42 | # Android Studio will place build artifacts here 43 | /android/app/debug 44 | /android/app/profile 45 | /android/app/release 46 | -------------------------------------------------------------------------------- /macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | import cloud_firestore 9 | import firebase_auth 10 | import firebase_core 11 | import firebase_database 12 | import path_provider_macos 13 | import printing 14 | 15 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 16 | FLTFirebaseFirestorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseFirestorePlugin")) 17 | FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin")) 18 | FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin")) 19 | FLTFirebaseDatabasePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseDatabasePlugin")) 20 | PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) 21 | PrintingPlugin.register(with: registry.registrar(forPlugin: "PrintingPlugin")) 22 | } 23 | -------------------------------------------------------------------------------- /windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:firebase_core/firebase_core.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:gsheet/providers/invoice_provider.dart'; 4 | import 'package:gsheet/screens/home/home_screen.dart'; 5 | import 'package:provider/provider.dart'; 6 | 7 | void main() async { 8 | WidgetsFlutterBinding.ensureInitialized(); 9 | await Firebase.initializeApp(); 10 | runApp( 11 | ChangeNotifierProvider( 12 | create: (context) => InvoiceProvider(), 13 | child: MaterialApp( 14 | title: 'Invoice Generator', 15 | theme: ThemeData( 16 | primarySwatch: Colors.blue, 17 | visualDensity: VisualDensity.adaptivePlatformDensity, 18 | inputDecorationTheme: InputDecorationTheme( 19 | border: OutlineInputBorder( 20 | borderRadius: BorderRadius.circular(8), 21 | ), 22 | ), 23 | ), 24 | home: HomeScreen( 25 | signURL: '', 26 | ), 27 | ), 28 | ), 29 | ); 30 | } 31 | -------------------------------------------------------------------------------- /web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gsheet", 3 | "short_name": "gsheet", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#0175C2", 7 | "theme_color": "#0175C2", 8 | "description": "A new Flutter project.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-192.png", 14 | "sizes": "192x192", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-512.png", 19 | "sizes": "512x512", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility in the flutter_test package. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:gsheet/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(FormWidget()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /macos/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSMinimumSystemVersion 24 | $(MACOSX_DEPLOYMENT_TARGET) 25 | NSHumanReadableCopyright 26 | $(PRODUCT_COPYRIGHT) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /lib/screens/home/home_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:gsheet/providers/invoice_provider.dart'; 3 | import 'package:gsheet/screens/drawer.dart'; 4 | import 'package:gsheet/screens/invoice_form/invoice_form.dart'; 5 | import 'package:provider/provider.dart'; 6 | 7 | class HomeScreen extends StatelessWidget { 8 | final String signURL; 9 | 10 | HomeScreen({required this.signURL}); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | final invoiceProvider = Provider.of(context, listen: false); 15 | return Scaffold( 16 | drawer: AppDrawer(signURL), 17 | appBar: AppBar( 18 | title: const Text('Invoice Generator'), 19 | actions: [ 20 | IconButton( 21 | onPressed: () { 22 | invoiceProvider.shareInvoice(); 23 | }, 24 | icon: const Icon(Icons.share), 25 | ), 26 | IconButton( 27 | onPressed: () { 28 | invoiceProvider.previewInvoice(); 29 | }, 30 | icon: const Icon(Icons.picture_as_pdf), 31 | ), 32 | ], 33 | ), 34 | body: InvoiceForm(), 35 | ); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.CreateAndShow(L"gsheet", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at 17 | # https://dart-lang.github.io/linter/lints/index.html. 18 | # 19 | # Instead of disabling a lint rule for the entire project in the 20 | # section below, it can also be suppressed for a single line of code 21 | # or a specific dart file by using the `// ignore: name_of_lint` and 22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 23 | # producing the lint. 24 | rules: 25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 27 | 28 | # Additional information about this file can be found at 29 | # https://dart.dev/guides/language/analysis-options 30 | -------------------------------------------------------------------------------- /macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "app_icon_16.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "app_icon_32.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "app_icon_32.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "app_icon_64.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "app_icon_128.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "app_icon_256.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "app_icon_256.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "app_icon_512.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "app_icon_512.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "app_icon_1024.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled. 5 | 6 | version: 7 | revision: 135454af32477f815a7525073027a3ff9eff1bfd 8 | channel: stable 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: 135454af32477f815a7525073027a3ff9eff1bfd 17 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd 18 | - platform: android 19 | create_revision: 135454af32477f815a7525073027a3ff9eff1bfd 20 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd 21 | - platform: ios 22 | create_revision: 135454af32477f815a7525073027a3ff9eff1bfd 23 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd 24 | - platform: linux 25 | create_revision: 135454af32477f815a7525073027a3ff9eff1bfd 26 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd 27 | - platform: macos 28 | create_revision: 135454af32477f815a7525073027a3ff9eff1bfd 29 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd 30 | - platform: web 31 | create_revision: 135454af32477f815a7525073027a3ff9eff1bfd 32 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd 33 | - platform: windows 34 | create_revision: 135454af32477f815a7525073027a3ff9eff1bfd 35 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd 36 | 37 | # User provided section 38 | 39 | # List of Local paths (relative to this file) that should be 40 | # ignored by the migrate tool. 41 | # 42 | # Files that are not part of the templates will be ignored by default. 43 | unmanaged_files: 44 | - 'lib/main.dart' 45 | - 'ios/Runner.xcodeproj/project.pbxproj' 46 | -------------------------------------------------------------------------------- /windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | # Define the application target. To change its name, change BINARY_NAME in the 5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer 6 | # work. 7 | # 8 | # Any new source files that you add to the application should be added here. 9 | add_executable(${BINARY_NAME} WIN32 10 | "flutter_window.cpp" 11 | "main.cpp" 12 | "utils.cpp" 13 | "win32_window.cpp" 14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 15 | "Runner.rc" 16 | "runner.exe.manifest" 17 | ) 18 | 19 | # Apply the standard set of build settings. This can be removed for applications 20 | # that need different build settings. 21 | apply_standard_settings(${BINARY_NAME}) 22 | 23 | # Add preprocessor definitions for the build version. 24 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") 25 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") 26 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") 27 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") 28 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") 29 | 30 | # Disable Windows macros that collide with C++ standard library functions. 31 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 32 | 33 | # Add dependency libraries and include directories. Add any application-specific 34 | # dependencies here. 35 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 36 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 37 | 38 | # Run the Flutter tool portions of the build. This must not be removed. 39 | add_dependencies(${BINARY_NAME} flutter_assemble) 40 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 16 | 20 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Gsheet 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | gsheet 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(FLUTTER_BUILD_NAME) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(FLUTTER_BUILD_NUMBER) 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | UIViewControllerBasedStatusBarAppearance 45 | 46 | CADisableMinimumFrameDurationOnPhone 47 | 48 | UIApplicationSupportsIndirectInputEvents 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr); 51 | std::string utf8_string; 52 | if (target_length == 0 || target_length > utf8_string.max_size()) { 53 | return utf8_string; 54 | } 55 | utf8_string.resize(target_length); 56 | int converted_length = ::WideCharToMultiByte( 57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 58 | -1, utf8_string.data(), 59 | target_length, nullptr, nullptr); 60 | if (converted_length == 0) { 61 | return std::string(); 62 | } 63 | return utf8_string; 64 | } 65 | -------------------------------------------------------------------------------- /android/app/google-services.json: -------------------------------------------------------------------------------- 1 | { 2 | "project_info": { 3 | "project_number": "68755469688", 4 | "firebase_url": "https://invoice-maker-283c8-default-rtdb.asia-southeast1.firebasedatabase.app", 5 | "project_id": "invoice-maker-283c8", 6 | "storage_bucket": "invoice-maker-283c8.appspot.com" 7 | }, 8 | "client": [ 9 | { 10 | "client_info": { 11 | "mobilesdk_app_id": "1:68755469688:android:8f509bbbdc3fd61a91448d", 12 | "android_client_info": { 13 | "package_name": "com.myproject.invoicegenertor" 14 | } 15 | }, 16 | "oauth_client": [ 17 | { 18 | "client_id": "68755469688-jl1v7p42mo4ed6utbjds4s75jl92j7bl.apps.googleusercontent.com", 19 | "client_type": 1, 20 | "android_info": { 21 | "package_name": "com.myproject.invoicegenertor", 22 | "certificate_hash": "98a78ae548102179fafc8343f26c45c97e484cb8" 23 | } 24 | }, 25 | { 26 | "client_id": "68755469688-tn6rfpkfr8ltspg59hljc6ptv4bimnk4.apps.googleusercontent.com", 27 | "client_type": 1, 28 | "android_info": { 29 | "package_name": "com.myproject.invoicegenertor", 30 | "certificate_hash": "1c0adfdcc613033e1d1ddf3b884ec865468680b4" 31 | } 32 | }, 33 | { 34 | "client_id": "68755469688-jjqo0ahmvt6rju58u6djo93qsaljcm2m.apps.googleusercontent.com", 35 | "client_type": 3 36 | } 37 | ], 38 | "api_key": [ 39 | { 40 | "current_key": "AIzaSyADxOCvi-ywvjtVJudF226epfofGRIRk7Q" 41 | } 42 | ], 43 | "services": { 44 | "appinvite_service": { 45 | "other_platform_oauth_client": [ 46 | { 47 | "client_id": "68755469688-jjqo0ahmvt6rju58u6djo93qsaljcm2m.apps.googleusercontent.com", 48 | "client_type": 3 49 | } 50 | ] 51 | } 52 | } 53 | } 54 | ], 55 | "configuration_version": "1" 56 | } -------------------------------------------------------------------------------- /windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | return true; 30 | } 31 | 32 | void FlutterWindow::OnDestroy() { 33 | if (flutter_controller_) { 34 | flutter_controller_ = nullptr; 35 | } 36 | 37 | Win32Window::OnDestroy(); 38 | } 39 | 40 | LRESULT 41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 42 | WPARAM const wparam, 43 | LPARAM const lparam) noexcept { 44 | // Give Flutter, including plugins, an opportunity to handle window messages. 45 | if (flutter_controller_) { 46 | std::optional result = 47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 48 | lparam); 49 | if (result) { 50 | return *result; 51 | } 52 | } 53 | 54 | switch (message) { 55 | case WM_FONTCHANGE: 56 | flutter_controller_->engine()->ReloadSystemFonts(); 57 | break; 58 | } 59 | 60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 61 | } 62 | -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | gsheet 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /lib/screens/drawer.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import './manageProducts.dart'; 4 | import './past.dart'; 5 | 6 | class AppDrawer extends StatefulWidget { 7 | const AppDrawer(this.signURL); 8 | final signURL; 9 | @override 10 | State createState() => _AppDrawerState(); 11 | } 12 | 13 | class _AppDrawerState extends State { 14 | @override 15 | Widget build(BuildContext context) { 16 | return Drawer( 17 | child: ListView( 18 | padding: const EdgeInsets.all(0), 19 | children: [ 20 | DrawerHeader( 21 | decoration: BoxDecoration( 22 | color: Colors.green, 23 | ), //BoxDecoration 24 | child: Column( 25 | mainAxisAlignment: MainAxisAlignment.center, 26 | children: [ 27 | Image.asset( 28 | 'asset/images/icons.png', 29 | height: 50, 30 | ), 31 | Text( 32 | "Invoice Generator", 33 | textAlign: TextAlign.center, 34 | style: TextStyle(fontSize: 20), 35 | ), 36 | ], 37 | ), 38 | ), 39 | ListTile( 40 | leading: const Icon( 41 | Icons.history, 42 | ), 43 | title: const Text( 44 | ' Past Invoices ', 45 | style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16), 46 | ), 47 | onTap: () { 48 | Navigator.push( 49 | context, 50 | MaterialPageRoute( 51 | builder: (context) => PastOrders( 52 | signURL: widget.signURL, 53 | )), 54 | ); 55 | }, 56 | ), 57 | ListTile( 58 | leading: const Icon( 59 | Icons.edit_note_outlined, 60 | ), 61 | title: const Text( 62 | ' Manage Products ', 63 | style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16), 64 | ), 65 | onTap: () { 66 | Navigator.push( 67 | context, 68 | MaterialPageRoute(builder: (context) => ManageProducts()), 69 | ); 70 | }, 71 | ), 72 | ], 73 | ), 74 | ); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /test/screens/invoice_form_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | import 'package:gsheet/models/customer.dart'; 4 | import 'package:gsheet/models/product.dart'; 5 | import 'package:gsheet/providers/invoice_provider.dart'; 6 | import 'package:gsheet/screens/invoice_form/invoice_form.dart'; 7 | import 'package:mockito/mockito.dart'; 8 | import 'package:provider/provider.dart'; 9 | 10 | class MockInvoiceProvider extends Mock implements InvoiceProvider {} 11 | 12 | void main() { 13 | late MockInvoiceProvider mockInvoiceProvider; 14 | 15 | setUp(() { 16 | mockInvoiceProvider = MockInvoiceProvider(); 17 | }); 18 | 19 | final products = [ 20 | Product(name: 'Product 1', type: 'Type A', packSize: '10', unitPrice: 100), 21 | ]; 22 | final customers = [ 23 | Customer(name: 'Customer 1', address: 'Address 1'), 24 | ]; 25 | 26 | Widget createWidgetUnderTest() { 27 | return ChangeNotifierProvider.value( 28 | value: mockInvoiceProvider, 29 | child: MaterialApp( 30 | home: Scaffold( 31 | body: InvoiceForm(), 32 | ), 33 | ), 34 | ); 35 | } 36 | 37 | testWidgets('InvoiceForm should render correctly and interact with provider', 38 | (WidgetTester tester) async { 39 | when(mockInvoiceProvider.isLoading).thenReturn(false); 40 | when(mockInvoiceProvider.isBusy).thenReturn(false); 41 | when(mockInvoiceProvider.error).thenReturn(null); 42 | when(mockInvoiceProvider.products).thenReturn(products); 43 | when(mockInvoiceProvider.customers).thenReturn(customers); 44 | when(mockInvoiceProvider.selectedProduct).thenReturn(products.first); 45 | when(mockInvoiceProvider.selectedCustomer).thenReturn(customers.first); 46 | when(mockInvoiceProvider.invoiceItems).thenReturn([]); 47 | 48 | await tester.pumpWidget(createWidgetUnderTest()); 49 | 50 | // Verify that the form fields are rendered 51 | expect(find.text('Customer Name'), findsOneWidget); 52 | expect(find.text('Invoice No.'), findsOneWidget); 53 | expect(find.text('Product Name'), findsOneWidget); 54 | expect(find.text('Quantity'), findsOneWidget); 55 | 56 | // Enter quantity and tap the "Add Item" button 57 | await tester.enterText(find.byType(TextFormField).at(2), '2'); // Quantity 58 | await tester.tap(find.byType(ElevatedButton)); 59 | await tester.pump(); 60 | 61 | // Verify that the addItem method was called on the provider 62 | verify(mockInvoiceProvider.addItem(any, any)); 63 | }); 64 | } 65 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new RuntimeException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'com.google.gms.google-services' 26 | apply plugin: 'kotlin-android' 27 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 28 | def keystoreProperties = new Properties() 29 | def keystorePropertiesFile = rootProject.file('key.properties') 30 | if (keystorePropertiesFile.exists()) { 31 | keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) 32 | } 33 | android { 34 | compileSdkVersion 31 35 | ndkVersion flutter.ndkVersion 36 | 37 | compileOptions { 38 | sourceCompatibility JavaVersion.VERSION_1_8 39 | targetCompatibility JavaVersion.VERSION_1_8 40 | } 41 | 42 | kotlinOptions { 43 | jvmTarget = '1.8' 44 | } 45 | 46 | sourceSets { 47 | main.java.srcDirs += 'src/main/kotlin' 48 | } 49 | 50 | defaultConfig { 51 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 52 | applicationId "com.myproject.invoicegenertor" 53 | // You can update the following values to match your application needs. 54 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. 55 | minSdkVersion 19 56 | targetSdkVersion 31 57 | versionCode flutterVersionCode.toInteger() 58 | versionName flutterVersionName 59 | multiDexEnabled true 60 | } 61 | 62 | signingConfigs { 63 | release { 64 | keyAlias keystoreProperties['keyAlias'] 65 | keyPassword keystoreProperties['keyPassword'] 66 | storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null 67 | storePassword keystoreProperties['storePassword'] 68 | } 69 | } 70 | buildTypes { 71 | release { 72 | signingConfig signingConfigs.release 73 | } 74 | } 75 | 76 | } 77 | 78 | flutter { 79 | source '../..' 80 | } 81 | 82 | dependencies { 83 | implementation platform('com.google.firebase:firebase-bom:31.3.0') 84 | implementation 'com.google.firebase:firebase-analytics-ktx' 85 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 86 | implementation 'com.android.support:multidex:1.0.3' 87 | 88 | } 89 | -------------------------------------------------------------------------------- /linux/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.10) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | 12 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...), 13 | # which isn't available in 3.10. 14 | function(list_prepend LIST_NAME PREFIX) 15 | set(NEW_LIST "") 16 | foreach(element ${${LIST_NAME}}) 17 | list(APPEND NEW_LIST "${PREFIX}${element}") 18 | endforeach(element) 19 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) 20 | endfunction() 21 | 22 | # === Flutter Library === 23 | # System-level dependencies. 24 | find_package(PkgConfig REQUIRED) 25 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 26 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) 27 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) 28 | 29 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") 30 | 31 | # Published to parent scope for install step. 32 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 33 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 34 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 35 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) 36 | 37 | list(APPEND FLUTTER_LIBRARY_HEADERS 38 | "fl_basic_message_channel.h" 39 | "fl_binary_codec.h" 40 | "fl_binary_messenger.h" 41 | "fl_dart_project.h" 42 | "fl_engine.h" 43 | "fl_json_message_codec.h" 44 | "fl_json_method_codec.h" 45 | "fl_message_codec.h" 46 | "fl_method_call.h" 47 | "fl_method_channel.h" 48 | "fl_method_codec.h" 49 | "fl_method_response.h" 50 | "fl_plugin_registrar.h" 51 | "fl_plugin_registry.h" 52 | "fl_standard_message_codec.h" 53 | "fl_standard_method_codec.h" 54 | "fl_string_codec.h" 55 | "fl_value.h" 56 | "fl_view.h" 57 | "flutter_linux.h" 58 | ) 59 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") 60 | add_library(flutter INTERFACE) 61 | target_include_directories(flutter INTERFACE 62 | "${EPHEMERAL_DIR}" 63 | ) 64 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") 65 | target_link_libraries(flutter INTERFACE 66 | PkgConfig::GTK 67 | PkgConfig::GLIB 68 | PkgConfig::GIO 69 | ) 70 | add_dependencies(flutter flutter_assemble) 71 | 72 | # === Flutter tool backend === 73 | # _phony_ is a non-existent file to force this command to run every time, 74 | # since currently there's no way to get a full input/output list from the 75 | # flutter tool. 76 | add_custom_command( 77 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 78 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_ 79 | COMMAND ${CMAKE_COMMAND} -E env 80 | ${FLUTTER_TOOL_ENVIRONMENT} 81 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" 82 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} 83 | VERBATIM 84 | ) 85 | add_custom_target(flutter_assemble DEPENDS 86 | "${FLUTTER_LIBRARY}" 87 | ${FLUTTER_LIBRARY_HEADERS} 88 | ) 89 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /README_REMOTE_401.md: -------------------------------------------------------------------------------- 1 | # Invoice Generator with Flutter x Gsheet 2 | 3 | A simple mobile app to generate invoices and get the pdf output of the file. 4 | 5 | ``` 6 | App Details 7 | App Name : Invoice Generator 8 | Platform : Android and iOS 9 | Version : 1.0 10 | App Size : 9 MB 11 | Language : Dart with Flutter 12 | Backend : Google Sheet with console API 13 | ``` 14 | Database 15 | - [Click Here](https://cutt.ly/f2Cy9vu) to open the Google Sheet used in the app 16 | 17 | ## Key Features 18 | - Fetching item lists and details from a database. 19 | - Providing a form with dropdown and auto-fill option matching the provided data. 20 | - Generating INVOICE with auto Bill No. 21 | - Creating PDF outputs of the invoices and printing or sharing directly from the app. 22 | - Using Google Sheets as a database. 23 | - Save invoice pdf in local storage. (coming soon) 24 | - Automatically send the invoice to any specific email or WhatsApp contact. (coming soon) 25 | 26 | ### Third-party Flutter Package used 27 | - [DropDown FormField](https://pub.dev/packages/dropdown_formfield) 28 | - [Gsheet](https://pub.dev/packages/gsheets) - Gives full potential to work with Google Sheets. 29 | - [PDF](https://pub.dev/packages/pdf) - A revolutionary pdf producer in dart. The main output pdf of the invoices is totally generated with the help of this package. 30 | - [Printing](https://pub.dev/packages/printing) - It helps to handle the generated pdf by PDF package. It allows you to preview, save or share the pdf in just one click. 31 | - [INTL](https://pub.dev/packages/intl) - Helps to format dates and times. 32 | - [Number to Character](https://pub.dev/packages/number_to_character) - It does the converting total amount in word under the hood. 33 | - [Flutter launcher icon](https://pub.dev/packages/flutter_launcher_icons) - This makes the icon and splash screen works more convenient. 34 | 35 | 36 | ### Building Roadmap 37 | - [x] Creating User interface. 38 | - [x] Intreagrate Google Sheets as a database. 39 | - [x] Creating pdf based on the product selected. 40 | - [x] Preview or Share the pdf. 41 | - [ ] Save the pdf in local storage. 42 | - [ ] Automatically send the invoice to any specific email or WhatsApp contact. 43 | 44 | 45 | ### Build Releases 46 | - [ARM-64 V8A](https://drive.google.com/file/d/1etM_k72_tvMX-_o_CqI0g5WhlQbb-iR3/view?usp=share_link) 47 | - [APP-x-86](https://drive.google.com/file/d/1X1--nXNQIbzIDUs77lyGo3M1HXkeEFwg/view?usp=share_link) 48 | > You will also find the apk files in 'Release' section. 49 | 50 | ## Screenshots 51 | 52 | ![image](https://user-images.githubusercontent.com/95021955/212470272-d7f37cdb-6216-44b3-8994-880565942c08.png) 53 | ![image](https://user-images.githubusercontent.com/95021955/212470290-3d370ed1-3346-41c3-a297-e6d815a01029.png) 54 | ![image](https://user-images.githubusercontent.com/95021955/212470293-1a33f575-49b1-4c3a-a2ac-588d48b544b2.png) 55 | ![image](https://user-images.githubusercontent.com/95021955/212470303-fb59d536-6319-495b-95c3-220c0b77fb2c.png) 56 | ![image](https://user-images.githubusercontent.com/95021955/212470458-522491be-0413-4244-b4ec-d40748d378d1.png) 57 | ![image](https://user-images.githubusercontent.com/95021955/212470388-6b432881-b0cd-4c71-83a6-e7f03541c428.png) 58 | 59 | 60 | -------------------------------------------------------------------------------- /test/providers/invoice_provider_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | import 'package:gsheet/models/customer.dart'; 3 | import 'package:gsheet/models/product.dart'; 4 | import 'package:gsheet/providers/invoice_provider.dart'; 5 | import 'package:gsheet/services/firebase_service.dart'; 6 | import 'package:mockito/mockito.dart'; 7 | 8 | class MockFirebaseService extends Mock implements FirebaseService {} 9 | 10 | void main() { 11 | late InvoiceProvider invoiceProvider; 12 | late MockFirebaseService mockFirebaseService; 13 | 14 | setUp(() { 15 | mockFirebaseService = MockFirebaseService(); 16 | invoiceProvider = InvoiceProvider(firebaseService: mockFirebaseService); 17 | }); 18 | 19 | group('InvoiceProvider', () { 20 | final products = [ 21 | Product(name: 'Product 1', type: 'Type A', packSize: '10', unitPrice: 100), 22 | Product(name: 'Product 2', type: 'Type B', packSize: '20', unitPrice: 200), 23 | ]; 24 | final customers = [ 25 | Customer(name: 'Customer 1', address: 'Address 1'), 26 | Customer(name: 'Customer 2', address: 'Address 2'), 27 | ]; 28 | final signUrl = 'http://example.com/sign.png'; 29 | 30 | test('loadInitialData should fetch data and update state', () async { 31 | when(mockFirebaseService.fetchData()).thenAnswer((_) async => { 32 | 'products': products, 33 | 'customers': customers, 34 | 'signUrl': signUrl, 35 | }); 36 | 37 | await invoiceProvider.loadInitialData(); 38 | 39 | expect(invoiceProvider.products, products); 40 | expect(invoiceProvider.customers, customers); 41 | expect(invoiceProvider.signUrl, signUrl); 42 | expect(invoiceProvider.isLoading, false); 43 | expect(invoiceProvider.error, null); 44 | }); 45 | 46 | test('addItem should add an item to the invoice', () { 47 | invoiceProvider.selectProduct(products.first); 48 | invoiceProvider.addItem(2, 1); 49 | 50 | expect(invoiceProvider.invoiceItems.length, 1); 51 | expect(invoiceProvider.invoiceItems.first.product, products.first); 52 | expect(invoiceProvider.invoiceItems.first.quantity, 2); 53 | expect(invoiceProvider.invoiceItems.first.bonus, 1); 54 | }); 55 | 56 | test('removeItem should remove an item from the invoice', () { 57 | invoiceProvider.selectProduct(products.first); 58 | invoiceProvider.addItem(2, 1); 59 | invoiceProvider.removeItem(0); 60 | 61 | expect(invoiceProvider.invoiceItems.length, 0); 62 | }); 63 | 64 | test('total should be calculated correctly', () { 65 | invoiceProvider.selectProduct(products.first); // price 100 66 | invoiceProvider.addItem(2, 0); 67 | invoiceProvider.selectProduct(products.last); // price 200 68 | invoiceProvider.addItem(1, 0); 69 | 70 | // subtotal = (100 * 2) + (200 * 1) = 400 71 | // tax = 400 * 0.15 = 60 72 | // total = 400 + 60 = 460 73 | expect(invoiceProvider.subtotal, 400); 74 | expect(invoiceProvider.tax, 60); 75 | expect(invoiceProvider.total, 460); 76 | }); 77 | 78 | test('clearForm should clear the invoice items and number', () { 79 | invoiceProvider.selectProduct(products.first); 80 | invoiceProvider.addItem(2, 1); 81 | invoiceProvider.setInvoiceNumber('123'); 82 | 83 | invoiceProvider.clearForm(); 84 | 85 | expect(invoiceProvider.invoiceItems.isEmpty, true); 86 | expect(invoiceProvider.invoiceNumber, ''); 87 | }); 88 | }); 89 | } 90 | -------------------------------------------------------------------------------- /README_BACKUP_401.md: -------------------------------------------------------------------------------- 1 | # Invoice Generator with Flutter x Gsheet 2 | 3 | A simple mobile app to generate invoices and get the pdf output of the file. 4 | 5 | ``` 6 | App Details 7 | App Name : Invoice Generator 8 | Platform : Android and iOS 9 | Version : 1.0 10 | App Size : 9 MB 11 | Language : Dart with Flutter 12 | Backend : Google Sheet with console API 13 | ``` 14 | Database 15 | - [Click Here](https://cutt.ly/f2Cy9vu) to open the Google Sheet used in the app 16 | 17 | ## Key Features 18 | - Fetching item lists and details from a database. 19 | - Providing a form with dropdown and auto-fill option matching the provided data. 20 | - Generating INVOICE with auto Bill No. 21 | - Creating PDF outputs of the invoices and printing or sharing directly from the app. 22 | - Using Google Sheets as a database. 23 | - Save invoice pdf in local storage. (coming soon) 24 | - Automatically send the invoice to any specific email or WhatsApp contact. (coming soon) 25 | 26 | ### Third-party Flutter Package used 27 | - [DropDown FormField](https://pub.dev/packages/dropdown_formfield) 28 | - [Gsheet](https://pub.dev/packages/gsheets) - Gives full potential to work with Google Sheets. 29 | - [PDF](https://pub.dev/packages/pdf) - A revolutionary pdf producer in dart. The main output pdf of the invoices is totally generated with the help of this package. 30 | - [Printing](https://pub.dev/packages/printing) - It helps to handle the generated pdf by PDF package. It allows you to preview, save or share the pdf in just one click. 31 | - [INTL](https://pub.dev/packages/intl) - Helps to format dates and times. 32 | - [Number to Character](https://pub.dev/packages/number_to_character) - It does the converting total amount in word under the hood. 33 | - [Flutter launcher icon](https://pub.dev/packages/flutter_launcher_icons) - This makes the icon and splash screen works more convenient. 34 | 35 | 36 | ### Building Roadmap 37 | - [x] Creating User interface. 38 | - [x] Intreagrate Google Sheets as a database. 39 | - [x] Creating pdf based on the product selected. 40 | - [x] Preview or Share the pdf. 41 | - [ ] Save the pdf in local storage. 42 | - [ ] Automatically send the invoice to any specific email or WhatsApp contact. 43 | 44 | 45 | ### Build Releases 46 | - [ARM-64 V8A](https://drive.google.com/file/d/1etM_k72_tvMX-_o_CqI0g5WhlQbb-iR3/view?usp=share_link) 47 | - [APP-x-86](https://drive.google.com/file/d/1X1--nXNQIbzIDUs77lyGo3M1HXkeEFwg/view?usp=share_link) 48 | > You will also find the apk files in 'Release' section. 49 | 50 | ## Screenshots 51 | 52 | ![image](https://user-images.githubusercontent.com/95021955/212470272-d7f37cdb-6216-44b3-8994-880565942c08.png) 53 | ![image](https://user-images.githubusercontent.com/95021955/212470290-3d370ed1-3346-41c3-a297-e6d815a01029.png) 54 | ![image](https://user-images.githubusercontent.com/95021955/212470293-1a33f575-49b1-4c3a-a2ac-588d48b544b2.png) 55 | ![image](https://user-images.githubusercontent.com/95021955/212470303-fb59d536-6319-495b-95c3-220c0b77fb2c.png) 56 | ![image](https://user-images.githubusercontent.com/95021955/212470458-522491be-0413-4244-b4ec-d40748d378d1.png) 57 | ![image](https://user-images.githubusercontent.com/95021955/212470388-6b432881-b0cd-4c71-83a6-e7f03541c428.png) 58 | 59 | 60 | <<<<<<< HEAD 61 | For help getting started with Flutter development, view the 62 | [online documentation](https://docs.flutter.dev/), which offers tutorials, 63 | samples, guidance on mobile development, and a full API reference. 64 | "# Invoice-Generator-Flutter" 65 | ======= 66 | >>>>>>> 56312d38e32be6a2c7d3f29d354c84aa7f8a3dd8 67 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /lib/services/firebase_service.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | import 'package:cloud_firestore/cloud_firestore.dart'; 3 | import 'package:gsheet/models/customer.dart'; 4 | import 'package:gsheet/models/invoice.dart'; 5 | import 'package:gsheet/models/product.dart'; 6 | import 'package:logger/logger.dart'; 7 | 8 | /// A service that handles all interactions with Firebase. 9 | /// 10 | /// This service is responsible for fetching data from and saving data to 11 | /// Cloud Firestore. 12 | class FirebaseService { 13 | final FirebaseFirestore _firestore = FirebaseFirestore.instance; 14 | final Logger _logger = Logger(); 15 | 16 | /// Fetches the initial data (products, customers, etc.) from Firestore. 17 | /// 18 | /// Returns a map containing the fetched data. 19 | Future> fetchData() async { 20 | try { 21 | _logger.i('Fetching data from Firestore...'); 22 | // Fetch products 23 | final productSnapshot = await _firestore.collection('products').get(); 24 | final products = productSnapshot.docs 25 | .map((doc) => Product.fromMap(doc.data())) 26 | .toList(); 27 | 28 | // Fetch customers 29 | final customerSnapshot = await _firestore.collection('customers').get(); 30 | final customers = customerSnapshot.docs 31 | .map((doc) => Customer.fromMap(doc.data())) 32 | .toList(); 33 | 34 | // Fetch resources (e.g., signUrl) 35 | final resourcesSnapshot = await _firestore.collection('resources').doc('config').get(); 36 | final signUrl = resourcesSnapshot.data()?['signURL'] ?? ''; 37 | 38 | _logger.i('Data fetched successfully.'); 39 | return { 40 | 'products': products, 41 | 'customers': customers, 42 | 'signUrl': signUrl, 43 | }; 44 | } catch (e, s) { 45 | _logger.e('Failed to load data from Firestore', e, s); 46 | throw Exception('Failed to load data from Firestore'); 47 | } 48 | } 49 | 50 | /// Saves an invoice to Firestore. 51 | /// 52 | /// The invoice data is saved in a transaction to ensure data integrity. 53 | Future saveInvoice(Invoice invoice) async { 54 | try { 55 | _logger.i('Saving invoice ${invoice.invoiceNumber} to Firestore...'); 56 | final invoiceRef = _firestore.collection('invoices').doc(invoice.invoiceNumber); 57 | 58 | await _firestore.runTransaction((transaction) async { 59 | // Save the main invoice document 60 | transaction.set(invoiceRef, { 61 | 'invoiceNumber': invoice.invoiceNumber, 62 | 'customerName': invoice.customer.name, 63 | 'customerAddress': invoice.customer.address, 64 | 'date': invoice.date, 65 | 'total': invoice.total, 66 | }); 67 | 68 | // Save the invoice items in a subcollection 69 | final itemsCollection = invoiceRef.collection('items'); 70 | for (var item in invoice.items) { 71 | final itemRef = itemsCollection.doc(); // Auto-generate ID for each item 72 | transaction.set(itemRef, { 73 | 'productName': item.product.name, 74 | 'productType': item.product.type, 75 | 'packSize': item.product.packSize, 76 | 'unitPrice': item.product.unitPrice, 77 | 'quantity': item.quantity, 78 | 'bonus': item.bonus, 79 | }); 80 | } 81 | }); 82 | _logger.i('Invoice ${invoice.invoiceNumber} saved successfully.'); 83 | } catch (e, s) { 84 | _logger.e('Failed to save invoice to Firestore', e, s); 85 | throw Exception('Failed to save invoice to Firestore'); 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) 64 | #define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0,0 67 | #endif 68 | 69 | #if defined(FLUTTER_VERSION) 70 | #define VERSION_AS_STRING FLUTTER_VERSION 71 | #else 72 | #define VERSION_AS_STRING "1.0.0" 73 | #endif 74 | 75 | VS_VERSION_INFO VERSIONINFO 76 | FILEVERSION VERSION_AS_NUMBER 77 | PRODUCTVERSION VERSION_AS_NUMBER 78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 79 | #ifdef _DEBUG 80 | FILEFLAGS VS_FF_DEBUG 81 | #else 82 | FILEFLAGS 0x0L 83 | #endif 84 | FILEOS VOS__WINDOWS32 85 | FILETYPE VFT_APP 86 | FILESUBTYPE 0x0L 87 | BEGIN 88 | BLOCK "StringFileInfo" 89 | BEGIN 90 | BLOCK "040904e4" 91 | BEGIN 92 | VALUE "CompanyName", "com.example" "\0" 93 | VALUE "FileDescription", "gsheet" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "gsheet" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2022 com.example. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "gsheet.exe" "\0" 98 | VALUE "ProductName", "gsheet" "\0" 99 | VALUE "ProductVersion", VERSION_AS_STRING "\0" 100 | END 101 | END 102 | BLOCK "VarFileInfo" 103 | BEGIN 104 | VALUE "Translation", 0x409, 1252 105 | END 106 | END 107 | 108 | #endif // English (United States) resources 109 | ///////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | 113 | #ifndef APSTUDIO_INVOKED 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // Generated from the TEXTINCLUDE 3 resource. 117 | // 118 | 119 | 120 | ///////////////////////////////////////////////////////////////////////////// 121 | #endif // not APSTUDIO_INVOKED 122 | -------------------------------------------------------------------------------- /windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates and shows a win32 window with |title| and position and size using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size to will treat the width height passed in to this function 35 | // as logical pixels and scale to appropriate for the default monitor. Returns 36 | // true if the window was created successfully. 37 | bool CreateAndShow(const std::wstring& title, 38 | const Point& origin, 39 | const Size& size); 40 | 41 | // Release OS resources associated with window. 42 | void Destroy(); 43 | 44 | // Inserts |content| into the window tree. 45 | void SetChildContent(HWND content); 46 | 47 | // Returns the backing Window handle to enable clients to set icon and other 48 | // window properties. Returns nullptr if the window has been destroyed. 49 | HWND GetHandle(); 50 | 51 | // If true, closing this window will quit the application. 52 | void SetQuitOnClose(bool quit_on_close); 53 | 54 | // Return a RECT representing the bounds of the current client area. 55 | RECT GetClientArea(); 56 | 57 | protected: 58 | // Processes and route salient window messages for mouse handling, 59 | // size change and DPI. Delegates handling of these to member overloads that 60 | // inheriting classes can handle. 61 | virtual LRESULT MessageHandler(HWND window, 62 | UINT const message, 63 | WPARAM const wparam, 64 | LPARAM const lparam) noexcept; 65 | 66 | // Called when CreateAndShow is called, allowing subclass window-related 67 | // setup. Subclasses should return false if setup fails. 68 | virtual bool OnCreate(); 69 | 70 | // Called when Destroy is called. 71 | virtual void OnDestroy(); 72 | 73 | private: 74 | friend class WindowClassRegistrar; 75 | 76 | // OS callback called by message pump. Handles the WM_NCCREATE message which 77 | // is passed when the non-client area is being created and enables automatic 78 | // non-client DPI scaling so that the non-client area automatically 79 | // responsponds to changes in DPI. All other messages are handled by 80 | // MessageHandler. 81 | static LRESULT CALLBACK WndProc(HWND const window, 82 | UINT const message, 83 | WPARAM const wparam, 84 | LPARAM const lparam) noexcept; 85 | 86 | // Retrieves a class instance pointer for |window| 87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 88 | 89 | bool quit_on_close_ = false; 90 | 91 | // window handle for top level window. 92 | HWND window_handle_ = nullptr; 93 | 94 | // window handle for hosted content. 95 | HWND child_content_ = nullptr; 96 | }; 97 | 98 | #endif // RUNNER_WIN32_WINDOW_H_ 99 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Flutter Invoice Generator 2 | 3 | A professional and production-ready mobile app to generate invoices, built with Flutter. This project is a complete overhaul of the original, focusing on a robust architecture, clean code, and a better user experience. 4 | 5 | ## Key Features 6 | - **Modern UI/UX:** A clean and user-friendly interface. 7 | - **State Management:** Uses the `provider` package for scalable and maintainable state management. 8 | - **Robust Backend:** Fully integrated with Cloud Firestore for all database operations. 9 | - **PDF Generation:** Generate, preview, and share professional-looking invoices as PDFs. 10 | - **Error Handling & Logging:** Implemented robust error handling and logging for easier debugging. 11 | - **Tested:** Includes unit and widget tests to ensure functionality and prevent regressions. 12 | 13 | ## Tech Stack 14 | - **Flutter & Dart** 15 | - **Firebase:** Cloud Firestore for the database. 16 | - **Provider:** For state management. 17 | - **PDF & Printing:** For PDF generation and handling. 18 | - **Logger:** For logging. 19 | - **Mockito:** For testing. 20 | 21 | ## Project Structure 22 | The project has been refactored into a clean and scalable architecture: 23 | ``` 24 | lib/ 25 | ├── models/ # Data models for the app (Invoice, Product, etc.) 26 | ├── providers/ # ChangeNotifier classes for state management 27 | ├── screens/ # UI screens for the app 28 | ├── services/ # Services for interacting with external resources (Firebase, PDF) 29 | └── main.dart # The main entry point of the app 30 | ``` 31 | 32 | ## Getting Started 33 | To get a local copy up and running, follow these simple steps. 34 | 35 | ### Prerequisites 36 | - Flutter SDK: Make sure you have the Flutter SDK installed. 37 | - A Firebase project: You'll need a Firebase project to connect the app to a backend. 38 | 39 | ### Installation 40 | 1. **Clone the repo** 41 | ```sh 42 | git clone https://github.com/your_username_/your_repository.git 43 | ``` 44 | 2. **Install packages** 45 | ```sh 46 | flutter pub get 47 | ``` 48 | 3. **Set up Firebase** 49 | - Create a new Firebase project at [https://console.firebase.google.com/](https://console.firebase.google.com/). 50 | - Add an Android and/or iOS app to your Firebase project. 51 | - Follow the instructions to download the `google-services.json` (for Android) and `GoogleService-Info.plist` (for iOS) files. 52 | - Place the `google-services.json` file in the `android/app/` directory. 53 | - Place the `GoogleService-Info.plist` file in the `ios/Runner/` directory. 54 | 4. **Set up Firestore** 55 | - In your Firebase project, create a Cloud Firestore database. 56 | - Create the following collections with some sample data: 57 | - `products`: with fields `Product Name`, `Type`, `Pack size`, `Unit Price`. 58 | - `customers`: with fields `Party Name`, `Address`. 59 | - `resources`: with a document named `config` and a field `signURL` (a URL to an image for the signature). 60 | 61 | ## Usage 62 | Run the app using the following command: 63 | ```sh 64 | flutter run 65 | ``` 66 | 67 | ## Contributing 68 | Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**. 69 | 70 | If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". 71 | 72 | Don't forget to give the project a star! Thanks again! 73 | 74 | 1. Fork the Project 75 | 2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`) 76 | 3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`) 77 | 4. Push to the Branch (`git push origin feature/AmazingFeature`) 78 | 5. Open a Pull Request 79 | 80 | ## Contact 81 | contact@tanvirrobin.dev 82 | -------------------------------------------------------------------------------- /windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.14) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 12 | 13 | # === Flutter Library === 14 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 15 | 16 | # Published to parent scope for install step. 17 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 18 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 19 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 20 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 21 | 22 | list(APPEND FLUTTER_LIBRARY_HEADERS 23 | "flutter_export.h" 24 | "flutter_windows.h" 25 | "flutter_messenger.h" 26 | "flutter_plugin_registrar.h" 27 | "flutter_texture_registrar.h" 28 | ) 29 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 30 | add_library(flutter INTERFACE) 31 | target_include_directories(flutter INTERFACE 32 | "${EPHEMERAL_DIR}" 33 | ) 34 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 35 | add_dependencies(flutter flutter_assemble) 36 | 37 | # === Wrapper === 38 | list(APPEND CPP_WRAPPER_SOURCES_CORE 39 | "core_implementations.cc" 40 | "standard_codec.cc" 41 | ) 42 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 43 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 44 | "plugin_registrar.cc" 45 | ) 46 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 47 | list(APPEND CPP_WRAPPER_SOURCES_APP 48 | "flutter_engine.cc" 49 | "flutter_view_controller.cc" 50 | ) 51 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 52 | 53 | # Wrapper sources needed for a plugin. 54 | add_library(flutter_wrapper_plugin STATIC 55 | ${CPP_WRAPPER_SOURCES_CORE} 56 | ${CPP_WRAPPER_SOURCES_PLUGIN} 57 | ) 58 | apply_standard_settings(flutter_wrapper_plugin) 59 | set_target_properties(flutter_wrapper_plugin PROPERTIES 60 | POSITION_INDEPENDENT_CODE ON) 61 | set_target_properties(flutter_wrapper_plugin PROPERTIES 62 | CXX_VISIBILITY_PRESET hidden) 63 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 64 | target_include_directories(flutter_wrapper_plugin PUBLIC 65 | "${WRAPPER_ROOT}/include" 66 | ) 67 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 68 | 69 | # Wrapper sources needed for the runner. 70 | add_library(flutter_wrapper_app STATIC 71 | ${CPP_WRAPPER_SOURCES_CORE} 72 | ${CPP_WRAPPER_SOURCES_APP} 73 | ) 74 | apply_standard_settings(flutter_wrapper_app) 75 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 76 | target_include_directories(flutter_wrapper_app PUBLIC 77 | "${WRAPPER_ROOT}/include" 78 | ) 79 | add_dependencies(flutter_wrapper_app flutter_assemble) 80 | 81 | # === Flutter tool backend === 82 | # _phony_ is a non-existent file to force this command to run every time, 83 | # since currently there's no way to get a full input/output list from the 84 | # flutter tool. 85 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 86 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 87 | add_custom_command( 88 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 89 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 90 | ${CPP_WRAPPER_SOURCES_APP} 91 | ${PHONY_OUTPUT} 92 | COMMAND ${CMAKE_COMMAND} -E env 93 | ${FLUTTER_TOOL_ENVIRONMENT} 94 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 95 | windows-x64 $ 96 | VERBATIM 97 | ) 98 | add_custom_target(flutter_assemble DEPENDS 99 | "${FLUTTER_LIBRARY}" 100 | ${FLUTTER_LIBRARY_HEADERS} 101 | ${CPP_WRAPPER_SOURCES_CORE} 102 | ${CPP_WRAPPER_SOURCES_PLUGIN} 103 | ${CPP_WRAPPER_SOURCES_APP} 104 | ) 105 | -------------------------------------------------------------------------------- /linux/my_application.cc: -------------------------------------------------------------------------------- 1 | #include "my_application.h" 2 | 3 | #include 4 | #ifdef GDK_WINDOWING_X11 5 | #include 6 | #endif 7 | 8 | #include "flutter/generated_plugin_registrant.h" 9 | 10 | struct _MyApplication { 11 | GtkApplication parent_instance; 12 | char** dart_entrypoint_arguments; 13 | }; 14 | 15 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) 16 | 17 | // Implements GApplication::activate. 18 | static void my_application_activate(GApplication* application) { 19 | MyApplication* self = MY_APPLICATION(application); 20 | GtkWindow* window = 21 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); 22 | 23 | // Use a header bar when running in GNOME as this is the common style used 24 | // by applications and is the setup most users will be using (e.g. Ubuntu 25 | // desktop). 26 | // If running on X and not using GNOME then just use a traditional title bar 27 | // in case the window manager does more exotic layout, e.g. tiling. 28 | // If running on Wayland assume the header bar will work (may need changing 29 | // if future cases occur). 30 | gboolean use_header_bar = TRUE; 31 | #ifdef GDK_WINDOWING_X11 32 | GdkScreen* screen = gtk_window_get_screen(window); 33 | if (GDK_IS_X11_SCREEN(screen)) { 34 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); 35 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) { 36 | use_header_bar = FALSE; 37 | } 38 | } 39 | #endif 40 | if (use_header_bar) { 41 | GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); 42 | gtk_widget_show(GTK_WIDGET(header_bar)); 43 | gtk_header_bar_set_title(header_bar, "gsheet"); 44 | gtk_header_bar_set_show_close_button(header_bar, TRUE); 45 | gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); 46 | } else { 47 | gtk_window_set_title(window, "gsheet"); 48 | } 49 | 50 | gtk_window_set_default_size(window, 1280, 720); 51 | gtk_widget_show(GTK_WIDGET(window)); 52 | 53 | g_autoptr(FlDartProject) project = fl_dart_project_new(); 54 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); 55 | 56 | FlView* view = fl_view_new(project); 57 | gtk_widget_show(GTK_WIDGET(view)); 58 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); 59 | 60 | fl_register_plugins(FL_PLUGIN_REGISTRY(view)); 61 | 62 | gtk_widget_grab_focus(GTK_WIDGET(view)); 63 | } 64 | 65 | // Implements GApplication::local_command_line. 66 | static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { 67 | MyApplication* self = MY_APPLICATION(application); 68 | // Strip out the first argument as it is the binary name. 69 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); 70 | 71 | g_autoptr(GError) error = nullptr; 72 | if (!g_application_register(application, nullptr, &error)) { 73 | g_warning("Failed to register: %s", error->message); 74 | *exit_status = 1; 75 | return TRUE; 76 | } 77 | 78 | g_application_activate(application); 79 | *exit_status = 0; 80 | 81 | return TRUE; 82 | } 83 | 84 | // Implements GObject::dispose. 85 | static void my_application_dispose(GObject* object) { 86 | MyApplication* self = MY_APPLICATION(object); 87 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); 88 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object); 89 | } 90 | 91 | static void my_application_class_init(MyApplicationClass* klass) { 92 | G_APPLICATION_CLASS(klass)->activate = my_application_activate; 93 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; 94 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose; 95 | } 96 | 97 | static void my_application_init(MyApplication* self) {} 98 | 99 | MyApplication* my_application_new() { 100 | return MY_APPLICATION(g_object_new(my_application_get_type(), 101 | "application-id", APPLICATION_ID, 102 | "flags", G_APPLICATION_NON_UNIQUE, 103 | nullptr)); 104 | } 105 | -------------------------------------------------------------------------------- /windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.14) 3 | project(gsheet LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "gsheet") 8 | 9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 10 | # versions of CMake. 11 | cmake_policy(SET CMP0063 NEW) 12 | 13 | # Define build configuration option. 14 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 15 | if(IS_MULTICONFIG) 16 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 17 | CACHE STRING "" FORCE) 18 | else() 19 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 20 | set(CMAKE_BUILD_TYPE "Debug" CACHE 21 | STRING "Flutter build mode" FORCE) 22 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 23 | "Debug" "Profile" "Release") 24 | endif() 25 | endif() 26 | # Define settings for the Profile build mode. 27 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 28 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 29 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 30 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 31 | 32 | # Use Unicode for all projects. 33 | add_definitions(-DUNICODE -D_UNICODE) 34 | 35 | # Compilation settings that should be applied to most targets. 36 | # 37 | # Be cautious about adding new options here, as plugins use this function by 38 | # default. In most cases, you should add new options to specific targets instead 39 | # of modifying this function. 40 | function(APPLY_STANDARD_SETTINGS TARGET) 41 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 42 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 43 | target_compile_options(${TARGET} PRIVATE /EHsc) 44 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 45 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 46 | endfunction() 47 | 48 | # Flutter library and tool build rules. 49 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 50 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 51 | 52 | # Application build; see runner/CMakeLists.txt. 53 | add_subdirectory("runner") 54 | 55 | # Generated plugin build rules, which manage building the plugins and adding 56 | # them to the application. 57 | include(flutter/generated_plugins.cmake) 58 | 59 | 60 | # === Installation === 61 | # Support files are copied into place next to the executable, so that it can 62 | # run in place. This is done instead of making a separate bundle (as on Linux) 63 | # so that building and running from within Visual Studio will work. 64 | set(BUILD_BUNDLE_DIR "$") 65 | # Make the "install" step default, as it's required to run. 66 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 67 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 68 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 69 | endif() 70 | 71 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 72 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 73 | 74 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 75 | COMPONENT Runtime) 76 | 77 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 78 | COMPONENT Runtime) 79 | 80 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 81 | COMPONENT Runtime) 82 | 83 | if(PLUGIN_BUNDLED_LIBRARIES) 84 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 85 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 86 | COMPONENT Runtime) 87 | endif() 88 | 89 | # Fully re-copy the assets directory on each build to avoid having stale files 90 | # from a previous install. 91 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 92 | install(CODE " 93 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 94 | " COMPONENT Runtime) 95 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 96 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 97 | 98 | # Install the AOT library on non-Debug builds only. 99 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 100 | CONFIGURATIONS Profile;Release 101 | COMPONENT Runtime) 102 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: gsheet 2 | description: Invoice Maker based on Firebase 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `flutter pub publish`. This is preferred for private packages. 6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 7 | 8 | # The following defines the version and build number for your application. 9 | # A version number is three numbers separated by dots, like 1.2.43 10 | # followed by an optional build number separated by a +. 11 | # Both the version and the builder number may be overridden in flutter 12 | # build by specifying --build-name and --build-number, respectively. 13 | # In Android, build-name is used as versionName while build-number used as versionCode. 14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. 16 | # Read more about iOS versioning at 17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 18 | # In Windows, build-name is used as the major, minor, and patch parts 19 | # of the product and file versions while build-number is used as the build suffix. 20 | version: 3.0.0+1 21 | 22 | environment: 23 | sdk: '>=2.18.6 <3.0.0' 24 | 25 | # Dependencies specify other packages that your package needs in order to work. 26 | # To automatically upgrade your package dependencies to the latest versions 27 | # consider running `flutter pub upgrade --major-versions`. Alternatively, 28 | # dependencies can be manually updated by changing the version numbers below to 29 | # the latest version available on pub.dev. To see which dependencies have newer 30 | # versions available, run `flutter pub outdated`. 31 | dependencies: 32 | cloud_firestore: ^4.5.0 33 | cupertino_icons: ^1.0.2 34 | firebase_auth: ^4.4.0 35 | firebase_core: ^2.9.0 36 | firebase_database: ^10.1.0 37 | flutter: 38 | sdk: flutter 39 | http: ^0.13.5 40 | intl: ^0.17.0 41 | number_to_character: ^0.0.12 42 | path: ^1.8.2 43 | path_provider: ^2.0.11 44 | pdf: ^3.8.4 45 | printing: ^5.9.3 46 | provider: ^6.0.5 47 | logger: ^1.1.0 48 | 49 | dev_dependencies: 50 | flutter_launcher_icons: ^0.11.0 51 | flutter_test: 52 | sdk: flutter 53 | mockito: ^5.3.2 54 | build_runner: ^2.1.11 55 | 56 | flutter_icons: 57 | android: true 58 | ios: true 59 | image_path: "icons/icons.png" 60 | adpative_icon_background: "#191919" 61 | adpative_icon_foreround: "icons/icons.png" 62 | 63 | # The "flutter_lints" package below contains a set of recommended lints to 64 | # encourage good coding practices. The lint set provided by the package is 65 | # activated in the `analysis_options.yaml` file located at the root of your 66 | # package. See that file for information about deactivating specific lint 67 | # rules and activating additional ones. 68 | flutter_lints: ^2.0.0 69 | 70 | # For information on the generic Dart part of this file, see the 71 | # following page: https://dart.dev/tools/pub/pubspec 72 | # The following section is specific to Flutter packages. 73 | flutter: 74 | 75 | # The following line ensures that the Material Icons font is 76 | # included with your application, so that you can use the icons in 77 | # the material Icons class. 78 | uses-material-design: true 79 | 80 | # To add assets to your application, add an assets section, like this: 81 | assets: 82 | - asset/images/ 83 | # - images/a_dot_ham.jpeg 84 | # An image asset can refer to one or more resolution-specific "variants", see 85 | # https://flutter.dev/assets-and-images/#resolution-aware 86 | # For details regarding adding assets from package dependencies, see 87 | # https://flutter.dev/assets-and-images/#from-packages 88 | # To add custom fonts to your application, add a fonts section here, 89 | # in this "flutter" section. Each entry in this list should have a 90 | # "family" key with the font family name, and a "fonts" key with a 91 | # list giving the asset and other descriptors for the font. For 92 | # example: 93 | fonts: 94 | - family: Cambria 95 | fonts: 96 | - asset: fonts/Cambria.ttf 97 | - family: CambriaB 98 | fonts: 99 | - asset: fonts/cambriab.ttf 100 | # For details regarding fonts from package dependencies, 101 | # see https://flutter.dev/custom-fonts/#from-packages 102 | -------------------------------------------------------------------------------- /linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.10) 3 | project(runner LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "gsheet") 8 | # The unique GTK application identifier for this application. See: 9 | # https://wiki.gnome.org/HowDoI/ChooseApplicationID 10 | set(APPLICATION_ID "com.example.gsheet") 11 | 12 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 13 | # versions of CMake. 14 | cmake_policy(SET CMP0063 NEW) 15 | 16 | # Load bundled libraries from the lib/ directory relative to the binary. 17 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 18 | 19 | # Root filesystem for cross-building. 20 | if(FLUTTER_TARGET_PLATFORM_SYSROOT) 21 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) 22 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) 23 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 24 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 25 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 26 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 27 | endif() 28 | 29 | # Define build configuration options. 30 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 31 | set(CMAKE_BUILD_TYPE "Debug" CACHE 32 | STRING "Flutter build mode" FORCE) 33 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 34 | "Debug" "Profile" "Release") 35 | endif() 36 | 37 | # Compilation settings that should be applied to most targets. 38 | # 39 | # Be cautious about adding new options here, as plugins use this function by 40 | # default. In most cases, you should add new options to specific targets instead 41 | # of modifying this function. 42 | function(APPLY_STANDARD_SETTINGS TARGET) 43 | target_compile_features(${TARGET} PUBLIC cxx_std_14) 44 | target_compile_options(${TARGET} PRIVATE -Wall -Werror) 45 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") 46 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") 47 | endfunction() 48 | 49 | # Flutter library and tool build rules. 50 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 51 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 52 | 53 | # System-level dependencies. 54 | find_package(PkgConfig REQUIRED) 55 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 56 | 57 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") 58 | 59 | # Define the application target. To change its name, change BINARY_NAME above, 60 | # not the value here, or `flutter run` will no longer work. 61 | # 62 | # Any new source files that you add to the application should be added here. 63 | add_executable(${BINARY_NAME} 64 | "main.cc" 65 | "my_application.cc" 66 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 67 | ) 68 | 69 | # Apply the standard set of build settings. This can be removed for applications 70 | # that need different build settings. 71 | apply_standard_settings(${BINARY_NAME}) 72 | 73 | # Add dependency libraries. Add any application-specific dependencies here. 74 | target_link_libraries(${BINARY_NAME} PRIVATE flutter) 75 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) 76 | 77 | # Run the Flutter tool portions of the build. This must not be removed. 78 | add_dependencies(${BINARY_NAME} flutter_assemble) 79 | 80 | # Only the install-generated bundle's copy of the executable will launch 81 | # correctly, since the resources must in the right relative locations. To avoid 82 | # people trying to run the unbundled copy, put it in a subdirectory instead of 83 | # the default top-level location. 84 | set_target_properties(${BINARY_NAME} 85 | PROPERTIES 86 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" 87 | ) 88 | 89 | # Generated plugin build rules, which manage building the plugins and adding 90 | # them to the application. 91 | include(flutter/generated_plugins.cmake) 92 | 93 | 94 | # === Installation === 95 | # By default, "installing" just makes a relocatable bundle in the build 96 | # directory. 97 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") 98 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 99 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 100 | endif() 101 | 102 | # Start with a clean build bundle directory every time. 103 | install(CODE " 104 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") 105 | " COMPONENT Runtime) 106 | 107 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 108 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") 109 | 110 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 111 | COMPONENT Runtime) 112 | 113 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 114 | COMPONENT Runtime) 115 | 116 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 117 | COMPONENT Runtime) 118 | 119 | foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) 120 | install(FILES "${bundled_library}" 121 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 122 | COMPONENT Runtime) 123 | endforeach(bundled_library) 124 | 125 | # Fully re-copy the assets directory on each build to avoid having stale files 126 | # from a previous install. 127 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 128 | install(CODE " 129 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 130 | " COMPONENT Runtime) 131 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 132 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 133 | 134 | # Install the AOT library on non-Debug builds only. 135 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") 136 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 137 | COMPONENT Runtime) 138 | endif() 139 | -------------------------------------------------------------------------------- /lib/providers/invoice_provider.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:gsheet/models/customer.dart'; 3 | import 'package:gsheet/models/invoice.dart'; 4 | import 'package:gsheet/models/invoice_item.dart'; 5 | import 'package:gsheet/models/product.dart'; 6 | import 'package:gsheet/services/firebase_service.dart'; 7 | import 'package:gsheet/services/pdf_service.dart'; 8 | import 'package:logger/logger.dart'; 9 | 10 | /// Manages the state of the invoice creation process. 11 | /// 12 | /// This provider handles the business logic for creating, managing, 13 | /// and saving invoices. It interacts with the [FirebaseService] and 14 | /// [PdfService] to handle data persistence and PDF generation. 15 | class InvoiceProvider with ChangeNotifier { 16 | late final FirebaseService _firebaseService; 17 | final _logger = Logger(); 18 | 19 | /// Creates an instance of [InvoiceProvider]. 20 | /// 21 | /// An optional [firebaseService] can be provided for testing purposes. 22 | InvoiceProvider({FirebaseService? firebaseService}) { 23 | _firebaseService = firebaseService ?? FirebaseService(); 24 | } 25 | 26 | List _products = []; 27 | List _customers = []; 28 | List _invoiceItems = []; 29 | String _signUrl = ''; 30 | bool _isLoading = false; 31 | String? _error; 32 | bool _isBusy = false; 33 | 34 | /// The list of available products. 35 | List get products => _products; 36 | /// The list of available customers. 37 | List get customers => _customers; 38 | /// The list of items currently in the invoice. 39 | List get invoiceItems => _invoiceItems; 40 | /// The URL for the signature image. 41 | String get signUrl => _signUrl; 42 | /// Whether the initial data is being loaded. 43 | bool get isLoading => _isLoading; 44 | /// The current error message, if any. 45 | String? get error => _error; 46 | /// Whether the provider is busy with a task (e.g., saving an invoice). 47 | bool get isBusy => _isBusy; 48 | 49 | /// The currently selected customer. 50 | Customer? selectedCustomer; 51 | /// The currently selected product to be added to the invoice. 52 | Product? selectedProduct; 53 | /// The current invoice number. 54 | String invoiceNumber = ''; 55 | 56 | /// Clears the current invoice form. 57 | void clearForm() { 58 | _invoiceItems.clear(); 59 | invoiceNumber = ''; 60 | notifyListeners(); 61 | _logger.i('Form cleared.'); 62 | } 63 | 64 | /// Creates and saves the current invoice to Firestore. 65 | /// 66 | /// Returns the created [Invoice] on success, or `null` on failure. 67 | Future _createAndSaveInvoice() async { 68 | if (selectedCustomer == null || 69 | invoiceNumber.isEmpty || 70 | _invoiceItems.isEmpty) { 71 | _error = 'Please fill all fields and add at least one item.'; 72 | notifyListeners(); 73 | return null; 74 | } 75 | 76 | _isBusy = true; 77 | _error = null; 78 | notifyListeners(); 79 | 80 | final invoice = Invoice( 81 | invoiceNumber: invoiceNumber, 82 | customer: selectedCustomer!, 83 | date: DateTime.now(), 84 | items: _invoiceItems, 85 | signUrl: _signUrl, 86 | ); 87 | 88 | try { 89 | await _firebaseService.saveInvoice(invoice); 90 | _isBusy = false; 91 | notifyListeners(); 92 | return invoice; 93 | } catch (e, s) { 94 | _logger.e('Failed to save invoice', e, s); 95 | _error = 'Failed to save invoice. Please try again.'; 96 | _isBusy = false; 97 | notifyListeners(); 98 | return null; 99 | } 100 | } 101 | 102 | /// Generates a preview of the current invoice. 103 | Future previewInvoice() async { 104 | final invoice = await _createAndSaveInvoice(); 105 | if (invoice != null) { 106 | try { 107 | final pdfService = PdfService(); 108 | await pdfService.generateInvoice(invoice, true); 109 | _logger.i('Invoice ${invoice.invoiceNumber} previewed successfully.'); 110 | } catch (e, s) { 111 | _logger.e('Failed to preview invoice', e, s); 112 | _error = 'Failed to generate PDF. Please try again.'; 113 | notifyListeners(); 114 | } 115 | } 116 | } 117 | 118 | /// Shares the current invoice as a PDF. 119 | Future shareInvoice() async { 120 | final invoice = await _createAndSaveInvoice(); 121 | if (invoice != null) { 122 | try { 123 | final pdfService = PdfService(); 124 | await pdfService.generateInvoice(invoice, false); 125 | _logger.i('Invoice ${invoice.invoiceNumber} shared successfully.'); 126 | } catch (e, s) { 127 | _logger.e('Failed to share invoice', e, s); 128 | _error = 'Failed to share PDF. Please try again.'; 129 | notifyListeners(); 130 | } 131 | } 132 | } 133 | 134 | /// Loads the initial data (products, customers, etc.) from Firestore. 135 | Future loadInitialData() async { 136 | _isLoading = true; 137 | _error = null; 138 | notifyListeners(); 139 | try { 140 | final data = await _firebaseService.fetchData(); 141 | _products = data['products']; 142 | _customers = data['customers']; 143 | _signUrl = data['signUrl']; 144 | if (_products.isNotEmpty) { 145 | selectedProduct = _products.first; 146 | } 147 | if (_customers.isNotEmpty) { 148 | selectedCustomer = _customers.first; 149 | } 150 | _logger.i('Initial data loaded successfully.'); 151 | } catch (e, s) { 152 | _logger.e('Failed to load initial data', e, s); 153 | _error = 'Failed to load data. Please check your internet connection.'; 154 | } finally { 155 | _isLoading = false; 156 | notifyListeners(); 157 | } 158 | } 159 | 160 | /// Sets the selected customer. 161 | void selectCustomer(Customer? customer) { 162 | selectedCustomer = customer; 163 | notifyListeners(); 164 | } 165 | 166 | /// Sets the selected product. 167 | void selectProduct(Product? product) { 168 | selectedProduct = product; 169 | notifyListeners(); 170 | } 171 | 172 | /// Sets the invoice number. 173 | void setInvoiceNumber(String number) { 174 | invoiceNumber = number; 175 | } 176 | 177 | /// Adds an item to the current invoice. 178 | void addItem(int quantity, int bonus) { 179 | if (selectedProduct != null) { 180 | _invoiceItems.add(InvoiceItem( 181 | product: selectedProduct!, 182 | quantity: quantity, 183 | bonus: bonus, 184 | )); 185 | notifyListeners(); 186 | _logger.i('Added item: ${selectedProduct!.name}'); 187 | } 188 | } 189 | 190 | /// Removes an item from the current invoice. 191 | void removeItem(int index) { 192 | if (index >= 0 && index < _invoiceItems.length) { 193 | final item = _invoiceItems[index]; 194 | _invoiceItems.removeAt(index); 195 | notifyListeners(); 196 | _logger.i('Removed item: ${item.product.name}'); 197 | } 198 | } 199 | 200 | /// The subtotal of the invoice (before tax). 201 | double get subtotal { 202 | return _invoiceItems.fold(0.0, (sum, item) => sum + item.totalPrice); 203 | } 204 | 205 | /// The tax amount of the invoice. 206 | double get tax => subtotal * 0.15; 207 | 208 | /// The total amount of the invoice (including tax). 209 | double get total => subtotal + tax; 210 | } 211 | -------------------------------------------------------------------------------- /windows/runner/win32_window.cpp: -------------------------------------------------------------------------------- 1 | #include "win32_window.h" 2 | 3 | #include 4 | 5 | #include "resource.h" 6 | 7 | namespace { 8 | 9 | constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; 10 | 11 | // The number of Win32Window objects that currently exist. 12 | static int g_active_window_count = 0; 13 | 14 | using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); 15 | 16 | // Scale helper to convert logical scaler values to physical using passed in 17 | // scale factor 18 | int Scale(int source, double scale_factor) { 19 | return static_cast(source * scale_factor); 20 | } 21 | 22 | // Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. 23 | // This API is only needed for PerMonitor V1 awareness mode. 24 | void EnableFullDpiSupportIfAvailable(HWND hwnd) { 25 | HMODULE user32_module = LoadLibraryA("User32.dll"); 26 | if (!user32_module) { 27 | return; 28 | } 29 | auto enable_non_client_dpi_scaling = 30 | reinterpret_cast( 31 | GetProcAddress(user32_module, "EnableNonClientDpiScaling")); 32 | if (enable_non_client_dpi_scaling != nullptr) { 33 | enable_non_client_dpi_scaling(hwnd); 34 | FreeLibrary(user32_module); 35 | } 36 | } 37 | 38 | } // namespace 39 | 40 | // Manages the Win32Window's window class registration. 41 | class WindowClassRegistrar { 42 | public: 43 | ~WindowClassRegistrar() = default; 44 | 45 | // Returns the singleton registar instance. 46 | static WindowClassRegistrar* GetInstance() { 47 | if (!instance_) { 48 | instance_ = new WindowClassRegistrar(); 49 | } 50 | return instance_; 51 | } 52 | 53 | // Returns the name of the window class, registering the class if it hasn't 54 | // previously been registered. 55 | const wchar_t* GetWindowClass(); 56 | 57 | // Unregisters the window class. Should only be called if there are no 58 | // instances of the window. 59 | void UnregisterWindowClass(); 60 | 61 | private: 62 | WindowClassRegistrar() = default; 63 | 64 | static WindowClassRegistrar* instance_; 65 | 66 | bool class_registered_ = false; 67 | }; 68 | 69 | WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; 70 | 71 | const wchar_t* WindowClassRegistrar::GetWindowClass() { 72 | if (!class_registered_) { 73 | WNDCLASS window_class{}; 74 | window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); 75 | window_class.lpszClassName = kWindowClassName; 76 | window_class.style = CS_HREDRAW | CS_VREDRAW; 77 | window_class.cbClsExtra = 0; 78 | window_class.cbWndExtra = 0; 79 | window_class.hInstance = GetModuleHandle(nullptr); 80 | window_class.hIcon = 81 | LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); 82 | window_class.hbrBackground = 0; 83 | window_class.lpszMenuName = nullptr; 84 | window_class.lpfnWndProc = Win32Window::WndProc; 85 | RegisterClass(&window_class); 86 | class_registered_ = true; 87 | } 88 | return kWindowClassName; 89 | } 90 | 91 | void WindowClassRegistrar::UnregisterWindowClass() { 92 | UnregisterClass(kWindowClassName, nullptr); 93 | class_registered_ = false; 94 | } 95 | 96 | Win32Window::Win32Window() { 97 | ++g_active_window_count; 98 | } 99 | 100 | Win32Window::~Win32Window() { 101 | --g_active_window_count; 102 | Destroy(); 103 | } 104 | 105 | bool Win32Window::CreateAndShow(const std::wstring& title, 106 | const Point& origin, 107 | const Size& size) { 108 | Destroy(); 109 | 110 | const wchar_t* window_class = 111 | WindowClassRegistrar::GetInstance()->GetWindowClass(); 112 | 113 | const POINT target_point = {static_cast(origin.x), 114 | static_cast(origin.y)}; 115 | HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); 116 | UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); 117 | double scale_factor = dpi / 96.0; 118 | 119 | HWND window = CreateWindow( 120 | window_class, title.c_str(), WS_OVERLAPPEDWINDOW | WS_VISIBLE, 121 | Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), 122 | Scale(size.width, scale_factor), Scale(size.height, scale_factor), 123 | nullptr, nullptr, GetModuleHandle(nullptr), this); 124 | 125 | if (!window) { 126 | return false; 127 | } 128 | 129 | return OnCreate(); 130 | } 131 | 132 | // static 133 | LRESULT CALLBACK Win32Window::WndProc(HWND const window, 134 | UINT const message, 135 | WPARAM const wparam, 136 | LPARAM const lparam) noexcept { 137 | if (message == WM_NCCREATE) { 138 | auto window_struct = reinterpret_cast(lparam); 139 | SetWindowLongPtr(window, GWLP_USERDATA, 140 | reinterpret_cast(window_struct->lpCreateParams)); 141 | 142 | auto that = static_cast(window_struct->lpCreateParams); 143 | EnableFullDpiSupportIfAvailable(window); 144 | that->window_handle_ = window; 145 | } else if (Win32Window* that = GetThisFromHandle(window)) { 146 | return that->MessageHandler(window, message, wparam, lparam); 147 | } 148 | 149 | return DefWindowProc(window, message, wparam, lparam); 150 | } 151 | 152 | LRESULT 153 | Win32Window::MessageHandler(HWND hwnd, 154 | UINT const message, 155 | WPARAM const wparam, 156 | LPARAM const lparam) noexcept { 157 | switch (message) { 158 | case WM_DESTROY: 159 | window_handle_ = nullptr; 160 | Destroy(); 161 | if (quit_on_close_) { 162 | PostQuitMessage(0); 163 | } 164 | return 0; 165 | 166 | case WM_DPICHANGED: { 167 | auto newRectSize = reinterpret_cast(lparam); 168 | LONG newWidth = newRectSize->right - newRectSize->left; 169 | LONG newHeight = newRectSize->bottom - newRectSize->top; 170 | 171 | SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, 172 | newHeight, SWP_NOZORDER | SWP_NOACTIVATE); 173 | 174 | return 0; 175 | } 176 | case WM_SIZE: { 177 | RECT rect = GetClientArea(); 178 | if (child_content_ != nullptr) { 179 | // Size and position the child window. 180 | MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, 181 | rect.bottom - rect.top, TRUE); 182 | } 183 | return 0; 184 | } 185 | 186 | case WM_ACTIVATE: 187 | if (child_content_ != nullptr) { 188 | SetFocus(child_content_); 189 | } 190 | return 0; 191 | } 192 | 193 | return DefWindowProc(window_handle_, message, wparam, lparam); 194 | } 195 | 196 | void Win32Window::Destroy() { 197 | OnDestroy(); 198 | 199 | if (window_handle_) { 200 | DestroyWindow(window_handle_); 201 | window_handle_ = nullptr; 202 | } 203 | if (g_active_window_count == 0) { 204 | WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); 205 | } 206 | } 207 | 208 | Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { 209 | return reinterpret_cast( 210 | GetWindowLongPtr(window, GWLP_USERDATA)); 211 | } 212 | 213 | void Win32Window::SetChildContent(HWND content) { 214 | child_content_ = content; 215 | SetParent(content, window_handle_); 216 | RECT frame = GetClientArea(); 217 | 218 | MoveWindow(content, frame.left, frame.top, frame.right - frame.left, 219 | frame.bottom - frame.top, true); 220 | 221 | SetFocus(child_content_); 222 | } 223 | 224 | RECT Win32Window::GetClientArea() { 225 | RECT frame; 226 | GetClientRect(window_handle_, &frame); 227 | return frame; 228 | } 229 | 230 | HWND Win32Window::GetHandle() { 231 | return window_handle_; 232 | } 233 | 234 | void Win32Window::SetQuitOnClose(bool quit_on_close) { 235 | quit_on_close_ = quit_on_close; 236 | } 237 | 238 | bool Win32Window::OnCreate() { 239 | // No-op; provided for subclasses. 240 | return true; 241 | } 242 | 243 | void Win32Window::OnDestroy() { 244 | // No-op; provided for subclasses. 245 | } 246 | -------------------------------------------------------------------------------- /lib/screens/invoice_form/invoice_form.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'dart:math'; 3 | 4 | import 'package:gsheet/models/customer.dart'; 5 | import 'package:gsheet/models/product.dart'; 6 | import 'package:gsheet/providers/invoice_provider.dart'; 7 | import 'package:provider/provider.dart'; 8 | 9 | class InvoiceForm extends StatefulWidget { 10 | @override 11 | _InvoiceFormState createState() => _InvoiceFormState(); 12 | } 13 | 14 | class _InvoiceFormState extends State { 15 | final TextEditingController _quantityController = TextEditingController(); 16 | final TextEditingController _bonus_controller = TextEditingController(); 17 | final TextEditingController _typeController = TextEditingController(); 18 | final TextEditingController _invoiceNumberController = TextEditingController(); 19 | final _formKey = GlobalKey(); 20 | 21 | @override 22 | void initState() { 23 | super.initState(); 24 | WidgetsBinding.instance.addPostFrameCallback((_) { 25 | Provider.of(context, listen: false).loadInitialData(); 26 | }); 27 | _bonus_controller.text = '0'; 28 | } 29 | 30 | @override 31 | void dispose() { 32 | _quantityController.dispose(); 33 | _bonus_controller.dispose(); 34 | _typeController.dispose(); 35 | _invoiceNumberController.dispose(); 36 | super.dispose(); 37 | } 38 | 39 | @override 40 | Widget build(BuildContext context) { 41 | return Consumer( 42 | builder: (context, invoiceProvider, child) { 43 | if (invoiceProvider.error != null) { 44 | WidgetsBinding.instance.addPostFrameCallback((_) { 45 | ScaffoldMessenger.of(context).showSnackBar( 46 | SnackBar(content: Text(invoiceProvider.error!)), 47 | ); 48 | }); 49 | } 50 | 51 | if (invoiceProvider.isLoading) { 52 | return const Center(child: CircularProgressIndicator()); 53 | } 54 | 55 | if (invoiceProvider.isBusy) { 56 | return const Center(child: CircularProgressIndicator(valueColor: AlwaysStoppedAnimation(Colors.green),)); 57 | } 58 | 59 | if (invoiceProvider.selectedProduct != null) { 60 | _typeController.text = 61 | '${invoiceProvider.selectedProduct!.type} - ${invoiceProvider.selectedProduct!.packSize} | Price: ${invoiceProvider.selectedProduct!.unitPrice}'; 62 | } 63 | 64 | return SingleChildScrollView( 65 | padding: const EdgeInsets.all(16.0), 66 | child: Form( 67 | key: _formKey, 68 | child: Column( 69 | crossAxisAlignment: CrossAxisAlignment.start, 70 | children: [ 71 | DropdownButtonFormField( 72 | isExpanded: true, 73 | value: invoiceProvider.selectedCustomer, 74 | items: invoiceProvider.customers 75 | .map( 76 | (e) => DropdownMenuItem( 77 | child: Text(e.toString()), 78 | value: e, 79 | ), 80 | ) 81 | .toList(), 82 | onChanged: (value) { 83 | invoiceProvider.selectCustomer(value); 84 | }, 85 | decoration: 86 | const InputDecoration(labelText: 'Customer Name'), 87 | ), 88 | const SizedBox(height: 16), 89 | TextFormField( 90 | controller: _invoiceNumberController, 91 | decoration: const InputDecoration(labelText: 'Invoice No.'), 92 | keyboardType: TextInputType.number, 93 | validator: (value) { 94 | if (value!.isEmpty) return 'Invoice No. Can\'t be empty'; 95 | return null; 96 | }, 97 | onChanged: (value) { 98 | invoiceProvider.setInvoiceNumber(value); 99 | }, 100 | ), 101 | const SizedBox(height: 16), 102 | DropdownButtonFormField( 103 | value: invoiceProvider.selectedProduct, 104 | items: invoiceProvider.products 105 | .map( 106 | (e) => DropdownMenuItem( 107 | child: Text(e.name), 108 | value: e, 109 | ), 110 | ) 111 | .toList(), 112 | onChanged: (value) { 113 | invoiceProvider.selectProduct(value); 114 | }, 115 | decoration: 116 | const InputDecoration(labelText: 'Product Name'), 117 | ), 118 | const SizedBox(height: 16), 119 | TextFormField( 120 | controller: _typeController, 121 | readOnly: true, 122 | decoration: const InputDecoration(labelText: 'Type'), 123 | ), 124 | const SizedBox(height: 16), 125 | Row( 126 | children: [ 127 | Expanded( 128 | child: TextFormField( 129 | controller: _quantityController, 130 | decoration: 131 | const InputDecoration(labelText: 'Quantity'), 132 | keyboardType: TextInputType.number, 133 | validator: (value) { 134 | if (value!.isEmpty || int.tryParse(value) == null) 135 | return 'Please enter a valid quanitity'; 136 | return null; 137 | }, 138 | ), 139 | ), 140 | const SizedBox(width: 16), 141 | Expanded( 142 | child: TextFormField( 143 | controller: _bonus_controller, 144 | decoration: const InputDecoration(labelText: 'Bonus'), 145 | keyboardType: TextInputType.number, 146 | ), 147 | ), 148 | ], 149 | ), 150 | const SizedBox(height: 24), 151 | Center( 152 | child: ElevatedButton.icon( 153 | onPressed: () { 154 | if (_formKey.currentState!.validate() && 155 | invoiceProvider.selectedProduct != null) { 156 | invoiceProvider.addItem( 157 | int.parse(_quantityController.text), 158 | int.tryParse(_bonus_controller.text) ?? 0, 159 | ); 160 | _quantityController.clear(); 161 | _bonus_controller.clear(); 162 | _bonus_controller.text = '0'; 163 | FocusManager.instance.primaryFocus?.unfocus(); 164 | ScaffoldMessenger.of(context).showSnackBar( 165 | const SnackBar(content: Text('Item added'), duration: Duration(seconds: 1),), 166 | ); 167 | } 168 | }, 169 | icon: const Icon(Icons.add), 170 | label: const Text('Add Item'), 171 | style: ElevatedButton.styleFrom( 172 | padding: const EdgeInsets.symmetric(horizontal: 32, vertical: 12), 173 | textStyle: const TextStyle(fontSize: 16) 174 | ), 175 | ), 176 | ), 177 | const SizedBox(height: 24), 178 | if (invoiceProvider.invoiceItems.isNotEmpty) ...[ 179 | Text('Invoice Items', style: Theme.of(context).textTheme.headline6), 180 | const Divider(), 181 | ListView.builder( 182 | shrinkWrap: true, 183 | physics: const NeverScrollableScrollPhysics(), 184 | itemCount: invoiceProvider.invoiceItems.length, 185 | itemBuilder: (context, index) { 186 | final item = invoiceProvider.invoiceItems[index]; 187 | return Card( 188 | margin: const EdgeInsets.symmetric(vertical: 4), 189 | child: ListTile( 190 | leading: CircleAvatar( 191 | child: Text(item.quantity.toString()), 192 | ), 193 | title: Text(item.product.name), 194 | subtitle: Text('Price: ${item.product.unitPrice.toStringAsFixed(2)}'), 195 | trailing: IconButton( 196 | icon: const Icon(Icons.delete, color: Colors.red), 197 | onPressed: () { 198 | invoiceProvider.removeItem(index); 199 | ScaffoldMessenger.of(context).showSnackBar( 200 | const SnackBar(content: Text('Item Deleted'), duration: Duration(seconds: 1)), 201 | ); 202 | }, 203 | ), 204 | ), 205 | ); 206 | }, 207 | ), 208 | const Divider(), 209 | const SizedBox(height: 16), 210 | Card( 211 | child: Padding( 212 | padding: const EdgeInsets.all(16.0), 213 | child: Column( 214 | crossAxisAlignment: CrossAxisAlignment.stretch, 215 | children: [ 216 | _buildTotalRow('Subtotal:', invoiceProvider.subtotal), 217 | _buildTotalRow('VAT (15%):', invoiceProvider.tax), 218 | const Divider(), 219 | _buildTotalRow('Total Payable:', invoiceProvider.total, isTotal: true), 220 | ], 221 | ), 222 | ), 223 | ), 224 | const SizedBox(height: 24), 225 | Center( 226 | child: TextButton.icon( 227 | onPressed: (){ 228 | invoiceProvider.clearForm(); 229 | _invoiceNumberController.clear(); 230 | }, 231 | icon: const Icon(Icons.add_circle_outline), 232 | label: const Text('New Invoice'), 233 | ), 234 | ) 235 | ] 236 | ], 237 | ), 238 | ), 239 | ); 240 | }, 241 | ); 242 | } 243 | 244 | Widget _buildTotalRow(String label, double value, {bool isTotal = false}) { 245 | return Padding( 246 | padding: const EdgeInsets.symmetric(vertical: 4.0), 247 | child: Row( 248 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 249 | children: [ 250 | Text( 251 | label, 252 | style: TextStyle( 253 | fontSize: isTotal ? 18 : 16, 254 | fontWeight: isTotal ? FontWeight.bold : FontWeight.normal, 255 | ), 256 | ), 257 | Text( 258 | '${value.toStringAsFixed(2)} TK', 259 | style: TextStyle( 260 | fontSize: isTotal ? 18 : 16, 261 | fontWeight: isTotal ? FontWeight.bold : FontWeight.normal, 262 | ), 263 | ), 264 | ], 265 | ), 266 | ); 267 | } 268 | } 269 | -------------------------------------------------------------------------------- /lib/screens/past.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'dart:convert'; 3 | 4 | import 'package:http/http.dart' as http; 5 | import 'package:cloud_firestore/cloud_firestore.dart'; 6 | import 'package:intl/intl.dart'; 7 | 8 | import '../pdf.dart'; 9 | import './snackbar.dart'; 10 | 11 | class PastOrders extends StatefulWidget { 12 | PastOrders({ 13 | required this.signURL, 14 | }); 15 | static const routeName = '/past'; 16 | 17 | final String signURL; 18 | 19 | @override 20 | State createState() => _PastOrdersState(); 21 | } 22 | 23 | class _PastOrdersState extends State { 24 | final db = FirebaseFirestore.instance; 25 | final DateTime date = DateTime.now(); 26 | 27 | void setErrorBuilder() { 28 | ErrorWidget.builder = (FlutterErrorDetails errorDetails) { 29 | return Scaffold( 30 | body: Center( 31 | child: Container( 32 | height: 5000, 33 | child: SingleChildScrollView( 34 | child: Column( 35 | children: [ 36 | // Text(errorDetails.stack.toString()), 37 | Text(errorDetails.summary.toString()), 38 | // Text(errorDetails.toString()), 39 | ], 40 | ), 41 | ), 42 | ))); 43 | }; 44 | } 45 | 46 | List paths = []; 47 | Future getData() async { 48 | final url = Uri.parse( 49 | 'https://invoice-maker-283c8-default-rtdb.asia-southeast1.firebasedatabase.app/past-order.json'); 50 | final res = await http.get(url); 51 | 52 | var link = json.decode(res.body); 53 | link.entries.forEach((element) { 54 | paths.add((element.value['path'])); 55 | }); 56 | return true; 57 | } 58 | 59 | var myF; 60 | @override 61 | void initState() { 62 | setErrorBuilder(); 63 | myF = getData(); 64 | super.initState(); 65 | } 66 | 67 | String decodeText(String x) { 68 | String decoded = utf8.decode(base64.decode(x)); 69 | return decoded; 70 | } 71 | 72 | @override 73 | Widget build(BuildContext context) { 74 | return Scaffold( 75 | appBar: AppBar( 76 | title: Text('Past Invoices'), 77 | ), 78 | body: FutureBuilder( 79 | future: myF, 80 | builder: (context, snapshot) => 81 | snapshot.connectionState == ConnectionState.waiting 82 | ? Center( 83 | child: CircularProgressIndicator(), 84 | ) 85 | : Padding( 86 | padding: const EdgeInsets.all(8.0), 87 | child: SingleChildScrollView( 88 | child: Column(children: [ 89 | for (int i = 0; i < paths.length; i++) ...[ 90 | Orders( 91 | signURL: widget.signURL, 92 | paths: paths, 93 | i: i, 94 | ) 95 | ], 96 | ]), 97 | ), 98 | ), 99 | )); 100 | } 101 | } 102 | 103 | class Orders extends StatefulWidget { 104 | Orders({required this.signURL, required this.paths, required this.i}); 105 | final List paths; 106 | final int i; 107 | final signURL; 108 | @override 109 | State createState() => _OrdersState(); 110 | } 111 | 112 | class _OrdersState extends State { 113 | final db = FirebaseFirestore.instance; 114 | final DateTime date = DateTime.now(); 115 | var datas; 116 | List> invoiceP = []; 117 | 118 | void setErrorBuilder() { 119 | ErrorWidget.builder = (FlutterErrorDetails errorDetails) { 120 | return Scaffold( 121 | body: Center( 122 | child: Container( 123 | height: 5000, 124 | child: SingleChildScrollView( 125 | child: Column( 126 | children: [ 127 | // Text(errorDetails.stack.toString()), 128 | // Text(errorDetails.summary.toString()), 129 | Text(errorDetails.toString()), 130 | ], 131 | ), 132 | ), 133 | ))); 134 | }; 135 | } 136 | 137 | String decodeText(String x) { 138 | String decoded = utf8.decode(base64.decode(x)); 139 | return decoded; 140 | } 141 | 142 | Future dataLoader() async { 143 | print('Data loader running'); 144 | datas = await db.collection(widget.paths[widget.i]).get(); 145 | for (int i = 0; i < datas.docs.length; i++) { 146 | var d = datas.docs[i]; 147 | final Map e = { 148 | 'name': d["name"], 149 | 'quantity': d["quantity"], 150 | 'type': d["type"], 151 | 'bonus': d["bonus"], 152 | 'price': d["price"], 153 | 'pack': d["pack"] 154 | }; 155 | invoiceP.add(e); 156 | } 157 | return true; 158 | } 159 | 160 | var myF; 161 | @override 162 | void initState() { 163 | setErrorBuilder(); 164 | myF = dataLoader(); 165 | super.initState(); 166 | } 167 | 168 | String getDate(String p) { 169 | DateTime data = DateTime.parse(p); 170 | var formatted = DateFormat.MMMd().format(data); 171 | return formatted; 172 | } 173 | 174 | bool expanded = false; 175 | @override 176 | Widget build(BuildContext context) { 177 | return FutureBuilder( 178 | future: myF, 179 | builder: (context, snapshot) { 180 | if (snapshot.connectionState == ConnectionState.waiting) { 181 | return AnimatedContainer( 182 | color: Colors.brown.shade200, 183 | width: double.infinity, 184 | alignment: Alignment.center, 185 | duration: Duration(milliseconds: 200), 186 | margin: EdgeInsets.symmetric(horizontal: 20, vertical: 10), 187 | padding: EdgeInsets.all(10), 188 | child: Text( 189 | 'Loading...', 190 | style: TextStyle(fontSize: 12, fontWeight: FontWeight.bold), 191 | textAlign: TextAlign.center, 192 | ), 193 | ); 194 | } else 195 | return AnimatedContainer( 196 | duration: Duration(milliseconds: 200), 197 | padding: EdgeInsets.all(10), 198 | child: Column( 199 | children: [ 200 | Card( 201 | color: Colors.brown.shade200, 202 | child: GestureDetector( 203 | onTap: () { 204 | setState(() { 205 | expanded = !expanded; 206 | }); 207 | }, 208 | child: ListTile( 209 | style: ListTileStyle.drawer, 210 | leading: Column( 211 | mainAxisAlignment: MainAxisAlignment.center, 212 | children: [ 213 | Text( 214 | 'H${decodeText(widget.paths[widget.i]).split('|')[0]}', 215 | style: TextStyle( 216 | fontSize: 12, fontWeight: FontWeight.bold), 217 | textAlign: TextAlign.center, 218 | ), 219 | Text( 220 | getDate(decodeText(widget.paths[widget.i]) 221 | .split('|')[2]), 222 | style: TextStyle( 223 | fontSize: 12, fontWeight: FontWeight.bold), 224 | textAlign: TextAlign.center, 225 | ), 226 | ], 227 | ), 228 | title: Text( 229 | '${decodeText(widget.paths[widget.i]).split('|')[1].split('-')[0]}', 230 | style: TextStyle(fontSize: 14), 231 | textAlign: TextAlign.center, 232 | ), 233 | trailing: AnimatedContainer( 234 | duration: Duration(milliseconds: 200), 235 | width: 100, 236 | child: Row( 237 | children: [ 238 | IconButton( 239 | onPressed: () { 240 | pdf.doIt( 241 | context, 242 | decodeText(widget.paths[widget.i]) 243 | .split('|')[1] 244 | .split('-')[0], 245 | decodeText(widget.paths[widget.i]) 246 | .split('|')[1] 247 | .split('-')[1], 248 | invoiceP, 249 | true, 250 | decodeText(widget.paths[widget.i]) 251 | .split('|')[0], 252 | widget.signURL); 253 | }, 254 | icon: const Icon(Icons.picture_as_pdf)), 255 | IconButton( 256 | onPressed: () { 257 | pdf.doIt( 258 | context, 259 | decodeText(widget.paths[widget.i]) 260 | .split('|')[1] 261 | .split('-')[0], 262 | decodeText(widget.paths[widget.i]) 263 | .split('|')[1] 264 | .split('-')[1], 265 | invoiceP, 266 | false, 267 | decodeText(widget.paths[widget.i]) 268 | .split('|')[0], 269 | widget.signURL); 270 | }, 271 | icon: const Icon(Icons.share)), 272 | ], 273 | ), 274 | ), 275 | ), 276 | ), 277 | ), 278 | AnimatedContainer( 279 | // decoration: expanded 280 | // ? BoxDecoration( 281 | // border: Border.all(color: Colors.grey, width: 1)) 282 | // : null, 283 | duration: Duration(milliseconds: 200), 284 | height: expanded ? datas.docs.length * 50.00 : 0, 285 | child: ListView.builder( 286 | physics: NeverScrollableScrollPhysics(), 287 | shrinkWrap: true, 288 | itemCount: datas.docs.length, 289 | itemBuilder: (context, index) { 290 | return Card( 291 | child: ListTile( 292 | style: ListTileStyle.drawer, 293 | visualDensity: 294 | VisualDensity(horizontal: 0, vertical: -4), 295 | title: Text(datas.docs[index]["name"]), 296 | leading: CircleAvatar( 297 | radius: 15, 298 | child: Text(datas.docs[index]["quantity"])), 299 | ), 300 | ); 301 | }, 302 | )) 303 | ], 304 | )); 305 | }); 306 | } 307 | } 308 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | _flutterfire_internals: 5 | dependency: transitive 6 | description: 7 | name: _flutterfire_internals 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "1.1.0" 11 | archive: 12 | dependency: transitive 13 | description: 14 | name: archive 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "3.3.5" 18 | args: 19 | dependency: transitive 20 | description: 21 | name: args 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "2.3.1" 25 | async: 26 | dependency: transitive 27 | description: 28 | name: async 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "2.9.0" 32 | barcode: 33 | dependency: transitive 34 | description: 35 | name: barcode 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "2.2.3" 39 | boolean_selector: 40 | dependency: transitive 41 | description: 42 | name: boolean_selector 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "2.1.0" 46 | characters: 47 | dependency: transitive 48 | description: 49 | name: characters 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "1.2.1" 53 | checked_yaml: 54 | dependency: transitive 55 | description: 56 | name: checked_yaml 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "2.0.2" 60 | cli_util: 61 | dependency: transitive 62 | description: 63 | name: cli_util 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "0.3.5" 67 | clock: 68 | dependency: transitive 69 | description: 70 | name: clock 71 | url: "https://pub.dartlang.org" 72 | source: hosted 73 | version: "1.1.1" 74 | cloud_firestore: 75 | dependency: "direct main" 76 | description: 77 | name: cloud_firestore 78 | url: "https://pub.dartlang.org" 79 | source: hosted 80 | version: "4.5.0" 81 | cloud_firestore_platform_interface: 82 | dependency: transitive 83 | description: 84 | name: cloud_firestore_platform_interface 85 | url: "https://pub.dartlang.org" 86 | source: hosted 87 | version: "5.12.0" 88 | cloud_firestore_web: 89 | dependency: transitive 90 | description: 91 | name: cloud_firestore_web 92 | url: "https://pub.dartlang.org" 93 | source: hosted 94 | version: "3.4.0" 95 | collection: 96 | dependency: transitive 97 | description: 98 | name: collection 99 | url: "https://pub.dartlang.org" 100 | source: hosted 101 | version: "1.16.0" 102 | convert: 103 | dependency: transitive 104 | description: 105 | name: convert 106 | url: "https://pub.dartlang.org" 107 | source: hosted 108 | version: "3.1.1" 109 | crypto: 110 | dependency: transitive 111 | description: 112 | name: crypto 113 | url: "https://pub.dartlang.org" 114 | source: hosted 115 | version: "3.0.2" 116 | cupertino_icons: 117 | dependency: "direct main" 118 | description: 119 | name: cupertino_icons 120 | url: "https://pub.dartlang.org" 121 | source: hosted 122 | version: "1.0.5" 123 | fake_async: 124 | dependency: transitive 125 | description: 126 | name: fake_async 127 | url: "https://pub.dartlang.org" 128 | source: hosted 129 | version: "1.3.1" 130 | ffi: 131 | dependency: transitive 132 | description: 133 | name: ffi 134 | url: "https://pub.dartlang.org" 135 | source: hosted 136 | version: "2.0.1" 137 | file: 138 | dependency: transitive 139 | description: 140 | name: file 141 | url: "https://pub.dartlang.org" 142 | source: hosted 143 | version: "6.1.4" 144 | firebase_auth: 145 | dependency: "direct main" 146 | description: 147 | name: firebase_auth 148 | url: "https://pub.dartlang.org" 149 | source: hosted 150 | version: "4.4.0" 151 | firebase_auth_platform_interface: 152 | dependency: transitive 153 | description: 154 | name: firebase_auth_platform_interface 155 | url: "https://pub.dartlang.org" 156 | source: hosted 157 | version: "6.13.0" 158 | firebase_auth_web: 159 | dependency: transitive 160 | description: 161 | name: firebase_auth_web 162 | url: "https://pub.dartlang.org" 163 | source: hosted 164 | version: "5.3.0" 165 | firebase_core: 166 | dependency: "direct main" 167 | description: 168 | name: firebase_core 169 | url: "https://pub.dartlang.org" 170 | source: hosted 171 | version: "2.9.0" 172 | firebase_core_platform_interface: 173 | dependency: transitive 174 | description: 175 | name: firebase_core_platform_interface 176 | url: "https://pub.dartlang.org" 177 | source: hosted 178 | version: "4.6.0" 179 | firebase_core_web: 180 | dependency: transitive 181 | description: 182 | name: firebase_core_web 183 | url: "https://pub.dartlang.org" 184 | source: hosted 185 | version: "2.3.0" 186 | firebase_database: 187 | dependency: "direct main" 188 | description: 189 | name: firebase_database 190 | url: "https://pub.dartlang.org" 191 | source: hosted 192 | version: "10.1.0" 193 | firebase_database_platform_interface: 194 | dependency: transitive 195 | description: 196 | name: firebase_database_platform_interface 197 | url: "https://pub.dartlang.org" 198 | source: hosted 199 | version: "0.2.3" 200 | firebase_database_web: 201 | dependency: transitive 202 | description: 203 | name: firebase_database_web 204 | url: "https://pub.dartlang.org" 205 | source: hosted 206 | version: "0.2.2" 207 | flutter: 208 | dependency: "direct main" 209 | description: flutter 210 | source: sdk 211 | version: "0.0.0" 212 | flutter_launcher_icons: 213 | dependency: "direct dev" 214 | description: 215 | name: flutter_launcher_icons 216 | url: "https://pub.dartlang.org" 217 | source: hosted 218 | version: "0.11.0" 219 | flutter_test: 220 | dependency: "direct dev" 221 | description: flutter 222 | source: sdk 223 | version: "0.0.0" 224 | flutter_web_plugins: 225 | dependency: transitive 226 | description: flutter 227 | source: sdk 228 | version: "0.0.0" 229 | http: 230 | dependency: "direct main" 231 | description: 232 | name: http 233 | url: "https://pub.dartlang.org" 234 | source: hosted 235 | version: "0.13.5" 236 | http_parser: 237 | dependency: transitive 238 | description: 239 | name: http_parser 240 | url: "https://pub.dartlang.org" 241 | source: hosted 242 | version: "4.0.2" 243 | image: 244 | dependency: transitive 245 | description: 246 | name: image 247 | url: "https://pub.dartlang.org" 248 | source: hosted 249 | version: "3.3.0" 250 | intl: 251 | dependency: "direct main" 252 | description: 253 | name: intl 254 | url: "https://pub.dartlang.org" 255 | source: hosted 256 | version: "0.17.0" 257 | js: 258 | dependency: transitive 259 | description: 260 | name: js 261 | url: "https://pub.dartlang.org" 262 | source: hosted 263 | version: "0.6.4" 264 | json_annotation: 265 | dependency: transitive 266 | description: 267 | name: json_annotation 268 | url: "https://pub.dartlang.org" 269 | source: hosted 270 | version: "4.7.0" 271 | matcher: 272 | dependency: transitive 273 | description: 274 | name: matcher 275 | url: "https://pub.dartlang.org" 276 | source: hosted 277 | version: "0.12.12" 278 | material_color_utilities: 279 | dependency: transitive 280 | description: 281 | name: material_color_utilities 282 | url: "https://pub.dartlang.org" 283 | source: hosted 284 | version: "0.2.0" 285 | meta: 286 | dependency: transitive 287 | description: 288 | name: meta 289 | url: "https://pub.dartlang.org" 290 | source: hosted 291 | version: "1.8.0" 292 | nested: 293 | dependency: transitive 294 | description: 295 | name: nested 296 | url: "https://pub.dartlang.org" 297 | source: hosted 298 | version: "1.0.0" 299 | number_to_character: 300 | dependency: "direct main" 301 | description: 302 | name: number_to_character 303 | url: "https://pub.dartlang.org" 304 | source: hosted 305 | version: "0.0.12" 306 | path: 307 | dependency: "direct main" 308 | description: 309 | name: path 310 | url: "https://pub.dartlang.org" 311 | source: hosted 312 | version: "1.8.2" 313 | path_parsing: 314 | dependency: transitive 315 | description: 316 | name: path_parsing 317 | url: "https://pub.dartlang.org" 318 | source: hosted 319 | version: "1.0.1" 320 | path_provider: 321 | dependency: "direct main" 322 | description: 323 | name: path_provider 324 | url: "https://pub.dartlang.org" 325 | source: hosted 326 | version: "2.0.11" 327 | path_provider_android: 328 | dependency: transitive 329 | description: 330 | name: path_provider_android 331 | url: "https://pub.dartlang.org" 332 | source: hosted 333 | version: "2.0.22" 334 | path_provider_ios: 335 | dependency: transitive 336 | description: 337 | name: path_provider_ios 338 | url: "https://pub.dartlang.org" 339 | source: hosted 340 | version: "2.0.11" 341 | path_provider_linux: 342 | dependency: transitive 343 | description: 344 | name: path_provider_linux 345 | url: "https://pub.dartlang.org" 346 | source: hosted 347 | version: "2.1.7" 348 | path_provider_macos: 349 | dependency: transitive 350 | description: 351 | name: path_provider_macos 352 | url: "https://pub.dartlang.org" 353 | source: hosted 354 | version: "2.0.7" 355 | path_provider_platform_interface: 356 | dependency: transitive 357 | description: 358 | name: path_provider_platform_interface 359 | url: "https://pub.dartlang.org" 360 | source: hosted 361 | version: "2.0.5" 362 | path_provider_windows: 363 | dependency: transitive 364 | description: 365 | name: path_provider_windows 366 | url: "https://pub.dartlang.org" 367 | source: hosted 368 | version: "2.1.3" 369 | pdf: 370 | dependency: "direct main" 371 | description: 372 | name: pdf 373 | url: "https://pub.dartlang.org" 374 | source: hosted 375 | version: "3.8.4" 376 | petitparser: 377 | dependency: transitive 378 | description: 379 | name: petitparser 380 | url: "https://pub.dartlang.org" 381 | source: hosted 382 | version: "5.1.0" 383 | platform: 384 | dependency: transitive 385 | description: 386 | name: platform 387 | url: "https://pub.dartlang.org" 388 | source: hosted 389 | version: "3.1.0" 390 | plugin_platform_interface: 391 | dependency: transitive 392 | description: 393 | name: plugin_platform_interface 394 | url: "https://pub.dartlang.org" 395 | source: hosted 396 | version: "2.1.3" 397 | pointycastle: 398 | dependency: transitive 399 | description: 400 | name: pointycastle 401 | url: "https://pub.dartlang.org" 402 | source: hosted 403 | version: "3.6.2" 404 | printing: 405 | dependency: "direct main" 406 | description: 407 | name: printing 408 | url: "https://pub.dartlang.org" 409 | source: hosted 410 | version: "5.9.3" 411 | process: 412 | dependency: transitive 413 | description: 414 | name: process 415 | url: "https://pub.dartlang.org" 416 | source: hosted 417 | version: "4.2.4" 418 | provider: 419 | dependency: "direct main" 420 | description: 421 | name: provider 422 | url: "https://pub.dartlang.org" 423 | source: hosted 424 | version: "6.0.5" 425 | qr: 426 | dependency: transitive 427 | description: 428 | name: qr 429 | url: "https://pub.dartlang.org" 430 | source: hosted 431 | version: "3.0.1" 432 | sky_engine: 433 | dependency: transitive 434 | description: flutter 435 | source: sdk 436 | version: "0.0.99" 437 | source_span: 438 | dependency: transitive 439 | description: 440 | name: source_span 441 | url: "https://pub.dartlang.org" 442 | source: hosted 443 | version: "1.9.1" 444 | stack_trace: 445 | dependency: transitive 446 | description: 447 | name: stack_trace 448 | url: "https://pub.dartlang.org" 449 | source: hosted 450 | version: "1.10.0" 451 | stream_channel: 452 | dependency: transitive 453 | description: 454 | name: stream_channel 455 | url: "https://pub.dartlang.org" 456 | source: hosted 457 | version: "2.1.0" 458 | string_scanner: 459 | dependency: transitive 460 | description: 461 | name: string_scanner 462 | url: "https://pub.dartlang.org" 463 | source: hosted 464 | version: "1.1.1" 465 | term_glyph: 466 | dependency: transitive 467 | description: 468 | name: term_glyph 469 | url: "https://pub.dartlang.org" 470 | source: hosted 471 | version: "1.2.1" 472 | test_api: 473 | dependency: transitive 474 | description: 475 | name: test_api 476 | url: "https://pub.dartlang.org" 477 | source: hosted 478 | version: "0.4.13" 479 | typed_data: 480 | dependency: transitive 481 | description: 482 | name: typed_data 483 | url: "https://pub.dartlang.org" 484 | source: hosted 485 | version: "1.3.1" 486 | vector_math: 487 | dependency: transitive 488 | description: 489 | name: vector_math 490 | url: "https://pub.dartlang.org" 491 | source: hosted 492 | version: "2.1.3" 493 | win32: 494 | dependency: transitive 495 | description: 496 | name: win32 497 | url: "https://pub.dartlang.org" 498 | source: hosted 499 | version: "3.1.3" 500 | xdg_directories: 501 | dependency: transitive 502 | description: 503 | name: xdg_directories 504 | url: "https://pub.dartlang.org" 505 | source: hosted 506 | version: "0.2.0+3" 507 | xml: 508 | dependency: transitive 509 | description: 510 | name: xml 511 | url: "https://pub.dartlang.org" 512 | source: hosted 513 | version: "6.1.0" 514 | yaml: 515 | dependency: transitive 516 | description: 517 | name: yaml 518 | url: "https://pub.dartlang.org" 519 | source: hosted 520 | version: "3.1.1" 521 | sdks: 522 | dart: ">=2.18.6 <3.0.0" 523 | flutter: ">=3.0.0" 524 | -------------------------------------------------------------------------------- /lib/screens/manageProducts.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'dart:convert'; 3 | 4 | import 'package:http/http.dart' as http; 5 | 6 | import './snackbar.dart'; 7 | 8 | class ManageProducts extends StatefulWidget { 9 | const ManageProducts({super.key}); 10 | 11 | @override 12 | State createState() => _ManageProductsState(); 13 | } 14 | 15 | class _ManageProductsState extends State { 16 | List datas = []; 17 | 18 | Future getData() async { 19 | final url = Uri.parse( 20 | 'https://invoice-maker-283c8-default-rtdb.asia-southeast1.firebasedatabase.app/Products.json'); 21 | var res = await http.get(url); 22 | datas = json.decode(res.body); 23 | ; 24 | return true; 25 | } 26 | 27 | void deleteItem(int i, String index) { 28 | BuildContext dialogContext = context; 29 | showDialog( 30 | context: context, 31 | builder: (context) { 32 | dialogContext = context; 33 | return AlertDialog( 34 | content: Text('Are you sure want to delete the item?'), 35 | actions: [ 36 | TextButton( 37 | onPressed: () { 38 | Navigator.of(context).pop(false); 39 | }, 40 | child: Text('No')), 41 | TextButton( 42 | onPressed: () async { 43 | try { 44 | final url = Uri.parse( 45 | 'https://invoice-maker-283c8-default-rtdb.asia-southeast1.firebasedatabase.app/Products/${index}.json'); 46 | var res = await http.delete(url); 47 | if (res.statusCode == 200) { 48 | SnackbarGlobal.show('Item Deleted'); 49 | 50 | Navigator.of(context).pop(true); 51 | setState(() { 52 | datas.removeWhere( 53 | (element) => element['index'] == index); 54 | }); 55 | } 56 | } catch (e) { 57 | SnackbarGlobal.show('Something went wrong'); 58 | } 59 | }, 60 | child: Text('Yes')), 61 | ], 62 | ); 63 | }).then((value) { 64 | if (value == null) 65 | return; 66 | else if (value) Navigator.of(dialogContext).pop(true); 67 | }); 68 | } 69 | 70 | void updateData(int i) async { 71 | TextEditingController name = TextEditingController(); 72 | TextEditingController size = TextEditingController(); 73 | TextEditingController price = TextEditingController(); 74 | TextEditingController type = TextEditingController(); 75 | 76 | name.text = datas[i]["Product Name"]; 77 | size.text = datas[i]["Pack size"]; 78 | price.text = datas[i]["Unit Price"].toString(); 79 | type.text = datas[i]["Type"]; 80 | 81 | showDialog( 82 | context: context, 83 | builder: (context) => AlertDialog( 84 | title: Row( 85 | children: [ 86 | Text('Update Information'), 87 | SizedBox( 88 | width: 40, 89 | ), 90 | IconButton( 91 | onPressed: () { 92 | deleteItem(i, datas[i]['index']); 93 | }, 94 | icon: Icon(Icons.delete)) 95 | ], 96 | ), 97 | content: AnimatedContainer( 98 | duration: Duration(milliseconds: 200), 99 | height: 250, 100 | child: Column( 101 | children: [ 102 | TextField( 103 | decoration: InputDecoration( 104 | labelText: 'Product Name', 105 | ), 106 | controller: name, 107 | onChanged: (value) { 108 | name.text = value; 109 | name.selection = 110 | TextSelection.collapsed(offset: name.text.length); 111 | }, 112 | ), 113 | DropdownButtonFormField( 114 | value: type.text, 115 | decoration: InputDecoration(labelText: 'Type'), 116 | items: [ 117 | 'Unselected', 118 | 'Tablet', 119 | 'Suspention', 120 | 'Syrup', 121 | 'PFS', 122 | 'Capsul', 123 | ].map>((String value) { 124 | return DropdownMenuItem( 125 | value: value, 126 | child: Text( 127 | value, 128 | ), 129 | ); 130 | }).toList(), 131 | onChanged: (String? newValue) { 132 | setState(() { 133 | type.text = newValue!; 134 | }); 135 | }, 136 | ), 137 | TextField( 138 | decoration: InputDecoration(labelText: 'Pack Size'), 139 | controller: size, 140 | onChanged: (value) { 141 | size.text = value; 142 | size.selection = 143 | TextSelection.collapsed(offset: size.text.length); 144 | }, 145 | ), 146 | TextField( 147 | decoration: InputDecoration(labelText: 'Unit Price'), 148 | controller: price, 149 | onChanged: (value) { 150 | price.text = value; 151 | price.selection = 152 | TextSelection.collapsed(offset: price.text.length); 153 | }, 154 | ), 155 | ], 156 | ), 157 | ), 158 | actions: [ 159 | TextButton( 160 | onPressed: () { 161 | Navigator.of(context).pop(); 162 | }, 163 | child: Text('Cancel')), 164 | TextButton( 165 | onPressed: () async { 166 | FocusManager.instance.primaryFocus?.unfocus(); 167 | try { 168 | final url = Uri.parse( 169 | 'https://invoice-maker-283c8-default-rtdb.asia-southeast1.firebasedatabase.app/Products.json'); 170 | var res = await http.patch(url, 171 | body: json.encode({ 172 | i.toString(): { 173 | 'Product Name': name.text, 174 | 'Type': type.text, 175 | 'Pack size': size.text, 176 | 'Unit Price': price.text 177 | } 178 | })); 179 | if (res.statusCode == 200) { 180 | SnackbarGlobal.show('Information Updated'); 181 | 182 | Navigator.of(context).pop(); 183 | } 184 | } catch (e) { 185 | { 186 | SnackbarGlobal.show('Something went wrong'); 187 | } 188 | } 189 | }, 190 | child: Text('Update')), 191 | ], 192 | )); 193 | } 194 | 195 | void addProduct(BuildContext context) async { 196 | TextEditingController name = TextEditingController(); 197 | TextEditingController size = TextEditingController(); 198 | TextEditingController price = TextEditingController(); 199 | TextEditingController type = TextEditingController(); 200 | 201 | type.text = 'Unselected'; 202 | int target = datas.length; 203 | final url = Uri.parse( 204 | 'https://invoice-maker-283c8-default-rtdb.asia-southeast1.firebasedatabase.app/Products.json'); 205 | var res = await http.get(url); 206 | target = json.decode(res.body).length; 207 | print('target $target'); 208 | showDialog( 209 | context: context, 210 | builder: (context) => AlertDialog( 211 | title: Text('Add new product'), 212 | content: AnimatedContainer( 213 | duration: Duration(milliseconds: 200), 214 | height: 250, 215 | child: Column( 216 | children: [ 217 | TextField( 218 | decoration: InputDecoration( 219 | labelText: 'Product Name', 220 | ), 221 | controller: name, 222 | onChanged: (value) { 223 | name.text = value; 224 | name.selection = 225 | TextSelection.collapsed(offset: name.text.length); 226 | }, 227 | ), 228 | DropdownButtonFormField( 229 | validator: (value) { 230 | if (value!.isEmpty) { 231 | return 'Can\'t be empty'; 232 | } 233 | }, 234 | value: 'Unselected', 235 | decoration: InputDecoration(labelText: 'Type'), 236 | items: [ 237 | 'Unselected', 238 | 'Tablet', 239 | 'Suspention', 240 | 'Syrup', 241 | 'PFS', 242 | 'Capsul', 243 | ].map>((String value) { 244 | return DropdownMenuItem( 245 | value: value, 246 | child: Text( 247 | value, 248 | ), 249 | ); 250 | }).toList(), 251 | onChanged: (String? newValue) { 252 | setState(() { 253 | type.text = newValue!; 254 | }); 255 | }, 256 | ), 257 | TextField( 258 | decoration: InputDecoration(labelText: 'Pack Size'), 259 | controller: size, 260 | onChanged: (value) { 261 | size.text = value; 262 | size.selection = 263 | TextSelection.collapsed(offset: size.text.length); 264 | }, 265 | ), 266 | TextField( 267 | decoration: InputDecoration(labelText: 'Unit Price'), 268 | controller: price, 269 | onChanged: (value) { 270 | price.text = value; 271 | price.selection = 272 | TextSelection.collapsed(offset: price.text.length); 273 | }, 274 | ), 275 | ], 276 | ), 277 | ), 278 | actions: [ 279 | TextButton( 280 | onPressed: () { 281 | Navigator.of(context).pop(); 282 | }, 283 | child: Text('Cancel')), 284 | TextButton( 285 | onPressed: () async { 286 | FocusManager.instance.primaryFocus?.unfocus(); 287 | try { 288 | final addedP = { 289 | 'Product Name': name.text, 290 | 'Type': type.text, 291 | 'Pack size': size.text, 292 | 'Unit Price': price.text, 293 | 'index': target.toString() 294 | }; 295 | final url = Uri.parse( 296 | 'https://invoice-maker-283c8-default-rtdb.asia-southeast1.firebasedatabase.app/Products/${target}.json'); 297 | var res = 298 | await http.put(url, body: json.encode(addedP)); 299 | if (res.statusCode == 200) { 300 | SnackbarGlobal.show('Product Added'); 301 | Navigator.of(context).pop(); 302 | 303 | setState(() { 304 | datas.add(addedP); 305 | }); 306 | } 307 | } catch (e) { 308 | { 309 | SnackbarGlobal.show('Something went wrong'); 310 | } 311 | } 312 | }, 313 | child: Text('Add')), 314 | ], 315 | )); 316 | } 317 | 318 | var myF; 319 | @override 320 | void initState() { 321 | myF = getData(); 322 | super.initState(); 323 | } 324 | 325 | @override 326 | Widget build(BuildContext context) { 327 | return Scaffold( 328 | appBar: AppBar( 329 | title: Text('Manage Products'), 330 | actions: [ 331 | IconButton( 332 | onPressed: () { 333 | addProduct(context); 334 | }, 335 | icon: Icon(Icons.add)) 336 | ], 337 | ), 338 | body: FutureBuilder( 339 | future: myF, 340 | builder: (context, snapshot) => snapshot.connectionState == 341 | ConnectionState.waiting 342 | ? Center( 343 | child: CircularProgressIndicator(), 344 | ) 345 | : ListView.builder( 346 | itemCount: datas.length, 347 | itemBuilder: (context, i) => AnimatedContainer( 348 | duration: Duration(milliseconds: 200), 349 | decoration: BoxDecoration( 350 | borderRadius: BorderRadius.circular(8), 351 | color: Colors.grey, 352 | ), 353 | alignment: Alignment.center, 354 | margin: datas[i] == null 355 | ? null 356 | : EdgeInsets.symmetric(horizontal: 20, vertical: 10), 357 | width: double.infinity, 358 | child: i == 0 || datas[i] == null 359 | ? null 360 | : ListTile( 361 | visualDensity: 362 | VisualDensity(horizontal: 0, vertical: -4), 363 | style: ListTileStyle.drawer, 364 | title: Text(datas[i]["Product Name"].toString()), 365 | subtitle: Text(datas[i]["Type"].toString()), 366 | trailing: AnimatedContainer( 367 | duration: Duration(milliseconds: 200), 368 | width: 120, 369 | child: Row( 370 | mainAxisAlignment: 371 | MainAxisAlignment.spaceBetween, 372 | children: [ 373 | Text( 374 | '${datas[i]["Unit Price"].toString()} TK'), 375 | IconButton( 376 | onPressed: () { 377 | updateData(i); 378 | print( 379 | 'Pressed of ${datas[i]["Product Name"].toString()}'); 380 | }, 381 | icon: Icon(Icons.edit)) 382 | ], 383 | ), 384 | ), 385 | leading: AnimatedContainer( 386 | duration: Duration(milliseconds: 200), 387 | alignment: Alignment.center, 388 | width: 40, 389 | child: Text( 390 | datas[i]["Pack size"].toString(), 391 | textAlign: TextAlign.center, 392 | style: TextStyle(fontSize: 16), 393 | ), 394 | ), 395 | ), 396 | )), 397 | ), 398 | ); 399 | } 400 | } 401 | --------------------------------------------------------------------------------