├── .gitignore ├── .metadata ├── .vscode └── settings.json ├── README.md ├── analysis_options.yaml ├── android ├── .gitignore ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── red_squirrel │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable-v21 │ │ │ └── launch_background.xml │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── values-night │ │ │ └── styles.xml │ │ │ └── values │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── asadf.dart ├── assets ├── fonts │ ├── Arial-Regular.TTF │ └── PoetsenOne-Regular.ttf ├── icons │ ├── Line1.svg │ ├── Line2.svg │ ├── Line3.svg │ ├── Rectangle-Vector.svg │ ├── Vector.svg │ ├── books.png │ ├── books.svg │ ├── checklist.svg │ ├── clock.svg │ └── speaker.svg └── images │ ├── bridge.png │ ├── logo.png │ └── splash.png ├── ios ├── .gitignore ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings ├── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ ├── Contents.json │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ ├── 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-60x60@2x.png │ │ │ ├── Icon-App-60x60@3x.png │ │ │ ├── Icon-App-76x76@1x.png │ │ │ ├── Icon-App-76x76@2x.png │ │ │ └── Icon-App-83.5x83.5@2x.png │ │ └── LaunchImage.imageset │ │ │ ├── Contents.json │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ └── README.md │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── Info.plist │ └── Runner-Bridging-Header.h └── RunnerTests │ └── RunnerTests.swift ├── lib ├── components │ └── test.dart ├── main.dart ├── route.dart ├── utils │ └── constants │ │ ├── colors.dart │ │ ├── fonts.dart │ │ ├── resources.dart │ │ ├── strings.dart │ │ ├── test_style.dart │ │ └── theme.dart ├── views │ ├── buy_book │ │ └── buy_book_page.dart │ ├── chapter_test │ │ ├── feedback_page.dart │ │ ├── main_page.dart │ │ ├── result_page.dart │ │ └── test_page.dart │ ├── full_test │ │ ├── feedback_page.dart │ │ ├── result_page.dart │ │ └── test_page.dart │ ├── home │ │ ├── home_page.dart │ │ └── widgets │ │ │ ├── buy_books_section.dart │ │ │ ├── chapter_test_section.dart │ │ │ ├── full_test_section.dart │ │ │ └── update_data_section.dart │ └── splash │ │ └── splash_page.dart └── widgets │ ├── answer_button.dart │ ├── boolean_button.dart │ ├── navbar.dart │ ├── progress_bar.dart │ ├── question_label.dart │ ├── rounded_button.dart │ ├── submit_button.dart │ └── timer.dart ├── pubspec.lock ├── pubspec.yaml ├── test └── widget_test.dart ├── web ├── favicon.png ├── icons │ ├── Icon-192.png │ ├── Icon-512.png │ ├── Icon-maskable-192.png │ └── Icon-maskable-512.png ├── index.html └── manifest.json └── windows ├── .gitignore ├── CMakeLists.txt ├── flutter ├── CMakeLists.txt ├── generated_plugin_registrant.cc ├── generated_plugin_registrant.h └── generated_plugins.cmake └── runner ├── CMakeLists.txt ├── Runner.rc ├── flutter_window.cpp ├── flutter_window.h ├── main.cpp ├── resource.h ├── resources └── app_icon.ico ├── runner.exe.manifest ├── utils.cpp ├── utils.h ├── win32_window.cpp └── win32_window.h /.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 | 38 | # Obfuscation related 39 | app.*.map.json 40 | 41 | # Android Studio will place build artifacts here 42 | /android/app/debug 43 | /android/app/profile 44 | /android/app/release 45 | -------------------------------------------------------------------------------- /.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: 796c8ef79279f9c774545b3771238c3098dbefab 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: 796c8ef79279f9c774545b3771238c3098dbefab 17 | base_revision: 796c8ef79279f9c774545b3771238c3098dbefab 18 | - platform: android 19 | create_revision: 796c8ef79279f9c774545b3771238c3098dbefab 20 | base_revision: 796c8ef79279f9c774545b3771238c3098dbefab 21 | - platform: ios 22 | create_revision: 796c8ef79279f9c774545b3771238c3098dbefab 23 | base_revision: 796c8ef79279f9c774545b3771238c3098dbefab 24 | - platform: linux 25 | create_revision: 796c8ef79279f9c774545b3771238c3098dbefab 26 | base_revision: 796c8ef79279f9c774545b3771238c3098dbefab 27 | - platform: macos 28 | create_revision: 796c8ef79279f9c774545b3771238c3098dbefab 29 | base_revision: 796c8ef79279f9c774545b3771238c3098dbefab 30 | - platform: web 31 | create_revision: 796c8ef79279f9c774545b3771238c3098dbefab 32 | base_revision: 796c8ef79279f9c774545b3771238c3098dbefab 33 | - platform: windows 34 | create_revision: 796c8ef79279f9c774545b3771238c3098dbefab 35 | base_revision: 796c8ef79279f9c774545b3771238c3098dbefab 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 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "cSpell.words": [ 3 | "getwidget" 4 | ] 5 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # red_squirrel 2 | 3 | UK Citizen Test App 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 GradleException("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: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | namespace "com.example.red_squirrel" 30 | compileSdkVersion flutter.compileSdkVersion 31 | ndkVersion flutter.ndkVersion 32 | 33 | compileOptions { 34 | sourceCompatibility JavaVersion.VERSION_1_8 35 | targetCompatibility JavaVersion.VERSION_1_8 36 | } 37 | 38 | kotlinOptions { 39 | jvmTarget = '1.8' 40 | } 41 | 42 | sourceSets { 43 | main.java.srcDirs += 'src/main/kotlin' 44 | } 45 | 46 | defaultConfig { 47 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 48 | applicationId "com.example.red_squirrel" 49 | // You can update the following values to match your application needs. 50 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. 51 | minSdkVersion flutter.minSdkVersion 52 | targetSdkVersion flutter.targetSdkVersion 53 | versionCode flutterVersionCode.toInteger() 54 | versionName flutterVersionName 55 | } 56 | 57 | buildTypes { 58 | release { 59 | // TODO: Add your own signing config for the release build. 60 | // Signing with the debug keys for now, so `flutter run --release` works. 61 | signingConfig signingConfigs.debug 62 | } 63 | } 64 | } 65 | 66 | flutter { 67 | source '../..' 68 | } 69 | 70 | dependencies { 71 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 72 | } 73 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 14 | 18 | 22 | 23 | 24 | 25 | 26 | 27 | 29 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/example/red_squirrel/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.red_squirrel 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.7.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.3.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | tasks.register("clean", Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /asadf.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: library_private_types_in_public_api, prefer_const_constructors 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_svg/flutter_svg.dart'; 5 | import 'package:red_squirrel/utils/constants/colors.dart'; 6 | import 'package:red_squirrel/utils/constants/fonts.dart'; 7 | import 'package:red_squirrel/utils/constants/strings.dart'; 8 | import 'package:red_squirrel/widgets/Rounded_button.dart'; 9 | import 'package:red_squirrel/utils/constants/resources.dart'; 10 | import 'package:percent_indicator/percent_indicator.dart'; 11 | import 'package:red_squirrel/utils/constants/test_style.dart'; 12 | 13 | class ResultPage extends StatefulWidget { 14 | const ResultPage({ 15 | super.key, 16 | }); 17 | 18 | static Page page() => const MaterialPage(child: ResultPage()); 19 | 20 | @override 21 | _ResultPageState createState() => _ResultPageState(); 22 | } 23 | 24 | class _ResultPageState extends State { 25 | @override 26 | void initState() { 27 | super.initState(); 28 | } 29 | 30 | Column _buildButtonColumn(Color color, IconData icon, String label) { 31 | return Column( 32 | mainAxisSize: MainAxisSize.min, 33 | mainAxisAlignment: MainAxisAlignment.center, 34 | children: [ 35 | Icon( 36 | icon, 37 | color: color, 38 | size: 38, 39 | ), 40 | Text( 41 | label, 42 | style: TextStyle( 43 | fontSize: 16, 44 | fontWeight: FontWeight.w500, 45 | color: color, 46 | ), 47 | ) 48 | ], 49 | ); 50 | } 51 | 52 | @override 53 | Widget build(BuildContext context) { 54 | return Scaffold( 55 | body: Column(children: [ 56 | Expanded( 57 | flex: 100, 58 | child: Stack(children: [ 59 | Container( 60 | width: double.infinity, 61 | height: 160, 62 | color: Theme.of(context).colorScheme.primary, 63 | child: Center( 64 | child: Text( 65 | Strings.fullTest, 66 | style: CustomTextStyle.HeaderTitleText(ThemeColors.label), 67 | ), 68 | )), 69 | Positioned( 70 | left: 0, 71 | right: 0, 72 | bottom: -1, 73 | child: Container( 74 | height: 46, 75 | decoration: BoxDecoration( 76 | borderRadius: const BorderRadius.only( 77 | topLeft: Radius.circular(24), 78 | topRight: Radius.circular(24), 79 | ), 80 | color: Theme.of(context).colorScheme.background), 81 | ), 82 | ), 83 | ]), 84 | ), 85 | Expanded( 86 | flex: 400, 87 | child: Stack( 88 | children: [ 89 | Container( 90 | width: double.infinity, 91 | height: 600, 92 | color: Theme.of(context).colorScheme.background, 93 | padding: 94 | const EdgeInsets.symmetric(horizontal: 16, vertical: 16), 95 | child: Column( 96 | crossAxisAlignment: CrossAxisAlignment.center, 97 | children: [ 98 | Row( 99 | crossAxisAlignment: CrossAxisAlignment.center, 100 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 101 | children: [ 102 | Column( 103 | crossAxisAlignment: CrossAxisAlignment.center, 104 | children: const [ 105 | SizedBox( 106 | height: 100, 107 | ), 108 | Text( 109 | "20/24", 110 | style: TextStyle( 111 | color: Color(0xFF012169), 112 | fontFamily: 'Arial Rounded MT Bold', 113 | fontWeight: FontWeight.w800, 114 | fontSize: 18, 115 | letterSpacing: 0.2, 116 | ), 117 | ), 118 | SizedBox( 119 | height: 10, 120 | ), 121 | Text( 122 | "Passed", 123 | style: TextStyle( 124 | color: Color(0xFF012169), 125 | fontFamily: 'Arial Rounded MT Bold', 126 | fontWeight: FontWeight.w800, 127 | fontSize: 18, 128 | letterSpacing: 0.2, 129 | ), 130 | ), 131 | ], 132 | ), 133 | CircularPercentIndicator( 134 | radius: 80, 135 | lineWidth: 22, 136 | animation: true, 137 | percent: 0.85, 138 | center: Text( 139 | "85%", 140 | style: TextStyle( 141 | color: Color(0xFF012169), 142 | fontSize: 40, 143 | fontFamily: 'Arial Rounded MT Bold', 144 | fontWeight: FontWeight.bold, 145 | ), 146 | ), 147 | progressColor: Color(0xFFA2DC5F), 148 | backgroundColor: Color(0xFFECF0F3)), 149 | Column( 150 | crossAxisAlignment: CrossAxisAlignment.center, 151 | children: const [ 152 | SizedBox( 153 | height: 100, 154 | ), 155 | Text( 156 | "40:20", 157 | style: TextStyle( 158 | color: Color(0xFF012169), 159 | fontFamily: 'Arial Rounded MT Bold', 160 | fontWeight: FontWeight.w800, 161 | fontSize: 18, 162 | letterSpacing: 0.2, 163 | ), 164 | ), 165 | SizedBox( 166 | height: 10, 167 | ), 168 | Text( 169 | "Time", 170 | style: TextStyle( 171 | color: Color(0xFF012169), 172 | fontFamily: 'Arial Rounded MT Bold', 173 | fontWeight: FontWeight.w800, 174 | fontSize: 18, 175 | letterSpacing: 0.2, 176 | ), 177 | ), 178 | ], 179 | ), 180 | ], 181 | ), 182 | SizedBox( 183 | height: 40, 184 | ), 185 | Text( 186 | "Congratulations!", 187 | style: TextStyle( 188 | color: Color(0xFF012169), 189 | fontSize: 30, 190 | fontWeight: FontWeight.w700, 191 | ), 192 | ), 193 | SizedBox( 194 | height: 10, 195 | ), 196 | Text( 197 | "You have passed the test.", 198 | style: TextStyle( 199 | color: Color(0xFF012169), 200 | fontSize: 24, 201 | fontWeight: FontWeight.w300, 202 | ), 203 | ), 204 | Expanded( 205 | flex: 30, 206 | child: Stack(children: [ 207 | Center( 208 | child: Container( 209 | margin: EdgeInsets.only(top: 40), 210 | child: _buildButtonColumn(Color(0xFF012169), 211 | Icons.local_airport_sharp, ""), 212 | )), 213 | Column( 214 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 215 | children: [ 216 | Row( 217 | crossAxisAlignment: CrossAxisAlignment.center, 218 | mainAxisAlignment: 219 | MainAxisAlignment.spaceAround, 220 | children: [ 221 | _buildButtonColumn(Color(0xFF012169), 222 | Icons.checklist_rounded, 'Check results'), 223 | _buildButtonColumn( 224 | Color(0xFF012169), 225 | Icons.format_list_numbered, 226 | 'Test by Chapter'), 227 | ], 228 | ), 229 | Divider( 230 | color: Color(0xFF012169), 231 | thickness: 3, 232 | ), 233 | Row( 234 | children: [ 235 | Container( 236 | width: 1, 237 | color: Color(0xFF012169), 238 | ) 239 | ], 240 | ), 241 | Row( 242 | crossAxisAlignment: CrossAxisAlignment.center, 243 | mainAxisAlignment: 244 | MainAxisAlignment.spaceAround, 245 | children: [ 246 | _buildButtonColumn(Color(0xFF012169), 247 | Icons.restart_alt, 'Restart test'), 248 | _buildButtonColumn( 249 | Color(0xFF012169), 250 | Icons.exit_to_app_rounded, 251 | 'Exit the App'), 252 | ], 253 | ) 254 | ], 255 | ), 256 | ])) 257 | ], 258 | ), 259 | ), 260 | ], 261 | )), 262 | ])); 263 | } 264 | } 265 | -------------------------------------------------------------------------------- /assets/fonts/Arial-Regular.TTF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/assets/fonts/Arial-Regular.TTF -------------------------------------------------------------------------------- /assets/fonts/PoetsenOne-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/assets/fonts/PoetsenOne-Regular.ttf -------------------------------------------------------------------------------- /assets/icons/Line1.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /assets/icons/Line2.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /assets/icons/Line3.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /assets/icons/Rectangle-Vector.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /assets/icons/Vector.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /assets/icons/books.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/assets/icons/books.png -------------------------------------------------------------------------------- /assets/icons/checklist.svg: -------------------------------------------------------------------------------- 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 | 39 | -------------------------------------------------------------------------------- /assets/icons/clock.svg: -------------------------------------------------------------------------------- 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 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | -------------------------------------------------------------------------------- /assets/icons/speaker.svg: -------------------------------------------------------------------------------- 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 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /assets/images/bridge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/assets/images/bridge.png -------------------------------------------------------------------------------- /assets/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/assets/images/logo.png -------------------------------------------------------------------------------- /assets/images/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/assets/images/splash.png -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.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/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 43 | 49 | 50 | 51 | 52 | 53 | 63 | 65 | 71 | 72 | 73 | 74 | 80 | 82 | 88 | 89 | 90 | 91 | 93 | 94 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/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/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/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/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/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/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/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/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/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/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/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/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/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/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/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/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/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/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/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/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /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. -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Red Squirrel 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | red_squirrel 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 | -------------------------------------------------------------------------------- /ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /ios/RunnerTests/RunnerTests.swift: -------------------------------------------------------------------------------- 1 | import Flutter 2 | import UIKit 3 | import XCTest 4 | 5 | class RunnerTests: XCTestCase { 6 | 7 | func testExample() { 8 | // If you add code to the Runner application, consider adding tests here. 9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest. 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /lib/components/test.dart: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/lib/components/test.dart -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/scheduler.dart'; 3 | import 'package:device_preview/device_preview.dart'; 4 | import 'package:red_squirrel/utils/constants/strings.dart'; 5 | import 'package:red_squirrel/utils/constants/theme.dart'; 6 | import 'package:red_squirrel/views/splash/splash_page.dart'; 7 | 8 | void main() async { 9 | WidgetsFlutterBinding.ensureInitialized(); 10 | 11 | runApp(DevicePreview( 12 | enabled: false, 13 | builder: (context) => const MyApp(), 14 | )); 15 | } 16 | 17 | class MyApp extends StatelessWidget { 18 | const MyApp({ 19 | super.key, 20 | }); 21 | 22 | @override 23 | Widget build(BuildContext context) { 24 | return const AppView(); 25 | } 26 | } 27 | 28 | class AppView extends StatelessWidget implements TickerProvider { 29 | const AppView({super.key}); 30 | 31 | @override 32 | Ticker createTicker(TickerCallback onTick) => Ticker(onTick); 33 | 34 | @override 35 | Widget build(BuildContext context) { 36 | return MaterialApp( 37 | debugShowCheckedModeBanner: false, 38 | theme: AppTheme.lightTheme(), 39 | title: Strings.appName, 40 | home: const SplashPage()); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/route.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | import 'package:red_squirrel/views/chapter_test/main_page.dart'; 3 | import 'package:red_squirrel/views/home/home_page.dart'; 4 | // import 'package:red_squirrel/views/splash/splash_page.dart'; 5 | import 'package:red_squirrel/views/full_test/result_page.dart'; 6 | 7 | enum PageRouteState { 8 | splash, 9 | home, 10 | fullTest, 11 | chapterTest, 12 | buyBooks, 13 | } 14 | 15 | List> onGenerateAppViewPages( 16 | PageRouteState state, 17 | List> pages, 18 | ) { 19 | // if (state == PageRouteState.splash) { 20 | // return [SplashPage.page()]; 21 | // } else if (state == PageRouteState.fullTest) { 22 | // return [FullTestpage.page()]; 23 | // } else if (state == PageRouteState.chapterTest) { 24 | // return [ChapterTestpage.page()]; 25 | // } else if (state == PageRouteState.buyBooks) { 26 | // return [BuyBooksPage.page()]; 27 | // } else { 28 | // return [HomePage.page()]; 29 | // } 30 | return [MainPage.page()]; 31 | } 32 | 33 | PageRouteState getRouteState() { 34 | return PageRouteState.home; 35 | } 36 | -------------------------------------------------------------------------------- /lib/utils/constants/colors.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class ThemeColors { 4 | static const Color background = Color(0xffedf3ff); 5 | static const Color primary = Color(0xffc8102e); 6 | static const Color secondary = Color(0xff012169); 7 | static const Color label = Color(0xFFFFFFFF); 8 | static const Color border = Color(0xFF3E3E3E); 9 | static const Color success = Color(0xff299917); 10 | static const Color failed = Color(0xffc8102e); 11 | static const Color Line = Color.fromARGB(255, 18, 32, 47); 12 | static const Color counterColor = Color(0xFF2A9918); 13 | static const Color progressBarColor = Color.fromARGB(128, 1, 33, 105); 14 | 15 | static const Gradient gradient1 = LinearGradient( 16 | begin: Alignment.centerLeft, 17 | end: Alignment.centerRight, 18 | colors: [ 19 | Color(0x4c012169), 20 | Color(0x4cffffff), 21 | Color(0x4cffffff), 22 | Color(0x4cc8102e), 23 | ], 24 | ); 25 | static const Gradient gradient2 = LinearGradient( 26 | begin: Alignment(-0.98, 0.21), 27 | end: Alignment(0.98, -0.21), 28 | colors: [ 29 | Color(0x4C012169), 30 | Color.fromRGBO(255, 255, 255, 0.3), 31 | Color.fromRGBO(255, 255, 255, 0.3), 32 | ], 33 | ); 34 | static const Gradient gradient3 = LinearGradient( 35 | begin: Alignment(0, 0.51), 36 | end: Alignment(0.9, 0), 37 | colors: [ 38 | Color(0x4cffffff), 39 | Color(0x33FF0000), 40 | ], 41 | ); 42 | } 43 | -------------------------------------------------------------------------------- /lib/utils/constants/fonts.dart: -------------------------------------------------------------------------------- 1 | class Fonts { 2 | static const String primaryFont = "Arial"; 3 | static const String secondaryFont = "PoetsenOne"; 4 | } 5 | -------------------------------------------------------------------------------- /lib/utils/constants/resources.dart: -------------------------------------------------------------------------------- 1 | class Images { 2 | static const String splash = "assets/images/splash.png"; 3 | static const String logo = "assets/images/logo.png"; 4 | static const String bridge = "assets/images/bridge.png"; 5 | } 6 | 7 | class SvgIcons { 8 | static const String checkList = "assets/icons/checklist.svg"; 9 | static const String clock = "assets/icons/clock.svg"; 10 | static const String vector = "assets/icons/vector.svg"; 11 | static const String books = "assets/icons/books.png"; 12 | static const String vector = "assets/icons/Vector.svg"; 13 | static const String Rectangle = "assets/icons/Rectangle-Vector.svg"; 14 | static const String Line1 = "assets/icons/Line1.svg"; 15 | static const String Line2 = "assets/icons/Line2.svg"; 16 | static const String Line3 = "assets/icons/Line3.svg"; 17 | static const String checkListIcon = "assets/icons/checklistIcon.svg"; 18 | static const String numberListIcon = "assets/icons/numberListIcon.svg"; 19 | static const String restartIcon = "assets/icons/restartIcon.svg"; 20 | static const String exitIcon = "assets/icons/exitIcon.svg"; 21 | } 22 | -------------------------------------------------------------------------------- /lib/utils/constants/strings.dart: -------------------------------------------------------------------------------- 1 | class Strings { 2 | static const String appName = "Red Squirrel"; 3 | static const String subTitle1 = "LIFE"; 4 | static const String subTitle2 = "IN"; 5 | static const String subTitle3 = "THE"; 6 | static const String subTitle4 = "UK"; 7 | static const String homeFullTest = "Full practice test"; 8 | static const String homeChapterTest = "Test by \n Chapter"; 9 | static const String homeBuyBooks = "Buy our \n Books"; 10 | static const String homeStartButton = "Start"; 11 | static const String homeUpdateQuestion = "Do you want to update?"; 12 | static const String homeUpdateComment = "Question data was updated."; 13 | static const String homeUpdateDate = "07/12/2023"; 14 | static const String homeUpdateButton = "Update"; 15 | static const String fullTest = "Full Test"; 16 | static const String testByChapter = "Test by Chapter"; 17 | static const String chapter = "Chapter "; 18 | static const String two = "2 & 3"; 19 | static const String four = "4"; 20 | static const String five = "5"; 21 | static const String six = "6"; 22 | static const String fullTestCaption = "Full test"; 23 | static const String submitButton = "submit"; 24 | static const String feedbackButton = "feedback"; 25 | } 26 | -------------------------------------------------------------------------------- /lib/utils/constants/test_style.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: non_constant_identifier_names 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:red_squirrel/utils/constants/colors.dart'; 5 | import 'package:red_squirrel/utils/constants/fonts.dart'; 6 | 7 | class CustomTextStyle { 8 | const CustomTextStyle(); 9 | 10 | static TextStyle TitleText( 11 | [Color textColor = ThemeColors.label, 12 | double fontSize = 48, 13 | FontWeight fontWeight = FontWeight.w400, 14 | String fontFamily = Fonts.secondaryFont, 15 | List shadows = const []]) => 16 | TextStyle( 17 | color: textColor, 18 | fontWeight: fontWeight, 19 | fontSize: fontSize, 20 | fontFamily: fontFamily, 21 | shadows: shadows); 22 | 23 | static TextStyle HeaderTitleText( 24 | [Color textColor = ThemeColors.secondary, 25 | double fontSize = 36, 26 | FontWeight fontWeight = FontWeight.w700, 27 | String fontFamily = Fonts.primaryFont, 28 | List shadows = const []]) => 29 | TextStyle( 30 | color: textColor, 31 | fontWeight: fontWeight, 32 | fontSize: fontSize, 33 | fontFamily: fontFamily, 34 | shadows: shadows); 35 | 36 | static TextStyle SectionTitle( 37 | [Color textColor = ThemeColors.secondary, 38 | double fontSize = 30, 39 | FontWeight fontWeight = FontWeight.w700, 40 | String fontFamily = Fonts.primaryFont, 41 | List shadows = const []]) => 42 | TextStyle( 43 | color: textColor, 44 | fontWeight: fontWeight, 45 | fontSize: fontSize, 46 | fontFamily: fontFamily, 47 | shadows: shadows); 48 | 49 | static TextStyle SubText( 50 | [Color textColor = ThemeColors.secondary, 51 | double fontSize = 24, 52 | FontWeight fontWeight = FontWeight.w700, 53 | String fontFamily = Fonts.primaryFont, 54 | List shadows = const []]) => 55 | TextStyle( 56 | color: textColor, 57 | fontWeight: fontWeight, 58 | fontSize: fontSize, 59 | fontFamily: fontFamily, 60 | shadows: shadows); 61 | 62 | static TextStyle DescText([ 63 | Color textColor = ThemeColors.secondary, 64 | double fontSize = 20, 65 | FontWeight fontWeight = FontWeight.w700, 66 | String fontFamily = Fonts.primaryFont, 67 | List shadows = const [], 68 | double height = 1, 69 | double letterSpacing = 0, 70 | ]) => 71 | TextStyle( 72 | color: textColor, 73 | fontWeight: fontWeight, 74 | fontSize: fontSize, 75 | fontFamily: fontFamily, 76 | shadows: shadows, 77 | height: height, 78 | letterSpacing: letterSpacing); 79 | 80 | static TextStyle LabelText( 81 | [Color textColor = ThemeColors.secondary, 82 | double fontSize = 16, 83 | FontWeight fontWeight = FontWeight.w700, 84 | String fontFamily = Fonts.primaryFont, 85 | List shadows = const []]) => 86 | TextStyle( 87 | color: textColor, 88 | fontWeight: fontWeight, 89 | fontSize: fontSize, 90 | fontFamily: fontFamily, 91 | shadows: shadows); 92 | 93 | static TextStyle SpanText( 94 | [Color textColor = ThemeColors.secondary, 95 | double fontSize = 14, 96 | FontWeight fontWeight = FontWeight.w400, 97 | String fontFamily = Fonts.primaryFont, 98 | List shadows = const []]) => 99 | TextStyle( 100 | color: textColor, 101 | fontWeight: fontWeight, 102 | fontSize: fontSize, 103 | fontFamily: fontFamily, 104 | shadows: shadows); 105 | } 106 | -------------------------------------------------------------------------------- /lib/utils/constants/theme.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:red_squirrel/utils/constants/colors.dart'; 3 | import 'package:red_squirrel/utils/constants/fonts.dart'; 4 | 5 | class AppTheme { 6 | static ThemeData lightTheme() => ThemeData( 7 | fontFamily: Fonts.primaryFont, 8 | colorScheme: ColorScheme.fromSeed( 9 | seedColor: ThemeColors.primary, 10 | brightness: Brightness.light, 11 | primary: ThemeColors.primary, 12 | secondary: ThemeColors.secondary, 13 | outline: ThemeColors.border, 14 | onSurface: ThemeColors.label, 15 | background: ThemeColors.background, 16 | ), 17 | checkboxTheme: CheckboxThemeData( 18 | checkColor: 19 | MaterialStateProperty.resolveWith((_) => ThemeColors.primary), 20 | fillColor: 21 | MaterialStateProperty.resolveWith((_) => ThemeColors.secondary), 22 | shape: 23 | RoundedRectangleBorder(borderRadius: BorderRadius.circular(4))), 24 | scaffoldBackgroundColor: ThemeColors.background, 25 | brightness: Brightness.light); 26 | } 27 | -------------------------------------------------------------------------------- /lib/views/buy_book/buy_book_page.dart: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/lib/views/buy_book/buy_book_page.dart -------------------------------------------------------------------------------- /lib/views/chapter_test/feedback_page.dart: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/lib/views/chapter_test/feedback_page.dart -------------------------------------------------------------------------------- /lib/views/chapter_test/main_page.dart: -------------------------------------------------------------------------------- 1 | 2 | import 'package:flutter/material.dart'; 3 | import 'package:red_squirrel/utils/constants/colors.dart'; 4 | import 'package:red_squirrel/utils/constants/strings.dart'; 5 | import 'package:red_squirrel/utils/constants/resources.dart'; 6 | import 'package:red_squirrel/widgets/navbar.dart'; 7 | import 'package:red_squirrel/utils/constants/test_style.dart'; 8 | import 'package:flutter_svg/flutter_svg.dart'; 9 | 10 | class MainPage extends StatefulWidget { 11 | const MainPage({ 12 | super.key, 13 | }); 14 | 15 | static Page page() => const MaterialPage(child: MainPage()); 16 | 17 | @override 18 | _MainPageState createState() => _MainPageState(); 19 | } 20 | 21 | class _MainPageState extends State { 22 | @override 23 | void initState() { 24 | super.initState(); 25 | } 26 | 27 | @override 28 | Widget build(BuildContext context) { 29 | Column _testByChapter( 30 | String chapter, String status, String percent, int score, int total) { 31 | return Column( 32 | children: [ 33 | Container( 34 | padding: EdgeInsets.symmetric(vertical: 10, horizontal: 40), 35 | decoration: BoxDecoration( 36 | color: Colors.white.withOpacity(1), 37 | borderRadius: BorderRadius.circular(12), 38 | border: Border.all(width: 1.0, color: Colors.grey), 39 | ), 40 | child: Row( 41 | crossAxisAlignment: CrossAxisAlignment.center, 42 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 43 | children: [ 44 | Column( 45 | crossAxisAlignment: CrossAxisAlignment.center, 46 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 47 | children: [ 48 | Text(status, 49 | style: status.toUpperCase() == "PASSED" 50 | ? CustomTextStyle.LabelText(ThemeColors.success) 51 | : CustomTextStyle.LabelText(ThemeColors.failed) 52 | // , 53 | ), 54 | SizedBox(height: 10), 55 | Positioned( 56 | left: 0, 57 | right: 0, 58 | top: 0, 59 | bottom: 0, 60 | child: Center( 61 | child: SvgPicture.asset( 62 | SvgIcons.Line3, 63 | width: 130, 64 | ), 65 | ), 66 | ), 67 | SizedBox(height: 10), 68 | Row( 69 | crossAxisAlignment: CrossAxisAlignment.center, 70 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 71 | children: [ 72 | Text('$percent%', 73 | style: status.toUpperCase() == "PASSED" 74 | ? CustomTextStyle.LabelText(ThemeColors.success) 75 | : CustomTextStyle.LabelText( 76 | ThemeColors.failed)), 77 | SizedBox( 78 | width: 40, 79 | ), 80 | Text('$score / $total', 81 | style: status.toUpperCase() == "PASSED" 82 | ? CustomTextStyle.LabelText(ThemeColors.success) 83 | : CustomTextStyle.LabelText(ThemeColors.failed)) 84 | ], 85 | ) 86 | ], 87 | ), 88 | Row( 89 | children: [ 90 | Text( 91 | chapter == "2 & 3" ? "Chapters " : Strings.chapter, 92 | // Strings.chapter, 93 | style: CustomTextStyle.DescText(ThemeColors.secondary), 94 | ), 95 | Text( 96 | chapter, 97 | style: CustomTextStyle.SubText(ThemeColors.secondary), 98 | ) 99 | ], 100 | ) 101 | ], 102 | ), 103 | ), 104 | SizedBox(height: 30), 105 | ], 106 | ); 107 | } 108 | 109 | return Scaffold( 110 | backgroundColor: Theme.of(context).colorScheme.primary, 111 | body: Column(children: [ 112 | //////////// Header /////////////// 113 | Container( 114 | padding: const EdgeInsets.only(bottom: 15, top: 49), 115 | color: Theme.of(context).colorScheme.primary, 116 | alignment: Alignment.center, 117 | child: Center( 118 | child: Text(Strings.testByChapter.toUpperCase(), 119 | style: CustomTextStyle.SectionTitle(ThemeColors.label)), 120 | ), 121 | ), 122 | 123 | /////////////Content//////////// 124 | Expanded( 125 | child: Stack(children: [ 126 | Container( 127 | padding: const EdgeInsets.fromLTRB(12, 12, 12, 0), 128 | clipBehavior: Clip.none, 129 | decoration: const BoxDecoration( 130 | color: ThemeColors.background, 131 | borderRadius: BorderRadius.only( 132 | topLeft: Radius.circular(16), 133 | topRight: Radius.circular(16)), 134 | ), 135 | child: Stack(children: [ 136 | Positioned( 137 | bottom: -46, 138 | right: -12, 139 | width: 280, 140 | child: Image.asset( 141 | Images.bridge, 142 | fit: BoxFit.scaleDown, 143 | )), 144 | Column(children: [ 145 | Expanded( 146 | child: SingleChildScrollView( 147 | child: Column( 148 | crossAxisAlignment: CrossAxisAlignment.stretch, 149 | mainAxisAlignment: MainAxisAlignment.spaceAround, 150 | children: [ 151 | SizedBox(height: 40), 152 | _testByChapter(Strings.two, "Passed", "90", 20, 24), 153 | _testByChapter( 154 | Strings.four, "Passed", "90", 20, 24), 155 | _testByChapter( 156 | Strings.five, "Passed", "90", 20, 24), 157 | _testByChapter(Strings.six, "Failed", "90", 20, 24) 158 | ]), 159 | )), 160 | ]), 161 | ]), 162 | ), 163 | ]), 164 | ), 165 | /////////// NavBar /////////////// 166 | NavBar(), 167 | ])); 168 | } 169 | } 170 | -------------------------------------------------------------------------------- /lib/views/chapter_test/result_page.dart: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/lib/views/chapter_test/result_page.dart -------------------------------------------------------------------------------- /lib/views/chapter_test/test_page.dart: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/lib/views/chapter_test/test_page.dart -------------------------------------------------------------------------------- /lib/views/full_test/feedback_page.dart: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/lib/views/full_test/feedback_page.dart -------------------------------------------------------------------------------- /lib/views/full_test/result_page.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: library_private_types_in_public_api, prefer_const_constructors 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_svg/flutter_svg.dart'; 5 | import 'package:red_squirrel/utils/constants/colors.dart'; 6 | import 'package:red_squirrel/utils/constants/fonts.dart'; 7 | import 'package:red_squirrel/utils/constants/strings.dart'; 8 | import 'package:red_squirrel/widgets/Rounded_button.dart'; 9 | import 'package:red_squirrel/utils/constants/resources.dart'; 10 | import 'package:percent_indicator/percent_indicator.dart'; 11 | import 'package:red_squirrel/utils/constants/test_style.dart'; 12 | 13 | class ResultPage extends StatefulWidget { 14 | const ResultPage({ 15 | super.key, 16 | }); 17 | 18 | static Page page() => const MaterialPage(child: ResultPage()); 19 | 20 | @override 21 | _ResultPageState createState() => _ResultPageState(); 22 | } 23 | 24 | class _ResultPageState extends State { 25 | @override 26 | void initState() { 27 | super.initState(); 28 | } 29 | 30 | Column _buildButtonColumn(Color color, IconData icon, String label) { 31 | return Column( 32 | mainAxisSize: MainAxisSize.min, 33 | mainAxisAlignment: MainAxisAlignment.center, 34 | children: [ 35 | Icon( 36 | icon, 37 | color: color, 38 | size: 38, 39 | ), 40 | Text( 41 | label, 42 | style: TextStyle( 43 | fontSize: 16, 44 | fontWeight: FontWeight.w500, 45 | color: color, 46 | ), 47 | ) 48 | ], 49 | ); 50 | } 51 | 52 | @override 53 | Widget build(BuildContext context) { 54 | return Scaffold( 55 | backgroundColor: Theme.of(context).colorScheme.primary, 56 | body: Column(children: [ 57 | //////////// Header /////////////// 58 | Container( 59 | padding: const EdgeInsets.only(bottom: 15, top: 49), 60 | color: Theme.of(context).colorScheme.primary, 61 | alignment: Alignment.center, 62 | child: Center( 63 | child: Text(Strings.fullTest.toUpperCase(), 64 | style: CustomTextStyle.SectionTitle(ThemeColors.label)), 65 | ), 66 | ), 67 | 68 | /////////////Content//////////// 69 | Expanded( 70 | child: Stack(children: [ 71 | Container( 72 | padding: const EdgeInsets.fromLTRB(12, 12, 12, 0), 73 | // clipBehavior: Clip.none, 74 | decoration: const BoxDecoration( 75 | color: ThemeColors.background, 76 | borderRadius: BorderRadius.only( 77 | topLeft: Radius.circular(16), 78 | topRight: Radius.circular(16)), 79 | ), 80 | child: Column( 81 | crossAxisAlignment: CrossAxisAlignment.center, 82 | children: [ 83 | SizedBox( 84 | height: 50, 85 | ), 86 | Row( 87 | crossAxisAlignment: CrossAxisAlignment.center, 88 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 89 | children: [ 90 | Column( 91 | crossAxisAlignment: CrossAxisAlignment.center, 92 | children: const [ 93 | SizedBox( 94 | height: 100, 95 | ), 96 | Text( 97 | "20/24", 98 | style: TextStyle( 99 | color: Color(0xFF012169), 100 | fontFamily: 'Arial Rounded MT Bold', 101 | fontWeight: FontWeight.w800, 102 | fontSize: 18, 103 | letterSpacing: 0.2, 104 | ), 105 | ), 106 | SizedBox( 107 | height: 10, 108 | ), 109 | Text( 110 | "Passed", 111 | style: TextStyle( 112 | color: Color(0xFF012169), 113 | fontFamily: 'Arial Rounded MT Bold', 114 | fontWeight: FontWeight.w800, 115 | fontSize: 18, 116 | letterSpacing: 0.2, 117 | ), 118 | ), 119 | ], 120 | ), 121 | CircularPercentIndicator( 122 | radius: 80, 123 | lineWidth: 22, 124 | animation: true, 125 | percent: 0.85, 126 | center: Text( 127 | "85%", 128 | style: TextStyle( 129 | color: Color(0xFF012169), 130 | fontSize: 40, 131 | fontFamily: 'Arial Rounded MT Bold', 132 | fontWeight: FontWeight.bold, 133 | ), 134 | ), 135 | progressColor: Color(0xFFA2DC5F), 136 | backgroundColor: Color(0xFFECF0F3)), 137 | Column( 138 | crossAxisAlignment: CrossAxisAlignment.center, 139 | children: const [ 140 | SizedBox( 141 | height: 100, 142 | ), 143 | Text( 144 | "40:20", 145 | style: TextStyle( 146 | color: Color(0xFF012169), 147 | fontFamily: 'Arial Rounded MT Bold', 148 | fontWeight: FontWeight.w800, 149 | fontSize: 18, 150 | letterSpacing: 0.2, 151 | ), 152 | ), 153 | SizedBox( 154 | height: 10, 155 | ), 156 | Text( 157 | "Time", 158 | style: TextStyle( 159 | color: Color(0xFF012169), 160 | fontFamily: 'Arial Rounded MT Bold', 161 | fontWeight: FontWeight.w800, 162 | fontSize: 18, 163 | letterSpacing: 0.2, 164 | ), 165 | ), 166 | ], 167 | ), 168 | ], 169 | ), 170 | SizedBox( 171 | height: 60, 172 | ), 173 | Text( 174 | "Congratulations!", 175 | style: TextStyle( 176 | color: Color(0xFF012169), 177 | fontSize: 30, 178 | fontWeight: FontWeight.w700, 179 | ), 180 | ), 181 | SizedBox( 182 | height: 10, 183 | ), 184 | Text( 185 | "You have passed the test.", 186 | style: TextStyle( 187 | color: Color(0xFF012169), 188 | fontSize: 24, 189 | fontWeight: FontWeight.w300, 190 | ), 191 | ), 192 | Container( 193 | margin: EdgeInsetsDirectional.symmetric(vertical: 60), 194 | child: Stack(children: [ 195 | Positioned( 196 | left: 0, 197 | right: 0, 198 | top: 0, 199 | bottom: 0, 200 | child: Center( 201 | child: SvgPicture.asset( 202 | SvgIcons.Line2, 203 | width: MediaQuery.of(context).size.width - 100, 204 | color: ThemeColors.secondary, 205 | ), 206 | ), 207 | ), 208 | Positioned( 209 | left: 0, 210 | right: 0, 211 | top: 0, 212 | bottom: 0, 213 | child: Center( 214 | child: SvgPicture.asset( 215 | SvgIcons.Line1, 216 | width: MediaQuery.of(context).size.width - 100, 217 | color: ThemeColors.secondary, 218 | ), 219 | ), 220 | ), 221 | Positioned( 222 | left: 0, 223 | right: 0, 224 | top: 0, 225 | bottom: 0, 226 | child: Center( 227 | child: SvgPicture.asset( 228 | SvgIcons.Rectangle, 229 | width: 50, 230 | ), 231 | ), 232 | ), 233 | Positioned( 234 | left: 0, 235 | right: 0, 236 | top: 0, 237 | bottom: 0, 238 | child: Center( 239 | child: SvgPicture.asset( 240 | SvgIcons.vector, 241 | width: 36, 242 | color: ThemeColors.secondary, 243 | ), 244 | ), 245 | ), 246 | Column( 247 | mainAxisAlignment: MainAxisAlignment.spaceEvenly, 248 | children: [ 249 | Row( 250 | crossAxisAlignment: CrossAxisAlignment.center, 251 | mainAxisAlignment: 252 | MainAxisAlignment.spaceAround, 253 | children: [ 254 | _buildButtonColumn(Color(0xFF012169), 255 | Icons.checklist_rounded, 'Check results'), 256 | _buildButtonColumn( 257 | Color(0xFF012169), 258 | Icons.format_list_numbered, 259 | 'Test by Chapter'), 260 | ], 261 | ), 262 | SizedBox( 263 | height: 50, 264 | ), 265 | Row( 266 | crossAxisAlignment: CrossAxisAlignment.center, 267 | mainAxisAlignment: 268 | MainAxisAlignment.spaceAround, 269 | children: [ 270 | _buildButtonColumn(Color(0xFF012169), 271 | Icons.restart_alt, 'Restart test'), 272 | _buildButtonColumn( 273 | Color(0xFF012169), 274 | Icons.exit_to_app_rounded, 275 | 'Exit the App'), 276 | ], 277 | ) 278 | ], 279 | ), 280 | ])) 281 | ], 282 | ), 283 | ), 284 | ]), 285 | ), 286 | /////////// NavBar /////////////// 287 | ])); 288 | } 289 | } 290 | -------------------------------------------------------------------------------- /lib/views/full_test/test_page.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: library_private_types_in_public_api, prefer_const_constructors, prefer_const_literals_to_create_immutables 2 | 3 | import 'dart:ui'; 4 | 5 | import 'package:flutter/material.dart'; 6 | 7 | import 'package:red_squirrel/utils/constants/colors.dart'; 8 | import 'package:red_squirrel/utils/constants/strings.dart'; 9 | import 'package:red_squirrel/widgets/answer_button.dart'; 10 | import 'package:red_squirrel/widgets/timer.dart'; 11 | import 'package:red_squirrel/widgets/progress_bar.dart'; 12 | import 'package:red_squirrel/widgets/question_label.dart'; 13 | import 'package:red_squirrel/utils/constants/resources.dart'; 14 | import 'package:red_squirrel/widgets/submit_button.dart'; 15 | import 'package:red_squirrel/widgets/navbar.dart'; 16 | 17 | class FullTestPage extends StatefulWidget { 18 | const FullTestPage({ 19 | super.key, 20 | }); 21 | 22 | static Page page() => const MaterialPage(child: FullTestPage()); 23 | static Route route() => 24 | MaterialPageRoute(builder: (_) => const FullTestPage()); 25 | 26 | @override 27 | _FullTestPage createState() => _FullTestPage(); 28 | } 29 | 30 | class _FullTestPage extends State { 31 | @override 32 | void initState() { 33 | super.initState(); 34 | } 35 | 36 | @override 37 | Widget build(BuildContext context) { 38 | return Scaffold( 39 | backgroundColor: Theme.of(context).colorScheme.primary, 40 | body: Column(children: [ 41 | //////////// Header /////////////// 42 | Container( 43 | padding: const EdgeInsets.only(bottom: 15, top: 49), 44 | color: Theme.of(context).colorScheme.primary, 45 | alignment: Alignment.center, 46 | child: Center( 47 | child: Text( 48 | Strings.fullTestCaption.toUpperCase(), 49 | style: const TextStyle( 50 | fontSize: 30, 51 | fontWeight: FontWeight.w900, 52 | color: Colors.white, 53 | letterSpacing: 2, 54 | ), 55 | ), 56 | ), 57 | ), 58 | 59 | /////////////Content//////////// 60 | Expanded( 61 | child: Stack(children: [ 62 | Container( 63 | padding: const EdgeInsets.fromLTRB(12, 12, 12, 0), 64 | clipBehavior: Clip.none, 65 | decoration: const BoxDecoration( 66 | color: ThemeColors.background, 67 | borderRadius: BorderRadius.only( 68 | topLeft: Radius.circular(16), 69 | topRight: Radius.circular(16)), 70 | ), 71 | child: Stack(children: [ 72 | Positioned( 73 | bottom: -46, 74 | right: -12, 75 | width: 280, 76 | child: Image.asset( 77 | Images.bridge, 78 | fit: BoxFit.scaleDown, 79 | )), 80 | Column(children: [ 81 | CountTimer( 82 | timeDuration: 250, 83 | ), 84 | ProgressBar(count: 24), 85 | const SizedBox( 86 | height: 26, 87 | ), 88 | Expanded( 89 | child: SingleChildScrollView( 90 | child: Column( 91 | crossAxisAlignment: CrossAxisAlignment.stretch, 92 | children: [ 93 | QuestionLabel( 94 | question: 95 | 'Who was the first person to sail single-handed around the world?', 96 | ), 97 | SizedBox(height: 40), 98 | AnswerButton( 99 | answer: 'Sr. Francis Drake', 100 | ), 101 | AnswerButton( 102 | answer: 'Sr. Francis Walsingham', 103 | ), 104 | AnswerButton( 105 | answer: 'Sr. Francis Chichester', 106 | ), 107 | AnswerButton( 108 | answer: 'Sr. Robin Knox-Johnston', 109 | ), 110 | Row( 111 | children: [ 112 | const Spacer( 113 | flex: 1, 114 | ), 115 | SizedBox( 116 | child: SubmitButton( 117 | text: Strings.submitButton 118 | .toUpperCase())), 119 | const Spacer( 120 | flex: 1, 121 | ) 122 | ], 123 | ) 124 | ]), 125 | )), 126 | ]), 127 | ]), 128 | ), 129 | ]), 130 | ), 131 | 132 | /////////// NavBar /////////////// 133 | NavBar(), 134 | ])); 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /lib/views/home/home_page.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: library_private_types_in_public_api, prefer_const_constructors 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:red_squirrel/utils/constants/colors.dart'; 5 | import 'package:red_squirrel/utils/constants/fonts.dart'; 6 | import 'package:red_squirrel/utils/constants/strings.dart'; 7 | import 'package:red_squirrel/utils/constants/test_style.dart'; 8 | import 'package:red_squirrel/views/home/widgets/buy_books_section.dart'; 9 | import 'package:red_squirrel/views/home/widgets/chapter_test_section.dart'; 10 | import 'package:red_squirrel/views/home/widgets/full_test_section.dart'; 11 | import 'package:red_squirrel/views/home/widgets/update_data_section.dart'; 12 | import 'package:red_squirrel/utils/constants/resources.dart'; 13 | 14 | class HomePage extends StatefulWidget { 15 | const HomePage({ 16 | super.key, 17 | }); 18 | 19 | static Page page() => const MaterialPage(child: HomePage()); 20 | static Route route() => 21 | MaterialPageRoute(builder: (_) => const HomePage()); 22 | 23 | @override 24 | _HomePageState createState() => _HomePageState(); 25 | } 26 | 27 | class _HomePageState extends State { 28 | @override 29 | void initState() { 30 | super.initState(); 31 | } 32 | 33 | @override 34 | Widget build(BuildContext context) { 35 | return Scaffold( 36 | body: Column(children: [ 37 | Expanded( 38 | flex: 230, 39 | child: Stack(children: [ 40 | Container( 41 | width: double.infinity, 42 | height: 190, 43 | color: Theme.of(context).colorScheme.primary, 44 | padding: const EdgeInsets.fromLTRB(60, 60, 40, 60), 45 | child: Row( 46 | children: [ 47 | Image.asset( 48 | Images.logo, 49 | fit: BoxFit.fill, 50 | ), 51 | const SizedBox(width: 20), 52 | Container( 53 | padding: const EdgeInsets.symmetric(vertical: 0), 54 | child: Row( 55 | children: [ 56 | Text( 57 | Strings.subTitle1, 58 | style: CustomTextStyle.TitleText(), 59 | ), 60 | SizedBox( 61 | width: 6, 62 | ), 63 | Column( 64 | children: [ 65 | SizedBox( 66 | height: 12, 67 | ), 68 | Text( 69 | Strings.subTitle2, 70 | style: CustomTextStyle.LabelText(ThemeColors.label, 71 | 16, FontWeight.w400, Fonts.secondaryFont), 72 | ), 73 | Text( 74 | Strings.subTitle3, 75 | style: CustomTextStyle.LabelText(ThemeColors.label, 76 | 16, FontWeight.w400, Fonts.secondaryFont), 77 | ), 78 | ], 79 | ), 80 | SizedBox( 81 | width: 6, 82 | ), 83 | Text(Strings.subTitle4, 84 | style: CustomTextStyle.TitleText()), 85 | ], 86 | ), 87 | ) 88 | ], 89 | ), 90 | ), 91 | Positioned( 92 | bottom: -1, 93 | left: 0, 94 | right: 0, 95 | child: Container( 96 | height: 20, 97 | decoration: BoxDecoration( 98 | borderRadius: const BorderRadius.only( 99 | topLeft: Radius.circular(24), 100 | topRight: Radius.circular(24), 101 | ), 102 | color: Theme.of(context).colorScheme.background), 103 | ), 104 | ), 105 | ]), 106 | ), 107 | Expanded( 108 | flex: 700, 109 | child: Stack( 110 | children: [ 111 | Positioned( 112 | bottom: -50, 113 | right: 10, 114 | width: 280, 115 | child: Image.asset( 116 | Images.bridge, 117 | fit: BoxFit.fill, 118 | )), 119 | Container( 120 | color: Colors.transparent, 121 | padding: 122 | const EdgeInsets.symmetric(horizontal: 16, vertical: 16), 123 | child: Column( 124 | children: const [ 125 | FullTestSection(), 126 | SizedBox(height: 16), 127 | Expanded( 128 | flex: 20, 129 | child: Row( 130 | children: [ 131 | ChapterTestSection(), 132 | SizedBox(width: 16), 133 | BuyBooksSection() 134 | ], 135 | )), 136 | SizedBox(height: 32), 137 | UpdateDataSection(), 138 | SizedBox(height: 64), 139 | ], 140 | ), 141 | ), 142 | ], 143 | )), 144 | Expanded( 145 | flex: 55, 146 | child: Container( 147 | color: Theme.of(context).colorScheme.secondary, 148 | ), 149 | ), 150 | ])); 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /lib/views/home/widgets/buy_books_section.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: file_names 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:pressable/pressable.dart'; 5 | import 'package:red_squirrel/utils/constants/colors.dart'; 6 | import 'package:red_squirrel/utils/constants/fonts.dart'; 7 | import 'package:red_squirrel/utils/constants/resources.dart'; 8 | import 'package:red_squirrel/utils/constants/strings.dart'; 9 | import 'package:red_squirrel/utils/constants/test_style.dart'; 10 | 11 | class BuyBooksSection extends StatelessWidget { 12 | const BuyBooksSection({ 13 | super.key, 14 | }); 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return Expanded( 19 | child: Pressable.opacity( 20 | onPressed: () {}, 21 | child: Container( 22 | padding: const EdgeInsets.all(16), 23 | decoration: BoxDecoration( 24 | borderRadius: BorderRadius.circular(12), 25 | gradient: ThemeColors.gradient3, 26 | ), 27 | child: Stack(children: [ 28 | Positioned( 29 | right: 0, 30 | bottom: 0, 31 | height: 60, 32 | child: Image.asset( 33 | SvgIcons.books, 34 | fit: BoxFit.fill, 35 | )), 36 | Positioned( 37 | top: 0, 38 | left: 0, 39 | right: 0, 40 | child: Text( 41 | Strings.homeBuyBooks, 42 | textAlign: TextAlign.center, 43 | style: CustomTextStyle.SectionTitle(ThemeColors.secondary, 44 | 24, FontWeight.w700, Fonts.primaryFont, [ 45 | const Shadow( 46 | color: Colors.white, 47 | offset: Offset(3, 0), 48 | blurRadius: 0), 49 | const Shadow( 50 | color: Colors.white, 51 | offset: Offset(-3, 0), 52 | blurRadius: 0), 53 | const Shadow( 54 | color: Colors.white, 55 | offset: Offset(0, 2), 56 | blurRadius: 0), 57 | const Shadow( 58 | color: Colors.white, 59 | offset: Offset(0, -2), 60 | blurRadius: 0) 61 | ]), 62 | )), 63 | ]), 64 | ))); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /lib/views/home/widgets/chapter_test_section.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: file_names 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_svg/flutter_svg.dart'; 5 | import 'package:pressable/pressable.dart'; 6 | import 'package:red_squirrel/utils/constants/colors.dart'; 7 | import 'package:red_squirrel/utils/constants/fonts.dart'; 8 | import 'package:red_squirrel/utils/constants/resources.dart'; 9 | import 'package:red_squirrel/utils/constants/strings.dart'; 10 | import 'package:red_squirrel/utils/constants/test_style.dart'; 11 | 12 | class ChapterTestSection extends StatelessWidget { 13 | const ChapterTestSection({ 14 | super.key, 15 | }); 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | return Expanded( 20 | child: Pressable.opacity( 21 | onPressed: () {}, 22 | child: Container( 23 | padding: const EdgeInsets.all(16), 24 | decoration: BoxDecoration( 25 | borderRadius: BorderRadius.circular(12), 26 | gradient: ThemeColors.gradient2, 27 | ), 28 | child: Stack(children: [ 29 | Positioned( 30 | left: 0, 31 | bottom: 0, 32 | width: 60, 33 | height: 60, 34 | child: SvgPicture.asset( 35 | SvgIcons.checkList, 36 | fit: BoxFit.cover, 37 | )), 38 | Positioned( 39 | top: 0, 40 | left: 0, 41 | right: 0, 42 | child: Text( 43 | Strings.homeChapterTest, 44 | textAlign: TextAlign.center, 45 | style: CustomTextStyle.SectionTitle(ThemeColors.secondary, 46 | 24, FontWeight.w700, Fonts.primaryFont, [ 47 | const Shadow( 48 | color: Colors.white, 49 | offset: Offset(3, 0), 50 | blurRadius: 0), 51 | const Shadow( 52 | color: Colors.white, 53 | offset: Offset(-3, 0), 54 | blurRadius: 0), 55 | const Shadow( 56 | color: Colors.white, 57 | offset: Offset(0, 2), 58 | blurRadius: 0), 59 | const Shadow( 60 | color: Colors.white, 61 | offset: Offset(0, -2), 62 | blurRadius: 0) 63 | ]), 64 | ), 65 | ), 66 | ]), 67 | ))); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /lib/views/home/widgets/full_test_section.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: file_names 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_svg/flutter_svg.dart'; 5 | import 'package:red_squirrel/utils/constants/colors.dart'; 6 | import 'package:red_squirrel/utils/constants/fonts.dart'; 7 | import 'package:red_squirrel/utils/constants/resources.dart'; 8 | import 'package:red_squirrel/utils/constants/strings.dart'; 9 | import 'package:red_squirrel/utils/constants/test_style.dart'; 10 | import 'package:red_squirrel/views/full_test/test_page.dart'; 11 | import 'package:red_squirrel/widgets/Rounded_button.dart'; 12 | 13 | class FullTestSection extends StatelessWidget { 14 | const FullTestSection({ 15 | super.key, 16 | }); 17 | 18 | @override 19 | Widget build(BuildContext context) { 20 | return Expanded( 21 | flex: 24, 22 | child: Container( 23 | padding: const EdgeInsets.all(16), 24 | decoration: BoxDecoration( 25 | borderRadius: BorderRadius.circular(12), 26 | gradient: ThemeColors.gradient1, 27 | ), 28 | child: Stack(children: [ 29 | Positioned( 30 | left: 0, 31 | bottom: 0, 32 | width: 64, 33 | height: 64, 34 | child: SvgPicture.asset( 35 | SvgIcons.clock, 36 | fit: BoxFit.cover, 37 | )), 38 | Positioned( 39 | right: 0, 40 | bottom: 0, 41 | child: RoundedButton( 42 | onPressed: () { 43 | Navigator.of(context).push(FullTestPage.route()); 44 | }, 45 | text: Strings.homeStartButton, 46 | outlined: true, 47 | foregroundColor: Theme.of(context).colorScheme.secondary)), 48 | Positioned( 49 | top: 10, 50 | left: 0, 51 | right: 0, 52 | child: Text( 53 | Strings.homeFullTest, 54 | textAlign: TextAlign.center, 55 | style: CustomTextStyle.SectionTitle(ThemeColors.secondary, 28, 56 | FontWeight.w700, Fonts.primaryFont, [ 57 | const Shadow( 58 | color: Colors.white, offset: Offset(3, 0), blurRadius: 0), 59 | const Shadow( 60 | color: Colors.white, 61 | offset: Offset(-3, 0), 62 | blurRadius: 0), 63 | const Shadow( 64 | color: Colors.white, offset: Offset(0, 2), blurRadius: 0), 65 | const Shadow( 66 | color: Colors.white, offset: Offset(0, -2), blurRadius: 0) 67 | ]), 68 | )), 69 | ]), 70 | ), 71 | ); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /lib/views/home/widgets/update_data_section.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: file_names 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_svg/flutter_svg.dart'; 5 | import 'package:indexed/indexed.dart'; 6 | import 'package:red_squirrel/utils/constants/colors.dart'; 7 | import 'package:red_squirrel/utils/constants/strings.dart'; 8 | import 'package:red_squirrel/utils/constants/test_style.dart'; 9 | import 'package:red_squirrel/widgets/Rounded_button.dart'; 10 | 11 | class UpdateDataSection extends StatelessWidget { 12 | const UpdateDataSection({ 13 | super.key, 14 | }); 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | return Expanded( 19 | flex: 21, 20 | child: Indexer( 21 | children: [ 22 | Indexed( 23 | index: 0, 24 | child: Container( 25 | decoration: BoxDecoration( 26 | color: Colors.white.withOpacity(0.5), 27 | borderRadius: BorderRadius.circular(12), 28 | border: Border.all(width: 1.0, color: Colors.grey), 29 | ), 30 | padding: const EdgeInsets.all(16), 31 | child: Stack( 32 | children: [ 33 | Positioned( 34 | top: 0, 35 | right: 0, 36 | child: Column( 37 | mainAxisAlignment: MainAxisAlignment.end, 38 | crossAxisAlignment: CrossAxisAlignment.end, 39 | textDirection: TextDirection.ltr, 40 | children: [ 41 | Text( 42 | Strings.homeUpdateComment, 43 | textAlign: TextAlign.right, 44 | style: CustomTextStyle.LabelText( 45 | ThemeColors.secondary, 16, FontWeight.w400), 46 | ), 47 | const SizedBox(height: 5), 48 | Text(Strings.homeUpdateDate, 49 | textAlign: TextAlign.right, 50 | style: CustomTextStyle.SpanText()) 51 | ], 52 | )), 53 | Positioned( 54 | bottom: 10, 55 | left: 0, 56 | child: Text( 57 | Strings.homeUpdateQuestion, 58 | style: CustomTextStyle.LabelText(), 59 | )), 60 | Positioned( 61 | bottom: 0, 62 | right: 0, 63 | child: RoundedButton( 64 | onPressed: () {}, 65 | text: Strings.homeUpdateButton, 66 | backgroundColor: 67 | Theme.of(context).colorScheme.secondary, 68 | foregroundColor: Colors.white)), 69 | ], 70 | ), 71 | ), 72 | ), 73 | Indexed( 74 | index: 1, 75 | child: Positioned( 76 | top: -10, 77 | left: 16, 78 | child: SvgPicture.asset( 79 | "assets/icons/speaker.svg", 80 | width: 60, 81 | ))), 82 | ], 83 | ), 84 | ); 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /lib/views/splash/splash_page.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: library_private_types_in_public_api 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:red_squirrel/utils/constants/resources.dart'; 5 | import 'package:red_squirrel/views/home/home_page.dart'; 6 | 7 | class SplashPage extends StatefulWidget { 8 | const SplashPage({ 9 | super.key, 10 | }); 11 | 12 | static Page page() => const MaterialPage(child: SplashPage()); 13 | 14 | @override 15 | _SplashPageState createState() => _SplashPageState(); 16 | } 17 | 18 | class _SplashPageState extends State { 19 | @override 20 | void initState() { 21 | super.initState(); 22 | } 23 | 24 | @override 25 | Widget build(BuildContext context) { 26 | Future.delayed(const Duration(seconds: 3), () { 27 | Navigator.of(context).push(HomePage.route()); 28 | }); 29 | 30 | return SizedBox( 31 | width: double.infinity, 32 | height: double.infinity, 33 | child: Image.asset( 34 | Images.splash, 35 | fit: BoxFit.fill, 36 | )); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /lib/widgets/answer_button.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: file_names 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:red_squirrel/utils/constants/colors.dart'; 5 | import 'package:red_squirrel/utils/constants/fonts.dart'; 6 | import 'package:red_squirrel/utils/constants/test_style.dart'; 7 | 8 | class AnswerButton extends StatefulWidget { 9 | final String answer; 10 | 11 | const AnswerButton({ 12 | super.key, 13 | required this.answer, 14 | }); 15 | 16 | @override 17 | State createState() => _AnswerButtonState(); 18 | } 19 | 20 | class _AnswerButtonState extends State { 21 | late String answer; 22 | bool status = false; 23 | 24 | @override 25 | void initState() { 26 | super.initState(); 27 | answer = widget.answer; 28 | } 29 | 30 | void onClick() { 31 | setState(() { 32 | status = !status; 33 | }); 34 | } 35 | 36 | @override 37 | Widget build(BuildContext context) { 38 | return Container( 39 | margin: const EdgeInsets.only(bottom: 15), 40 | child: ElevatedButton( 41 | onPressed: () { 42 | onClick(); 43 | // Add your button logic here 44 | }, 45 | style: ElevatedButton.styleFrom( 46 | padding: const EdgeInsets.symmetric(vertical: 26), 47 | shape: RoundedRectangleBorder( 48 | borderRadius: BorderRadius.circular(6), 49 | side: BorderSide( 50 | width: 2.0, // Set the desired border width here 51 | color: 52 | Colors.grey.shade400, // Set the desired border color here 53 | ), 54 | ), 55 | backgroundColor: 56 | status == true ? ThemeColors.background : Colors.white, 57 | foregroundColor: ThemeColors.secondary, 58 | shadowColor: Colors.grey, 59 | elevation: 2.0, 60 | splashFactory: NoSplash.splashFactory), 61 | child: Text( 62 | widget.answer, 63 | textAlign: TextAlign.center, 64 | softWrap: true, 65 | style: CustomTextStyle.LabelText(), 66 | ), 67 | )); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /lib/widgets/boolean_button.dart: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/lib/widgets/boolean_button.dart -------------------------------------------------------------------------------- /lib/widgets/navbar.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: file_names 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:red_squirrel/utils/constants/colors.dart'; 5 | import 'package:flutter_svg/flutter_svg.dart'; 6 | 7 | import 'package:red_squirrel/utils/constants/resources.dart'; 8 | 9 | import 'dart:math'; 10 | 11 | class NavBar extends StatefulWidget { 12 | final Color backgroundColor; 13 | final Color foregroundColor; 14 | 15 | const NavBar({ 16 | super.key, 17 | this.backgroundColor = ThemeColors.secondary, 18 | this.foregroundColor = ThemeColors.progressBarColor, 19 | }); 20 | 21 | @override 22 | State createState() => _NavBarState(); 23 | } 24 | 25 | class _NavBarState extends State { 26 | @override 27 | void initState() { 28 | super.initState(); 29 | } 30 | 31 | @override 32 | Widget build(BuildContext context) { 33 | return Container( 34 | height: 43, 35 | color: ThemeColors.secondary, 36 | child: Row( 37 | mainAxisAlignment: MainAxisAlignment.spaceAround, 38 | children: [ 39 | Transform.rotate( 40 | angle: 180 * pi / 180, 41 | child: SizedBox( 42 | child: IconButton( 43 | padding: const EdgeInsets.all(0.0), 44 | icon: const Icon( 45 | Icons.arrow_forward_rounded, 46 | color: Colors.white, 47 | size: 30, 48 | ), 49 | onPressed: () { 50 | // Handle previous button press 51 | }, 52 | ), 53 | ), 54 | ), 55 | Container( 56 | <<<<<<< HEAD 57 | margin: const EdgeInsets.fromLTRB(0, 0, 0, 4.0), 58 | ======= 59 | margin: EdgeInsets.fromLTRB(0, 0, 0, 4.0), 60 | >>>>>>> 8b45072ed5cb924b5c7e987baa3081bf49be569f 61 | decoration: BoxDecoration( 62 | border: Border.all( 63 | color: 64 | widget.backgroundColor, // Customize the border color here 65 | width: 2.0, // Customize the border width here 66 | ), 67 | shape: BoxShape 68 | .circle, // Set the shape to circle for a rounded border 69 | ), 70 | child: IconButton( 71 | padding: const EdgeInsets.all(0.0), 72 | icon: SvgPicture.asset( 73 | SvgIcons.vector, 74 | width: 36, 75 | height: 36, 76 | ), 77 | onPressed: () { 78 | // Handle previous button press 79 | }, 80 | ), 81 | ), 82 | SizedBox( 83 | child: IconButton( 84 | padding: const EdgeInsets.all(0.0), 85 | icon: const Icon(Icons.refresh, color: Colors.white, size: 30), 86 | onPressed: () { 87 | // Handle previous button press 88 | }, 89 | ), 90 | ), 91 | ], 92 | )); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /lib/widgets/progress_bar.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: file_names 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:getwidget/getwidget.dart'; 5 | import 'package:red_squirrel/utils/constants/colors.dart'; 6 | import 'package:red_squirrel/utils/constants/fonts.dart'; 7 | import 'package:red_squirrel/utils/constants/test_style.dart'; 8 | 9 | import 'dart:math'; 10 | 11 | class ProgressBar extends StatefulWidget { 12 | final int count; 13 | final Color backgroundColor; 14 | final Color foregroundColor; 15 | 16 | const ProgressBar({ 17 | super.key, 18 | required this.count, 19 | this.backgroundColor = ThemeColors.secondary, 20 | this.foregroundColor = ThemeColors.progressBarColor, 21 | }); 22 | 23 | @override 24 | State createState() => _ProgressBarState(); 25 | } 26 | 27 | class _ProgressBarState extends State { 28 | late int count; 29 | int step = 1; 30 | 31 | @override 32 | void initState() { 33 | super.initState(); 34 | count = widget.count; 35 | } 36 | 37 | void next() { 38 | setState(() { 39 | if (step < count) step += 1; 40 | }); 41 | } 42 | 43 | void previous() { 44 | setState(() { 45 | if (step > 1) step -= 1; 46 | }); 47 | } 48 | 49 | @override 50 | Widget build(BuildContext context) { 51 | return Column( 52 | children: [ 53 | Row( 54 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 55 | children: [ 56 | Transform.rotate( 57 | angle: 180 * pi / 180, 58 | child: SizedBox( 59 | child: IconButton( 60 | padding: const EdgeInsets.all(0.0), 61 | icon: Icon(Icons.forward_rounded, 62 | color: step == 1 63 | ? widget.foregroundColor 64 | : widget.backgroundColor, 65 | size: 32.0), 66 | onPressed: () { 67 | previous(); 68 | // Handle previous button press 69 | }, 70 | ), 71 | ), 72 | ), 73 | Text( 74 | '$step / $count', 75 | style: CustomTextStyle.DescText(), 76 | ), 77 | SizedBox( 78 | child: IconButton( 79 | padding: const EdgeInsets.all(5.0), 80 | icon: Icon(Icons.forward_rounded, 81 | color: step == count 82 | ? widget.foregroundColor 83 | : widget.backgroundColor, 84 | size: 32.0), 85 | onPressed: () { 86 | next(); 87 | // Handle next button press 88 | }, 89 | ), 90 | ), 91 | ], 92 | ), 93 | GFProgressBar( 94 | percentage: step / count * 1.0, 95 | lineHeight: 8, 96 | backgroundColor: widget.foregroundColor, 97 | progressBarColor: widget.backgroundColor, 98 | animation: true, 99 | animationDuration: 160, 100 | animateFromLastPercentage: true, 101 | ), 102 | ], 103 | ); 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /lib/widgets/question_label.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: file_names 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:red_squirrel/utils/constants/colors.dart'; 5 | import 'package:red_squirrel/utils/constants/fonts.dart'; 6 | import 'package:red_squirrel/utils/constants/test_style.dart'; 7 | 8 | class QuestionLabel extends StatefulWidget { 9 | final String question; 10 | 11 | const QuestionLabel({ 12 | super.key, 13 | required this.question, 14 | }); 15 | 16 | @override 17 | State createState() => _QuestionLabelState(); 18 | } 19 | 20 | class _QuestionLabelState extends State { 21 | late String question; 22 | 23 | @override 24 | void initState() { 25 | super.initState(); 26 | question = widget.question; 27 | } 28 | 29 | @override 30 | Widget build(BuildContext context) { 31 | return Container( 32 | margin: const EdgeInsets.only( 33 | top: 2, 34 | left: 2, 35 | right: 2, 36 | ), 37 | padding: EdgeInsets.fromLTRB(20, 36, 20, 48), 38 | decoration: BoxDecoration( 39 | borderRadius: BorderRadius.circular(8), 40 | color: Colors.white, 41 | boxShadow: const [ 42 | BoxShadow( 43 | color: Colors.grey, 44 | blurRadius: 2.0, // soften the shadow 45 | spreadRadius: 1.0, 46 | ), 47 | ], 48 | ), 49 | child: Center( 50 | child: Text( 51 | widget.question, 52 | textAlign: TextAlign.left, 53 | softWrap: true, 54 | overflow: TextOverflow.fade, 55 | style: CustomTextStyle.DescText(ThemeColors.secondary, 18, 56 | FontWeight.w600, Fonts.primaryFont, [], 1.8, 0.2), 57 | ), 58 | ), 59 | ); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /lib/widgets/rounded_button.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: file_names 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:red_squirrel/utils/constants/test_style.dart'; 5 | 6 | class RoundedButton extends StatelessWidget { 7 | final String text; 8 | final bool disabled; 9 | final bool outlined; 10 | final Color backgroundColor; 11 | final Color foregroundColor; 12 | final Function onPressed; 13 | 14 | const RoundedButton({ 15 | super.key, 16 | required this.onPressed, 17 | required this.text, 18 | this.disabled = false, 19 | this.outlined = false, 20 | this.backgroundColor = Colors.white, 21 | this.foregroundColor = Colors.black, 22 | }); 23 | 24 | @override 25 | Widget build(BuildContext context) { 26 | final ButtonStyle buttonStyle = ElevatedButton.styleFrom( 27 | foregroundColor: foregroundColor, 28 | backgroundColor: backgroundColor, 29 | padding: const EdgeInsets.symmetric(horizontal: 24), 30 | side: outlined 31 | ? BorderSide( 32 | color: foregroundColor, 33 | width: 2, 34 | style: BorderStyle.solid, 35 | ) 36 | : const BorderSide( 37 | color: Colors.transparent, 38 | width: 2, 39 | ), 40 | textStyle: CustomTextStyle.LabelText(), 41 | shape: const RoundedRectangleBorder( 42 | borderRadius: BorderRadius.all(Radius.circular(24))), 43 | ); 44 | return ElevatedButton( 45 | style: buttonStyle, 46 | onPressed: (!disabled 47 | ? () { 48 | onPressed(); 49 | } 50 | : null), 51 | child: Row( 52 | mainAxisAlignment: MainAxisAlignment.center, children: [Text(text)]), 53 | ); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /lib/widgets/submit_button.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: file_names 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:red_squirrel/utils/constants/colors.dart'; 5 | import 'package:red_squirrel/utils/constants/test_style.dart'; 6 | 7 | class SubmitButton extends StatelessWidget { 8 | final String text; 9 | final bool disabled; 10 | final Color backgroundColor; 11 | final Color foregroundColor; 12 | // final Function onPressed; 13 | 14 | const SubmitButton({ 15 | super.key, 16 | // required this.onPressed, 17 | required this.text, 18 | this.disabled = true, 19 | this.backgroundColor = Colors.white, 20 | this.foregroundColor = ThemeColors.primary, 21 | }); 22 | 23 | @override 24 | Widget build(BuildContext context) { 25 | final ButtonStyle buttonStyle = ElevatedButton.styleFrom( 26 | foregroundColor: foregroundColor, 27 | backgroundColor: backgroundColor, 28 | padding: const EdgeInsets.symmetric(horizontal: 24), 29 | side: BorderSide( 30 | color: disabled ? foregroundColor.withAlpha(80) : foregroundColor, 31 | width: 2, 32 | style: BorderStyle.solid, 33 | ), 34 | shape: const RoundedRectangleBorder( 35 | borderRadius: BorderRadius.all(Radius.circular(24))), 36 | ); 37 | return Container( 38 | margin: const EdgeInsets.symmetric(vertical: 6), 39 | child: ElevatedButton( 40 | style: buttonStyle, 41 | onPressed: (!disabled 42 | ? () { 43 | // onPressed(); 44 | } 45 | : null), 46 | child: Container( 47 | padding: 48 | const EdgeInsets.symmetric(vertical: 11, horizontal: 22), 49 | child: Text( 50 | text, 51 | textAlign: TextAlign.center, 52 | style: CustomTextStyle.DescText( 53 | disabled ? foregroundColor.withAlpha(80) : foregroundColor, 54 | 18, 55 | ), 56 | )))); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /lib/widgets/timer.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: file_names 2 | import 'package:flutter/material.dart'; 3 | import 'package:red_squirrel/utils/constants/colors.dart'; 4 | import 'package:red_squirrel/utils/constants/test_style.dart'; 5 | 6 | class CountTimer extends StatefulWidget { 7 | final int timeDuration; 8 | final Color backgroundColor; 9 | 10 | const CountTimer({ 11 | super.key, 12 | required this.timeDuration, 13 | this.backgroundColor = ThemeColors.counterColor, 14 | }); 15 | 16 | @override 17 | State createState() => _CounterState(); 18 | } 19 | 20 | class _CounterState extends State { 21 | late int timeDuration; 22 | 23 | @override 24 | void initState() { 25 | super.initState(); 26 | timeDuration = widget.timeDuration; 27 | } 28 | 29 | void ticker() { 30 | setState(() { 31 | if (timeDuration > 0) { 32 | timeDuration -= 1; 33 | } 34 | }); 35 | } 36 | 37 | @override 38 | Widget build(BuildContext context) { 39 | String strDigits(int n) => n.toString().padLeft(2, '0'); 40 | final minutes = strDigits((timeDuration / 60).floor()); 41 | final seconds = strDigits(timeDuration % 60); 42 | return Container( 43 | width: 92, 44 | margin: const EdgeInsets.only(top: 2.0), 45 | decoration: BoxDecoration( 46 | borderRadius: BorderRadius.circular(18), 47 | color: widget.backgroundColor), 48 | child: Row( 49 | mainAxisAlignment: MainAxisAlignment.spaceAround, 50 | children: [ 51 | const Icon( 52 | Icons.alarm_sharp, 53 | color: Colors.white, 54 | ), 55 | Container( 56 | padding: const EdgeInsets.symmetric(vertical: 4), 57 | child: Text('$minutes:$seconds', 58 | textAlign: TextAlign.center, 59 | style: CustomTextStyle.DescText( 60 | ThemeColors.label, 18, FontWeight.w400))), 61 | ], 62 | )); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: red_squirrel 2 | description: A new Flutter project. 3 | # The following line prevents the package from being accidentally published to 4 | # pub.dev using `flutter pub publish`. This is preferred for private packages. 5 | publish_to: "none" # Remove this line if you wish to publish to pub.dev 6 | 7 | # The following defines the version and build number for your application. 8 | # A version number is three numbers separated by dots, like 1.2.43 9 | # followed by an optional build number separated by a +. 10 | # Both the version and the builder number may be overridden in flutter 11 | # build by specifying --build-name and --build-number, respectively. 12 | # In Android, build-name is used as versionName while build-number used as versionCode. 13 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 14 | # In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. 15 | # Read more about iOS versioning at 16 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 17 | # In Windows, build-name is used as the major, minor, and patch parts 18 | # of the product and file versions while build-number is used as the build suffix. 19 | version: 1.0.0+1 20 | 21 | environment: 22 | sdk: ">=3.0.5 <4.0.0" 23 | 24 | # Dependencies specify other packages that your package needs in order to work. 25 | # To automatically upgrade your package dependencies to the latest versions 26 | # consider running `flutter pub upgrade --major-versions`. Alternatively, 27 | # dependencies can be manually updated by changing the version numbers below to 28 | # the latest version available on pub.dev. To see which dependencies have newer 29 | # versions available, run `flutter pub outdated`. 30 | dependencies: 31 | flutter: 32 | sdk: flutter 33 | 34 | # The following adds the Cupertino Icons font to your application. 35 | # Use with the CupertinoIcons class for iOS style icons. 36 | cupertino_icons: ^1.0.2 37 | device_preview: ^1.1.0 38 | loader_overlay: ^2.3.0 39 | flutter_bloc: ^8.1.3 40 | flow_builder: ^0.0.9 41 | flutter_svg: ^2.0.7 42 | getwidget: ^3.1.1 43 | blurrycontainer: ^1.0.2 44 | pressable: ^0.5.0 45 | indexed: ^0.0.8 46 | percent_indicator: ^4.2.3 47 | 48 | dev_dependencies: 49 | flutter_test: 50 | sdk: flutter 51 | 52 | # The "flutter_lints" package below contains a set of recommended lints to 53 | # encourage good coding practices. The lint set provided by the package is 54 | # activated in the `analysis_options.yaml` file located at the root of your 55 | # package. See that file for information about deactivating specific lint 56 | # rules and activating additional ones. 57 | flutter_lints: ^2.0.0 58 | 59 | # For information on the generic Dart part of this file, see the 60 | # following page: https://dart.dev/tools/pub/pubspec 61 | 62 | # The following section is specific to Flutter packages. 63 | flutter: 64 | # The following line ensures that the Material Icons font is 65 | # included with your application, so that you can use the icons in 66 | # the material Icons class. 67 | uses-material-design: true 68 | 69 | assets: 70 | - assets/images/ 71 | - assets/icons/ 72 | # To add assets to your application, add an assets section, like this: 73 | # assets: 74 | # - images/a_dot_burr.jpeg 75 | # - images/a_dot_ham.jpeg 76 | 77 | # An image asset can refer to one or more resolution-specific "variants", see 78 | # https://flutter.dev/assets-and-images/#resolution-aware 79 | 80 | # For details regarding adding assets from package dependencies, see 81 | # https://flutter.dev/assets-and-images/#from-packages 82 | 83 | # To add custom fonts to your application, add a fonts section here, 84 | # in this "flutter" section. Each entry in this list should have a 85 | # "family" key with the font family name, and a "fonts" key with a 86 | # list giving the asset and other descriptors for the font. For 87 | # example: 88 | # fonts: 89 | # - family: Schyler 90 | # fonts: 91 | # - asset: fonts/Schyler-Regular.ttf 92 | # - asset: fonts/Schyler-Italic.ttf 93 | # style: italic 94 | # - family: Trajan Pro 95 | # fonts: 96 | # - asset: fonts/TrajanPro.ttf 97 | # - asset: fonts/TrajanPro_Bold.ttf 98 | # weight: 700 99 | fonts: 100 | - family: PoetsenOne 101 | fonts: 102 | - asset: assets/fonts/PoetsenOne-Regular.ttf 103 | - family: Arial 104 | fonts: 105 | - asset: assets/fonts/Arial-Regular.ttf 106 | # 107 | # For details regarding fonts from package dependencies, 108 | # see https://flutter.dev/custom-fonts/#from-packages 109 | -------------------------------------------------------------------------------- /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:red_squirrel/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(const MyApp()); 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 | -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/web/favicon.png -------------------------------------------------------------------------------- /web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/web/icons/Icon-192.png -------------------------------------------------------------------------------- /web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/web/icons/Icon-512.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | red_squirrel 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "red_squirrel", 3 | "short_name": "red_squirrel", 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/.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 | -------------------------------------------------------------------------------- /windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.14) 3 | project(red_squirrel 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 "red_squirrel") 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 | 56 | # Generated plugin build rules, which manage building the plugins and adding 57 | # them to the application. 58 | include(flutter/generated_plugins.cmake) 59 | 60 | 61 | # === Installation === 62 | # Support files are copied into place next to the executable, so that it can 63 | # run in place. This is done instead of making a separate bundle (as on Linux) 64 | # so that building and running from within Visual Studio will work. 65 | set(BUILD_BUNDLE_DIR "$") 66 | # Make the "install" step default, as it's required to run. 67 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 68 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 69 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 70 | endif() 71 | 72 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 73 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 74 | 75 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 76 | COMPONENT Runtime) 77 | 78 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 79 | COMPONENT Runtime) 80 | 81 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 82 | COMPONENT Runtime) 83 | 84 | if(PLUGIN_BUNDLED_LIBRARIES) 85 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 86 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 87 | COMPONENT Runtime) 88 | endif() 89 | 90 | # Fully re-copy the assets directory on each build to avoid having stale files 91 | # from a previous install. 92 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 93 | install(CODE " 94 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 95 | " COMPONENT Runtime) 96 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 97 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 98 | 99 | # Install the AOT library on non-Debug builds only. 100 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 101 | CONFIGURATIONS Profile;Release 102 | COMPONENT Runtime) 103 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | 10 | void RegisterPlugins(flutter::PluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /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_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib") 37 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 38 | 39 | # Run the Flutter tool portions of the build. This must not be removed. 40 | add_dependencies(${BINARY_NAME} flutter_assemble) 41 | -------------------------------------------------------------------------------- /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", "red_squirrel" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "red_squirrel" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2023 com.example. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "red_squirrel.exe" "\0" 98 | VALUE "ProductName", "red_squirrel" "\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/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 | 30 | flutter_controller_->engine()->SetNextFrameCallback([&]() { 31 | this->Show(); 32 | }); 33 | 34 | return true; 35 | } 36 | 37 | void FlutterWindow::OnDestroy() { 38 | if (flutter_controller_) { 39 | flutter_controller_ = nullptr; 40 | } 41 | 42 | Win32Window::OnDestroy(); 43 | } 44 | 45 | LRESULT 46 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 47 | WPARAM const wparam, 48 | LPARAM const lparam) noexcept { 49 | // Give Flutter, including plugins, an opportunity to handle window messages. 50 | if (flutter_controller_) { 51 | std::optional result = 52 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 53 | lparam); 54 | if (result) { 55 | return *result; 56 | } 57 | } 58 | 59 | switch (message) { 60 | case WM_FONTCHANGE: 61 | flutter_controller_->engine()->ReloadSystemFonts(); 62 | break; 63 | } 64 | 65 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 66 | } 67 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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.Create(L"red_squirrel", 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Yummo8/citizen-app-flutter/42d3a5d00422011d5d872b4fd566e3a0f0f3b7e4/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -1; // remove the trailing null character 52 | int input_length = (int)wcslen(utf16_string); 53 | std::string utf8_string; 54 | if (target_length <= 0 || target_length > utf8_string.max_size()) { 55 | return utf8_string; 56 | } 57 | utf8_string.resize(target_length); 58 | int converted_length = ::WideCharToMultiByte( 59 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 60 | input_length, utf8_string.data(), target_length, nullptr, nullptr); 61 | if (converted_length == 0) { 62 | return std::string(); 63 | } 64 | return utf8_string; 65 | } 66 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /windows/runner/win32_window.cpp: -------------------------------------------------------------------------------- 1 | #include "win32_window.h" 2 | 3 | #include 4 | #include 5 | 6 | #include "resource.h" 7 | 8 | namespace { 9 | 10 | /// Window attribute that enables dark mode window decorations. 11 | /// 12 | /// Redefined in case the developer's machine has a Windows SDK older than 13 | /// version 10.0.22000.0. 14 | /// See: https://docs.microsoft.com/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute 15 | #ifndef DWMWA_USE_IMMERSIVE_DARK_MODE 16 | #define DWMWA_USE_IMMERSIVE_DARK_MODE 20 17 | #endif 18 | 19 | constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; 20 | 21 | /// Registry key for app theme preference. 22 | /// 23 | /// A value of 0 indicates apps should use dark mode. A non-zero or missing 24 | /// value indicates apps should use light mode. 25 | constexpr const wchar_t kGetPreferredBrightnessRegKey[] = 26 | L"Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize"; 27 | constexpr const wchar_t kGetPreferredBrightnessRegValue[] = L"AppsUseLightTheme"; 28 | 29 | // The number of Win32Window objects that currently exist. 30 | static int g_active_window_count = 0; 31 | 32 | using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); 33 | 34 | // Scale helper to convert logical scaler values to physical using passed in 35 | // scale factor 36 | int Scale(int source, double scale_factor) { 37 | return static_cast(source * scale_factor); 38 | } 39 | 40 | // Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. 41 | // This API is only needed for PerMonitor V1 awareness mode. 42 | void EnableFullDpiSupportIfAvailable(HWND hwnd) { 43 | HMODULE user32_module = LoadLibraryA("User32.dll"); 44 | if (!user32_module) { 45 | return; 46 | } 47 | auto enable_non_client_dpi_scaling = 48 | reinterpret_cast( 49 | GetProcAddress(user32_module, "EnableNonClientDpiScaling")); 50 | if (enable_non_client_dpi_scaling != nullptr) { 51 | enable_non_client_dpi_scaling(hwnd); 52 | } 53 | FreeLibrary(user32_module); 54 | } 55 | 56 | } // namespace 57 | 58 | // Manages the Win32Window's window class registration. 59 | class WindowClassRegistrar { 60 | public: 61 | ~WindowClassRegistrar() = default; 62 | 63 | // Returns the singleton registrar instance. 64 | static WindowClassRegistrar* GetInstance() { 65 | if (!instance_) { 66 | instance_ = new WindowClassRegistrar(); 67 | } 68 | return instance_; 69 | } 70 | 71 | // Returns the name of the window class, registering the class if it hasn't 72 | // previously been registered. 73 | const wchar_t* GetWindowClass(); 74 | 75 | // Unregisters the window class. Should only be called if there are no 76 | // instances of the window. 77 | void UnregisterWindowClass(); 78 | 79 | private: 80 | WindowClassRegistrar() = default; 81 | 82 | static WindowClassRegistrar* instance_; 83 | 84 | bool class_registered_ = false; 85 | }; 86 | 87 | WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; 88 | 89 | const wchar_t* WindowClassRegistrar::GetWindowClass() { 90 | if (!class_registered_) { 91 | WNDCLASS window_class{}; 92 | window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); 93 | window_class.lpszClassName = kWindowClassName; 94 | window_class.style = CS_HREDRAW | CS_VREDRAW; 95 | window_class.cbClsExtra = 0; 96 | window_class.cbWndExtra = 0; 97 | window_class.hInstance = GetModuleHandle(nullptr); 98 | window_class.hIcon = 99 | LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); 100 | window_class.hbrBackground = 0; 101 | window_class.lpszMenuName = nullptr; 102 | window_class.lpfnWndProc = Win32Window::WndProc; 103 | RegisterClass(&window_class); 104 | class_registered_ = true; 105 | } 106 | return kWindowClassName; 107 | } 108 | 109 | void WindowClassRegistrar::UnregisterWindowClass() { 110 | UnregisterClass(kWindowClassName, nullptr); 111 | class_registered_ = false; 112 | } 113 | 114 | Win32Window::Win32Window() { 115 | ++g_active_window_count; 116 | } 117 | 118 | Win32Window::~Win32Window() { 119 | --g_active_window_count; 120 | Destroy(); 121 | } 122 | 123 | bool Win32Window::Create(const std::wstring& title, 124 | const Point& origin, 125 | const Size& size) { 126 | Destroy(); 127 | 128 | const wchar_t* window_class = 129 | WindowClassRegistrar::GetInstance()->GetWindowClass(); 130 | 131 | const POINT target_point = {static_cast(origin.x), 132 | static_cast(origin.y)}; 133 | HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); 134 | UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); 135 | double scale_factor = dpi / 96.0; 136 | 137 | HWND window = CreateWindow( 138 | window_class, title.c_str(), WS_OVERLAPPEDWINDOW, 139 | Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), 140 | Scale(size.width, scale_factor), Scale(size.height, scale_factor), 141 | nullptr, nullptr, GetModuleHandle(nullptr), this); 142 | 143 | if (!window) { 144 | return false; 145 | } 146 | 147 | UpdateTheme(window); 148 | 149 | return OnCreate(); 150 | } 151 | 152 | bool Win32Window::Show() { 153 | return ShowWindow(window_handle_, SW_SHOWNORMAL); 154 | } 155 | 156 | // static 157 | LRESULT CALLBACK Win32Window::WndProc(HWND const window, 158 | UINT const message, 159 | WPARAM const wparam, 160 | LPARAM const lparam) noexcept { 161 | if (message == WM_NCCREATE) { 162 | auto window_struct = reinterpret_cast(lparam); 163 | SetWindowLongPtr(window, GWLP_USERDATA, 164 | reinterpret_cast(window_struct->lpCreateParams)); 165 | 166 | auto that = static_cast(window_struct->lpCreateParams); 167 | EnableFullDpiSupportIfAvailable(window); 168 | that->window_handle_ = window; 169 | } else if (Win32Window* that = GetThisFromHandle(window)) { 170 | return that->MessageHandler(window, message, wparam, lparam); 171 | } 172 | 173 | return DefWindowProc(window, message, wparam, lparam); 174 | } 175 | 176 | LRESULT 177 | Win32Window::MessageHandler(HWND hwnd, 178 | UINT const message, 179 | WPARAM const wparam, 180 | LPARAM const lparam) noexcept { 181 | switch (message) { 182 | case WM_DESTROY: 183 | window_handle_ = nullptr; 184 | Destroy(); 185 | if (quit_on_close_) { 186 | PostQuitMessage(0); 187 | } 188 | return 0; 189 | 190 | case WM_DPICHANGED: { 191 | auto newRectSize = reinterpret_cast(lparam); 192 | LONG newWidth = newRectSize->right - newRectSize->left; 193 | LONG newHeight = newRectSize->bottom - newRectSize->top; 194 | 195 | SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, 196 | newHeight, SWP_NOZORDER | SWP_NOACTIVATE); 197 | 198 | return 0; 199 | } 200 | case WM_SIZE: { 201 | RECT rect = GetClientArea(); 202 | if (child_content_ != nullptr) { 203 | // Size and position the child window. 204 | MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, 205 | rect.bottom - rect.top, TRUE); 206 | } 207 | return 0; 208 | } 209 | 210 | case WM_ACTIVATE: 211 | if (child_content_ != nullptr) { 212 | SetFocus(child_content_); 213 | } 214 | return 0; 215 | 216 | case WM_DWMCOLORIZATIONCOLORCHANGED: 217 | UpdateTheme(hwnd); 218 | return 0; 219 | } 220 | 221 | return DefWindowProc(window_handle_, message, wparam, lparam); 222 | } 223 | 224 | void Win32Window::Destroy() { 225 | OnDestroy(); 226 | 227 | if (window_handle_) { 228 | DestroyWindow(window_handle_); 229 | window_handle_ = nullptr; 230 | } 231 | if (g_active_window_count == 0) { 232 | WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); 233 | } 234 | } 235 | 236 | Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { 237 | return reinterpret_cast( 238 | GetWindowLongPtr(window, GWLP_USERDATA)); 239 | } 240 | 241 | void Win32Window::SetChildContent(HWND content) { 242 | child_content_ = content; 243 | SetParent(content, window_handle_); 244 | RECT frame = GetClientArea(); 245 | 246 | MoveWindow(content, frame.left, frame.top, frame.right - frame.left, 247 | frame.bottom - frame.top, true); 248 | 249 | SetFocus(child_content_); 250 | } 251 | 252 | RECT Win32Window::GetClientArea() { 253 | RECT frame; 254 | GetClientRect(window_handle_, &frame); 255 | return frame; 256 | } 257 | 258 | HWND Win32Window::GetHandle() { 259 | return window_handle_; 260 | } 261 | 262 | void Win32Window::SetQuitOnClose(bool quit_on_close) { 263 | quit_on_close_ = quit_on_close; 264 | } 265 | 266 | bool Win32Window::OnCreate() { 267 | // No-op; provided for subclasses. 268 | return true; 269 | } 270 | 271 | void Win32Window::OnDestroy() { 272 | // No-op; provided for subclasses. 273 | } 274 | 275 | void Win32Window::UpdateTheme(HWND const window) { 276 | DWORD light_mode; 277 | DWORD light_mode_size = sizeof(light_mode); 278 | LSTATUS result = RegGetValue(HKEY_CURRENT_USER, kGetPreferredBrightnessRegKey, 279 | kGetPreferredBrightnessRegValue, 280 | RRF_RT_REG_DWORD, nullptr, &light_mode, 281 | &light_mode_size); 282 | 283 | if (result == ERROR_SUCCESS) { 284 | BOOL enable_dark_mode = light_mode == 0; 285 | DwmSetWindowAttribute(window, DWMWA_USE_IMMERSIVE_DARK_MODE, 286 | &enable_dark_mode, sizeof(enable_dark_mode)); 287 | } 288 | } 289 | -------------------------------------------------------------------------------- /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 a win32 window with |title| that is positioned and sized 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 this function will scale the inputted width and height as 35 | // as appropriate for the default monitor. The window is invisible until 36 | // |Show| is called. Returns true if the window was created successfully. 37 | bool Create(const std::wstring& title, const Point& origin, const Size& size); 38 | 39 | // Show the current window. Returns true if the window was successfully shown. 40 | bool Show(); 41 | 42 | // Release OS resources associated with window. 43 | void Destroy(); 44 | 45 | // Inserts |content| into the window tree. 46 | void SetChildContent(HWND content); 47 | 48 | // Returns the backing Window handle to enable clients to set icon and other 49 | // window properties. Returns nullptr if the window has been destroyed. 50 | HWND GetHandle(); 51 | 52 | // If true, closing this window will quit the application. 53 | void SetQuitOnClose(bool quit_on_close); 54 | 55 | // Return a RECT representing the bounds of the current client area. 56 | RECT GetClientArea(); 57 | 58 | protected: 59 | // Processes and route salient window messages for mouse handling, 60 | // size change and DPI. Delegates handling of these to member overloads that 61 | // inheriting classes can handle. 62 | virtual LRESULT MessageHandler(HWND window, 63 | UINT const message, 64 | WPARAM const wparam, 65 | LPARAM const lparam) noexcept; 66 | 67 | // Called when CreateAndShow is called, allowing subclass window-related 68 | // setup. Subclasses should return false if setup fails. 69 | virtual bool OnCreate(); 70 | 71 | // Called when Destroy is called. 72 | virtual void OnDestroy(); 73 | 74 | private: 75 | friend class WindowClassRegistrar; 76 | 77 | // OS callback called by message pump. Handles the WM_NCCREATE message which 78 | // is passed when the non-client area is being created and enables automatic 79 | // non-client DPI scaling so that the non-client area automatically 80 | // responds to changes in DPI. All other messages are handled by 81 | // MessageHandler. 82 | static LRESULT CALLBACK WndProc(HWND const window, 83 | UINT const message, 84 | WPARAM const wparam, 85 | LPARAM const lparam) noexcept; 86 | 87 | // Retrieves a class instance pointer for |window| 88 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 89 | 90 | // Update the window frame's theme to match the system theme. 91 | static void UpdateTheme(HWND const window); 92 | 93 | bool quit_on_close_ = false; 94 | 95 | // window handle for top level window. 96 | HWND window_handle_ = nullptr; 97 | 98 | // window handle for hosted content. 99 | HWND child_content_ = nullptr; 100 | }; 101 | 102 | #endif // RUNNER_WIN32_WINDOW_H_ 103 | --------------------------------------------------------------------------------