├── .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
│ │ │ │ └── twitch_best_practices
│ │ │ │ └── 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
├── assets
└── img
│ ├── img_women.png
│ └── img_yogurtland.png
├── ios
├── .gitignore
├── Flutter
│ ├── AppFrameworkInfo.plist
│ ├── Debug.xcconfig
│ └── Release.xcconfig
├── Podfile
├── Podfile.lock
├── 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
├── core
│ └── base
│ │ ├── view
│ │ ├── base_stateless.dart
│ │ └── i_base_view.dart
│ │ └── viewModel
│ │ └── i_base_viewmodel.dart
├── feature
│ ├── custom_dialog
│ │ ├── ali_keles_view.dart
│ │ ├── custom_dialog_view.dart
│ │ ├── custom_radios_dialog.dart
│ │ ├── text_field_dialog.dart
│ │ └── text_field_rounded.dart
│ ├── login
│ │ ├── loading_state.dart
│ │ ├── model
│ │ │ ├── login_data_model.dart
│ │ │ └── login_model.dart
│ │ ├── project_general.dart
│ │ ├── service
│ │ │ └── login_service.dart
│ │ ├── view
│ │ │ └── login_view.dart
│ │ └── viewModel
│ │ │ └── login_viewmodel.dart
│ ├── status
│ │ ├── status_model.dart
│ │ ├── status_operation.dart
│ │ ├── status_view.dart
│ │ ├── status_view_mixin.dart
│ │ └── validator
│ │ │ ├── online_validator.dart
│ │ │ └── validator_status.dart
│ └── text_field_bottom_sheet
│ │ ├── text_bottom_mixin.dart
│ │ ├── text_bottom_sheet.dart
│ │ └── text_field_bottom_sheet_view.dart
├── main.dart
└── speed_code
│ ├── authentic
│ ├── authentic_board.dart
│ └── authentic_on_board.dart
│ ├── chat_william
│ ├── chat_bottom.dart
│ ├── chat_william_view.dart
│ ├── model
│ │ ├── chat_user.dart
│ │ └── list_chat.dart
│ ├── user_appbar.dart
│ └── utility
│ │ ├── chat_page_size.dart
│ │ └── space_box.dart
│ ├── ice_cream
│ ├── ice_cream_view.dart
│ └── widget
│ │ ├── ice_app_bar.dart
│ │ └── ice_card.dart
│ ├── lang_app
│ ├── custom_decoration.dart
│ ├── lang_app_view.dart
│ ├── lang_dropdown.dart
│ └── widget
│ │ ├── course_grid.dart
│ │ └── today_challange_card.dart
│ ├── rent
│ ├── rent_model.dart
│ ├── rent_view.dart
│ ├── rent_view_mixin.dart
│ ├── view
│ │ ├── project_padding.dart
│ │ ├── project_radius.dart
│ │ ├── rent_card.dart
│ │ └── rent_view_items.dart
│ └── widget
│ │ └── outline_style.dart
│ └── reset_password
│ ├── reset_password_mixin.dart
│ ├── reset_password_validator.dart
│ ├── reset_password_view.dart
│ ├── reset_password_widgets.dart
│ └── visible_eye.dart
├── linux
├── .gitignore
├── CMakeLists.txt
├── flutter
│ ├── CMakeLists.txt
│ ├── generated_plugin_registrant.cc
│ ├── generated_plugin_registrant.h
│ └── generated_plugins.cmake
├── main.cc
├── my_application.cc
└── my_application.h
├── macos
├── .gitignore
├── Flutter
│ ├── Flutter-Debug.xcconfig
│ ├── Flutter-Release.xcconfig
│ └── GeneratedPluginRegistrant.swift
├── Podfile
├── Runner.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
├── Runner
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ │ └── AppIcon.appiconset
│ │ │ ├── Contents.json
│ │ │ ├── app_icon_1024.png
│ │ │ ├── app_icon_128.png
│ │ │ ├── app_icon_16.png
│ │ │ ├── app_icon_256.png
│ │ │ ├── app_icon_32.png
│ │ │ ├── app_icon_512.png
│ │ │ └── app_icon_64.png
│ ├── Base.lproj
│ │ └── MainMenu.xib
│ ├── Configs
│ │ ├── AppInfo.xcconfig
│ │ ├── Debug.xcconfig
│ │ ├── Release.xcconfig
│ │ └── Warnings.xcconfig
│ ├── DebugProfile.entitlements
│ ├── Info.plist
│ ├── MainFlutterWindow.swift
│ └── Release.entitlements
└── RunnerTests
│ └── RunnerTests.swift
├── pubspec.lock
├── pubspec.yaml
├── test
└── widget_test.dart
├── theme.png
├── 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 and should not be manually edited.
5 |
6 | version:
7 | revision: "e1e47221e86272429674bec4f1bd36acc4fc7b77"
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: e1e47221e86272429674bec4f1bd36acc4fc7b77
17 | base_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77
18 | - platform: android
19 | create_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77
20 | base_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77
21 | - platform: ios
22 | create_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77
23 | base_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77
24 | - platform: linux
25 | create_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77
26 | base_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77
27 | - platform: macos
28 | create_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77
29 | base_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77
30 | - platform: web
31 | create_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77
32 | base_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77
33 | - platform: windows
34 | create_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77
35 | base_revision: e1e47221e86272429674bec4f1bd36acc4fc7b77
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 | "docwriter.hotkey.mac": "⌥ + ."
3 | }
4 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | # Flutter refactoring
3 |
4 | Sende kendi projende veya yazdığın bir kodun daha iyisi nasıl olurdu düşüncesi nasıl eklenirdi diye düşünüyorsan bir pr kadar yakınındayım
5 |
6 | ## Kurallar
7 |
8 | Amaç bir işi senin çözemediğin bir sorunu çözmek değil asla. Bir çözülmüş yazılmış öyle veya böyle çalışan kodun daha nasıl iyi olabileceğini tartışmak
9 | - PR atarken kendi kodunuzu bir klasör altına açmalısınız
10 | - Bu kod kesinlikle çalışıyor ve bir ekranda kendi sample_view.dart gibi dosyada çalışıyor olmalı.
11 |
12 | Çalışmayan kodlar, komple proje veya bir iş yaptırma çabası yani topluluğu değil kendini düşünenler önce yayında sövülüp üstüne vb den ban yiyecektir
13 |
14 |
15 | ## Features
16 |
17 | - Status model refactoring
18 |
[](https://youtu.be/D_9WeK8L6Rw)
19 |
20 |
21 | ## Badges
22 |
23 | [](https://choosealicense.com/licenses/mit/)
24 |
25 | ## FAQ
26 |
27 | #### Nasıl ulaşabilirim
28 |
29 | Pr dışında kabül etmeyeceğim ama sorularını twitch yayınlarından gelip sorabilirsin.
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/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:very_good_analysis/analysis_options.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 https://dart.dev/lints.
17 | #
18 | # Instead of disabling a lint rule for the entire project in the
19 | # section below, it can also be suppressed for a single line of code
20 | # or a specific dart file by using the `// ignore: name_of_lint` and
21 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file
22 | # producing the lint.
23 | rules:
24 | public_member_api_docs: false
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 | # Additional information about this file can be found at
28 | # https://dart.dev/guides/language/analysis-options
29 |
--------------------------------------------------------------------------------
/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 | plugins {
2 | id "com.android.application"
3 | id "kotlin-android"
4 | id "dev.flutter.flutter-gradle-plugin"
5 | }
6 |
7 | def localProperties = new Properties()
8 | def localPropertiesFile = rootProject.file('local.properties')
9 | if (localPropertiesFile.exists()) {
10 | localPropertiesFile.withReader('UTF-8') { reader ->
11 | localProperties.load(reader)
12 | }
13 | }
14 |
15 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
16 | if (flutterVersionCode == null) {
17 | flutterVersionCode = '1'
18 | }
19 |
20 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
21 | if (flutterVersionName == null) {
22 | flutterVersionName = '1.0'
23 | }
24 |
25 | android {
26 | namespace "com.example.twitch_best_practices"
27 | compileSdkVersion flutter.compileSdkVersion
28 | ndkVersion flutter.ndkVersion
29 |
30 | compileOptions {
31 | sourceCompatibility JavaVersion.VERSION_1_8
32 | targetCompatibility JavaVersion.VERSION_1_8
33 | }
34 |
35 | kotlinOptions {
36 | jvmTarget = '1.8'
37 | }
38 |
39 | sourceSets {
40 | main.java.srcDirs += 'src/main/kotlin'
41 | }
42 |
43 | defaultConfig {
44 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
45 | applicationId "com.example.twitch_best_practices"
46 | // You can update the following values to match your application needs.
47 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
48 | minSdkVersion flutter.minSdkVersion
49 | targetSdkVersion flutter.targetSdkVersion
50 | versionCode flutterVersionCode.toInteger()
51 | versionName flutterVersionName
52 | }
53 |
54 | buildTypes {
55 | release {
56 | // TODO: Add your own signing config for the release build.
57 | // Signing with the debug keys for now, so `flutter run --release` works.
58 | signingConfig signingConfigs.debug
59 | }
60 | }
61 | }
62 |
63 | flutter {
64 | source '../..'
65 | }
66 |
67 | dependencies {}
68 |
--------------------------------------------------------------------------------
/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/twitch_best_practices/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.twitch_best_practices
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/VB10/twitch_best_practices/bca79f6a66b2ef02bf5b90c99d8bcff3c1d56e62/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VB10/twitch_best_practices/bca79f6a66b2ef02bf5b90c99d8bcff3c1d56e62/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VB10/twitch_best_practices/bca79f6a66b2ef02bf5b90c99d8bcff3c1d56e62/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VB10/twitch_best_practices/bca79f6a66b2ef02bf5b90c99d8bcff3c1d56e62/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VB10/twitch_best_practices/bca79f6a66b2ef02bf5b90c99d8bcff3c1d56e62/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 | pluginManagement {
2 | def flutterSdkPath = {
3 | def properties = new Properties()
4 | file("local.properties").withInputStream { properties.load(it) }
5 | def flutterSdkPath = properties.getProperty("flutter.sdk")
6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
7 | return flutterSdkPath
8 | }
9 | settings.ext.flutterSdkPath = flutterSdkPath()
10 |
11 | includeBuild("${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle")
12 |
13 | plugins {
14 | id "dev.flutter.flutter-gradle-plugin" version "1.0.0" apply false
15 | }
16 | }
17 |
18 | include ":app"
19 |
20 | apply from: "${settings.ext.flutterSdkPath}/packages/flutter_tools/gradle/app_plugin_loader.gradle"
21 |
--------------------------------------------------------------------------------
/assets/img/img_women.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VB10/twitch_best_practices/bca79f6a66b2ef02bf5b90c99d8bcff3c1d56e62/assets/img/img_women.png
--------------------------------------------------------------------------------
/assets/img/img_yogurtland.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VB10/twitch_best_practices/bca79f6a66b2ef02bf5b90c99d8bcff3c1d56e62/assets/img/img_yogurtland.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? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | # platform :ios, '11.0'
3 |
4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6 |
7 | project 'Runner', {
8 | 'Debug' => :debug,
9 | 'Profile' => :release,
10 | 'Release' => :release,
11 | }
12 |
13 | def flutter_root
14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15 | unless File.exist?(generated_xcode_build_settings_path)
16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17 | end
18 |
19 | File.foreach(generated_xcode_build_settings_path) do |line|
20 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
21 | return matches[1].strip if matches
22 | end
23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24 | end
25 |
26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27 |
28 | flutter_ios_podfile_setup
29 |
30 | target 'Runner' do
31 | use_frameworks!
32 | use_modular_headers!
33 |
34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
35 | target 'RunnerTests' do
36 | inherit! :search_paths
37 | end
38 | end
39 |
40 | post_install do |installer|
41 | installer.pods_project.targets.each do |target|
42 | flutter_additional_ios_build_settings(target)
43 | end
44 | end
45 |
--------------------------------------------------------------------------------
/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - device_info_plus (0.0.1):
3 | - Flutter
4 | - Flutter (1.0.0)
5 | - package_info_plus (0.4.5):
6 | - Flutter
7 | - path_provider_foundation (0.0.1):
8 | - Flutter
9 | - FlutterMacOS
10 | - share_plus (0.0.1):
11 | - Flutter
12 | - url_launcher_ios (0.0.1):
13 | - Flutter
14 |
15 | DEPENDENCIES:
16 | - device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
17 | - Flutter (from `Flutter`)
18 | - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
19 | - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
20 | - share_plus (from `.symlinks/plugins/share_plus/ios`)
21 | - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
22 |
23 | EXTERNAL SOURCES:
24 | device_info_plus:
25 | :path: ".symlinks/plugins/device_info_plus/ios"
26 | Flutter:
27 | :path: Flutter
28 | package_info_plus:
29 | :path: ".symlinks/plugins/package_info_plus/ios"
30 | path_provider_foundation:
31 | :path: ".symlinks/plugins/path_provider_foundation/darwin"
32 | share_plus:
33 | :path: ".symlinks/plugins/share_plus/ios"
34 | url_launcher_ios:
35 | :path: ".symlinks/plugins/url_launcher_ios/ios"
36 |
37 | SPEC CHECKSUMS:
38 | device_info_plus: 7545d84d8d1b896cb16a4ff98c19f07ec4b298ea
39 | Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
40 | package_info_plus: fd030dabf36271f146f1f3beacd48f564b0f17f7
41 | path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
42 | share_plus: 599aa54e4ea31d4b4c0e9c911bcc26c55e791028
43 | url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
44 |
45 | PODFILE CHECKSUM: 70d9d25280d0dd177a5f637cdb0f0b0b12c6a189
46 |
47 | COCOAPODS: 1.13.0
48 |
--------------------------------------------------------------------------------
/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 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/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/VB10/twitch_best_practices/bca79f6a66b2ef02bf5b90c99d8bcff3c1d56e62/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/VB10/twitch_best_practices/bca79f6a66b2ef02bf5b90c99d8bcff3c1d56e62/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/VB10/twitch_best_practices/bca79f6a66b2ef02bf5b90c99d8bcff3c1d56e62/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/VB10/twitch_best_practices/bca79f6a66b2ef02bf5b90c99d8bcff3c1d56e62/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/VB10/twitch_best_practices/bca79f6a66b2ef02bf5b90c99d8bcff3c1d56e62/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/VB10/twitch_best_practices/bca79f6a66b2ef02bf5b90c99d8bcff3c1d56e62/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/VB10/twitch_best_practices/bca79f6a66b2ef02bf5b90c99d8bcff3c1d56e62/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/VB10/twitch_best_practices/bca79f6a66b2ef02bf5b90c99d8bcff3c1d56e62/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/VB10/twitch_best_practices/bca79f6a66b2ef02bf5b90c99d8bcff3c1d56e62/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/VB10/twitch_best_practices/bca79f6a66b2ef02bf5b90c99d8bcff3c1d56e62/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/VB10/twitch_best_practices/bca79f6a66b2ef02bf5b90c99d8bcff3c1d56e62/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/VB10/twitch_best_practices/bca79f6a66b2ef02bf5b90c99d8bcff3c1d56e62/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/VB10/twitch_best_practices/bca79f6a66b2ef02bf5b90c99d8bcff3c1d56e62/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/VB10/twitch_best_practices/bca79f6a66b2ef02bf5b90c99d8bcff3c1d56e62/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/VB10/twitch_best_practices/bca79f6a66b2ef02bf5b90c99d8bcff3c1d56e62/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/VB10/twitch_best_practices/bca79f6a66b2ef02bf5b90c99d8bcff3c1d56e62/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VB10/twitch_best_practices/bca79f6a66b2ef02bf5b90c99d8bcff3c1d56e62/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/VB10/twitch_best_practices/bca79f6a66b2ef02bf5b90c99d8bcff3c1d56e62/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 | Twitch Best Practices
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | twitch_best_practices
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 | CADisableMinimumFrameDurationOnPhone
45 |
46 | UIApplicationSupportsIndirectInputEvents
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/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/core/base/view/base_stateless.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:twitch_best_practices/core/base/viewModel/i_base_viewmodel.dart';
3 |
4 | mixin BaseState
5 | on State {
6 | @override
7 | Widget build(BuildContext context) => customBuild(context);
8 |
9 | /// set your view model
10 | T get viewModel;
11 |
12 | /// make your custom widget
13 | Widget customBuild(BuildContext context);
14 |
15 | /// call this method for your ui operation before drawing ui
16 | void onInitialize();
17 |
18 | @override
19 | void initState() {
20 | super.initState();
21 | onInitialize.call();
22 | WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
23 | viewModel.init();
24 | });
25 | }
26 |
27 | @override
28 | void dispose() {
29 | super.dispose();
30 | viewModel.reset();
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/lib/core/base/view/i_base_view.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:stacked/stacked.dart';
3 |
4 | import 'package:twitch_best_practices/core/base/viewModel/i_base_viewmodel.dart'
5 | show IBaseViewModel;
6 |
7 | class IBaseView extends StatelessWidget {
8 | const IBaseView({
9 | required this.viewModel,
10 | required this.builder,
11 | super.key,
12 | this.loadingWidget,
13 | this.onModelReady,
14 | });
15 |
16 | final Widget Function(T model) builder;
17 |
18 | final T viewModel;
19 | final Widget? loadingWidget;
20 |
21 | final dynamic Function(T? model)? onModelReady;
22 |
23 | @override
24 | Widget build(BuildContext context) {
25 | return ViewModelBuilder.reactive(
26 | disposeViewModel: false,
27 | onDispose: (viewModel) => viewModel.reset(),
28 | viewModelBuilder: () => viewModel,
29 | builder: (_, T? model, __) => builder(model!),
30 | onViewModelReady: (T? viewModel) async {
31 | if (onModelReady == null) {
32 | await viewModel?.init();
33 | } else {
34 | await onModelReady!(viewModel);
35 | }
36 | },
37 | );
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/lib/core/base/viewModel/i_base_viewmodel.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/cupertino.dart';
2 |
3 | abstract class IBaseViewModel extends ChangeNotifier {
4 | Future init();
5 |
6 | void reset();
7 | }
8 |
--------------------------------------------------------------------------------
/lib/feature/custom_dialog/ali_keles_view.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:twitch_best_practices/feature/custom_dialog/custom_dialog_view.dart';
3 | import 'package:twitch_best_practices/feature/custom_dialog/text_field_rounded.dart';
4 |
5 | class AliKelesView extends StatefulWidget {
6 | const AliKelesView({super.key});
7 | @override
8 | State createState() => _AliKelesViewState();
9 | }
10 |
11 | class _AliKelesViewState extends State {
12 | @override
13 | Widget build(BuildContext context) {
14 | return Scaffold(
15 | appBar: AppBar(),
16 | floatingActionButton: FloatingActionButton(
17 | onPressed: () async {
18 | final response = await CustomDialog.showDialogRadios(
19 | context: context,
20 | );
21 |
22 | if (response != null) {
23 | print(response);
24 | }
25 | },
26 | ),
27 | body: TextFieldRounded(
28 | controller: TextEditingController(),
29 | onChanged: (value) {},
30 | ),
31 | );
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/lib/feature/custom_dialog/custom_dialog_view.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:twitch_best_practices/feature/custom_dialog/custom_radios_dialog.dart';
3 | import 'package:twitch_best_practices/feature/custom_dialog/text_field_dialog.dart';
4 |
5 | @immutable
6 | final class CustomDialog {
7 | const CustomDialog._();
8 |
9 | static Future showMyDialog({
10 | required BuildContext context,
11 | required String title,
12 | required String text,
13 | required Widget content,
14 | required List? actions,
15 | bool barrierDismissible = true,
16 | }) async {
17 | return showDialog(
18 | context: context,
19 | barrierDismissible: barrierDismissible,
20 | builder: (BuildContext context) {
21 | return AlertDialog(
22 | title: Text(title),
23 | content: content,
24 | actions: actions,
25 | );
26 | },
27 | );
28 | }
29 |
30 | static Future showDialogTextField({
31 | required BuildContext context,
32 | required String title,
33 | }) async {
34 | final response = await showDialog(
35 | context: context,
36 | builder: (BuildContext context) {
37 | return TextFieldDialog(title: title);
38 | },
39 | );
40 |
41 | return response ?? '';
42 | }
43 |
44 | static Future showDialogRadios({
45 | required BuildContext context,
46 | }) async {
47 | final response = await showDialog(
48 | context: context,
49 | builder: (BuildContext context) {
50 | return const CustomRadiosDialog();
51 | },
52 | );
53 |
54 | return response;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/lib/feature/custom_dialog/custom_radios_dialog.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | import 'package:flutter/cupertino.dart';
4 | import 'package:flutter/foundation.dart';
5 | import 'package:flutter/material.dart';
6 |
7 | class CustomRadiosDialog extends StatefulWidget {
8 | const CustomRadiosDialog({super.key});
9 |
10 | @override
11 | State createState() => _CustomRadiosDialogState();
12 | }
13 |
14 | class _CustomRadiosDialogState extends State {
15 | final List> items = [
16 | const MapEntry('Item 1', 5),
17 | const MapEntry('Item 2', 4),
18 | const MapEntry('Item 3', 2),
19 | const MapEntry('Item 4', 3),
20 | ];
21 | @override
22 | Widget build(BuildContext context) {
23 | if (!Platform.isIOS) {
24 | return _DialogForIOS(items);
25 | }
26 | return _DialogForGeneral('Sample', items);
27 | }
28 | }
29 |
30 | class _DialogForGeneral extends StatefulWidget {
31 | const _DialogForGeneral(this.title, this.items);
32 |
33 | final String title;
34 | final List> items;
35 |
36 | @override
37 | State<_DialogForGeneral> createState() => _DialogForGeneralState();
38 | }
39 |
40 | class _DialogForGeneralState extends State<_DialogForGeneral> {
41 | int? _groupValue;
42 |
43 | void _updateValue(int value) {
44 | setState(() {
45 | _groupValue = value;
46 | });
47 | }
48 |
49 | @override
50 | Widget build(BuildContext context) {
51 | return AlertDialog(
52 | actions: [
53 | TextButton(
54 | onPressed: () {
55 | if (_groupValue == null) return;
56 | Navigator.pop(context, _groupValue);
57 | },
58 | child: const Text('OK'),
59 | ),
60 | ],
61 | title: Text(widget.title),
62 | content: SizedBox(
63 | height: MediaQuery.sizeOf(context).height * 0.5,
64 | width: MediaQuery.sizeOf(context).width * 0.5,
65 | child: Visibility(
66 | visible: kIsWeb,
67 | replacement:
68 | _RadioColumListView(widget.items, _updateValue, _groupValue),
69 | child: _RadioColumListView(widget.items, _updateValue, _groupValue),
70 | ),
71 | ),
72 | );
73 | }
74 | }
75 |
76 | class _DialogForIOS extends StatefulWidget {
77 | const _DialogForIOS(this.items);
78 |
79 | final List> items;
80 |
81 | @override
82 | State<_DialogForIOS> createState() => _DialogForIOSState();
83 | }
84 |
85 | class _DialogForIOSState extends State<_DialogForIOS> {
86 | int? _cupertinoSelected;
87 | @override
88 | Widget build(BuildContext context) {
89 | return Column(
90 | children: [
91 | SizedBox(height: MediaQuery.sizeOf(context).height * 0.6),
92 | Container(
93 | color: Theme.of(context).colorScheme.background,
94 | width: double.maxFinite,
95 | alignment: Alignment.centerRight,
96 | child: TextButton(
97 | onPressed: () {
98 | if (_cupertinoSelected == null) return;
99 | Navigator.pop(context, _cupertinoSelected);
100 | },
101 | child: const Text('OK'),
102 | ),
103 | ),
104 | Expanded(
105 | child: CupertinoPicker.builder(
106 | itemExtent: MediaQuery.sizeOf(context).height * 0.05,
107 | onSelectedItemChanged: (value) {
108 | _cupertinoSelected = value;
109 | },
110 | childCount: widget.items.length,
111 | itemBuilder: (context, index) => Center(
112 | child: Text(widget.items[index].key),
113 | ),
114 | backgroundColor: Theme.of(context).colorScheme.background,
115 | ),
116 | ),
117 | ],
118 | );
119 | }
120 | }
121 |
122 | class _RadioColumListView extends StatelessWidget {
123 | const _RadioColumListView(this.items, this.onChanged, this.groupValue);
124 | final List> items;
125 | final ValueChanged onChanged;
126 | final int? groupValue;
127 | @override
128 | Widget build(BuildContext context) {
129 | return Column(
130 | children: [
131 | const Divider(),
132 | Expanded(
133 | child: ListView.builder(
134 | itemCount: items.length,
135 | itemBuilder: (context, index) {
136 | return ListTile(
137 | onTap: () {
138 | onChanged.call(items[index].value);
139 | },
140 | title: Text(items[index].key),
141 | leading: Radio(
142 | value: items[index].value,
143 | groupValue: groupValue,
144 | onChanged: (value) {
145 | if (value == null) return;
146 | onChanged.call(value);
147 | },
148 | ),
149 | );
150 | },
151 | ),
152 | ),
153 | const Divider(),
154 | ],
155 | );
156 | }
157 | }
158 |
--------------------------------------------------------------------------------
/lib/feature/custom_dialog/text_field_dialog.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:twitch_best_practices/feature/custom_dialog/text_field_rounded.dart';
3 |
4 | class TextFieldDialog extends StatefulWidget {
5 | const TextFieldDialog({required this.title, super.key});
6 | final String title;
7 |
8 | @override
9 | State createState() => _TextFieldDialogState();
10 | }
11 |
12 | class _TextFieldDialogState extends State {
13 | String _value = '';
14 | @override
15 | Widget build(BuildContext context) {
16 | return AlertDialog(
17 | title: Text(widget.title),
18 | actions: [
19 | IconButton(
20 | onPressed: () {
21 | Navigator.pop(context, _value);
22 | },
23 | icon: const Icon(Icons.save),
24 | ),
25 | ],
26 | content: TextFieldRounded(
27 | hintText: 'Text here...',
28 | keyboardType: TextInputType.number,
29 | onChanged: (text) {
30 | _value = text;
31 | },
32 | controller: TextEditingController(),
33 | ),
34 | );
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/lib/feature/custom_dialog/text_field_rounded.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | /// It will create rounded text field
4 | ///
5 | @immutable
6 | final class TextFieldRounded extends StatefulWidget {
7 | const TextFieldRounded({
8 | required this.onChanged,
9 | this.controller,
10 | super.key,
11 | this.labelText,
12 | this.hintText,
13 | this.keyboardType = TextInputType.text,
14 | this.contentFieldEdge = TextFieldPaddings.small,
15 | this.boxDecoration,
16 | });
17 |
18 | final String? labelText;
19 | final String? hintText;
20 | final TextInputType keyboardType;
21 |
22 | final TextEditingController? controller;
23 | final ValueChanged onChanged;
24 | final TextFieldPaddings contentFieldEdge;
25 | final BoxDecoration? boxDecoration;
26 |
27 | @override
28 | State createState() => _TextFieldRoundedState();
29 | }
30 |
31 | class _TextFieldRoundedState extends State {
32 | late final TextEditingController? _controller;
33 | late final String _labelText;
34 | @override
35 | void initState() {
36 | super.initState();
37 | _controller = widget.controller;
38 | _labelText = widget.labelText ?? '';
39 | }
40 |
41 | @override
42 | void dispose() {
43 | super.dispose();
44 | _controller?.dispose();
45 | }
46 |
47 | @override
48 | Widget build(BuildContext context) {
49 | if (_labelText.isEmpty) {
50 | return _textField();
51 | }
52 |
53 | return Column(
54 | crossAxisAlignment: CrossAxisAlignment.start,
55 | children: [
56 | Text(_labelText, style: Theme.of(context).textTheme.titleLarge),
57 | _textField(),
58 | ],
59 | );
60 | }
61 |
62 | DecoratedBox _textField() {
63 | return DecoratedBox(
64 | decoration: widget.boxDecoration ?? const _Decoration(),
65 | child: TextFormField(
66 | onChanged: widget.onChanged,
67 | keyboardType: widget.keyboardType,
68 | controller: _controller,
69 | cursorColor: Colors.black,
70 | decoration: _decoration(),
71 | ),
72 | );
73 | }
74 |
75 | InputDecoration _decoration() {
76 | return InputDecoration(
77 | border: InputBorder.none,
78 | focusedBorder: InputBorder.none,
79 | enabledBorder: InputBorder.none,
80 | errorBorder: InputBorder.none,
81 | disabledBorder: InputBorder.none,
82 | contentPadding: widget.contentFieldEdge.padding,
83 | hintText: widget.hintText,
84 | );
85 | }
86 | }
87 |
88 | final class _Decoration extends BoxDecoration {
89 | const _Decoration()
90 | : super(
91 | color: Colors.grey,
92 | borderRadius: const BorderRadius.all(
93 | Radius.circular(20),
94 | ),
95 | );
96 | }
97 |
98 | enum TextFieldPaddings {
99 | small(EdgeInsets.all(8)),
100 | medium(EdgeInsets.all(16)),
101 | large(EdgeInsets.all(24));
102 |
103 | final EdgeInsets padding;
104 | const TextFieldPaddings(this.padding);
105 | }
106 |
--------------------------------------------------------------------------------
/lib/feature/login/loading_state.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/widgets.dart';
3 | import 'package:twitch_best_practices/core/base/view/base_stateless.dart';
4 | import 'package:twitch_best_practices/core/base/viewModel/i_base_viewmodel.dart';
5 |
6 | mixin ViewState
7 | on BaseState {
8 | final ValueNotifier _isLoading = ValueNotifier(false);
9 |
10 | void changeLoading({required bool value}) {
11 | _isLoading.value = value;
12 | }
13 |
14 | Future showDialogCustom() async {
15 | changeLoading(value: true);
16 | await showDialog(
17 | context: context,
18 | builder: (context) => const Center(
19 | child: CircularProgressIndicator(),
20 | ),
21 | );
22 | changeLoading(value: false);
23 | }
24 |
25 | @override
26 | Widget customBuild(BuildContext context);
27 | @override
28 | Widget build(BuildContext context) {
29 | return Material(
30 | child: Stack(
31 | children: [
32 | customBuild(context),
33 | ValueListenableBuilder(
34 | valueListenable: _isLoading,
35 | builder: (context, value, child) {
36 | if (value) {
37 | return ColoredBox(
38 | color: Colors.grey.withOpacity(0.2),
39 | child: const Center(
40 | child: CircularProgressIndicator(
41 | color: Colors.red,
42 | ),
43 | ),
44 | );
45 | }
46 | return const SizedBox.shrink();
47 | },
48 | ),
49 | ],
50 | ),
51 | );
52 | }
53 |
54 | Widget loadingWithBase() {
55 | return Material(
56 | child: Stack(
57 | children: [
58 | ValueListenableBuilder(
59 | valueListenable: _isLoading,
60 | builder: (context, value, child) {
61 | if (value) {
62 | return const CircularProgressIndicator();
63 | }
64 | return const SizedBox.shrink();
65 | },
66 | ),
67 | super.build(context),
68 | ],
69 | ),
70 | );
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/lib/feature/login/model/login_data_model.dart:
--------------------------------------------------------------------------------
1 | final class LoginDataModel {
2 | LoginDataModel({
3 | required this.email,
4 | required this.password,
5 | });
6 |
7 | final String email;
8 | final String password;
9 |
10 | // JSON SERIALIZABLE
11 | Map toJson() {
12 | return {
13 | 'email': email,
14 | 'password': password,
15 | };
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/lib/feature/login/model/login_model.dart:
--------------------------------------------------------------------------------
1 | final class LoginModel {
2 | LoginModel({
3 | this.token,
4 | });
5 |
6 | factory LoginModel.fromJson(Map json) {
7 | return LoginModel(
8 | token: json['token'] as String?,
9 | );
10 | }
11 |
12 | final String? token;
13 | }
14 |
--------------------------------------------------------------------------------
/lib/feature/login/project_general.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | final class ProjectGeneral {
4 | ProjectGeneral._();
5 |
6 | static const loginTitle = 'Giriş';
7 | }
8 |
9 | enum ProjectLoginPadding {
10 | /// value is 8
11 | low(8),
12 |
13 | /// value is 16
14 | normal(16),
15 |
16 | /// value is 20
17 | high(20);
18 |
19 | final double value;
20 | const ProjectLoginPadding(this.value);
21 |
22 | EdgeInsets get symmetricVertical => EdgeInsets.symmetric(vertical: value);
23 | EdgeInsets get symmetricHorizontal => EdgeInsets.symmetric(horizontal: value);
24 | EdgeInsets get symmetric =>
25 | EdgeInsets.symmetric(horizontal: value, vertical: value);
26 | EdgeInsets get onlyTop => EdgeInsets.only(top: value);
27 | EdgeInsets get onlyBottom => EdgeInsets.only(bottom: value);
28 | EdgeInsets get onlyLeft => EdgeInsets.only(left: value);
29 | EdgeInsets get onlyRight => EdgeInsets.only(right: value);
30 | EdgeInsets get all => EdgeInsets.all(value);
31 | }
32 |
--------------------------------------------------------------------------------
/lib/feature/login/service/login_service.dart:
--------------------------------------------------------------------------------
1 | import 'dart:io';
2 |
3 | import 'package:dio/dio.dart';
4 | import 'package:twitch_best_practices/feature/login/model/login_data_model.dart';
5 |
6 | import 'package:twitch_best_practices/feature/login/model/login_model.dart';
7 |
8 | class LoginService with _NetworkMixin {
9 | LoginService({required this.dio});
10 |
11 | final Dio dio;
12 |
13 | Future<(LoginModel?, CustomError?)> login(
14 | LoginDataModel loginDataModel,
15 | ) async {
16 | final response = await dio.post(
17 | _NetworkMixin.loginUrl,
18 | data: loginDataModel.toJson(),
19 | );
20 |
21 | if (response.statusCode != HttpStatus.ok) return (null, CustomError.server);
22 | final data = response.data;
23 | if (data is Map) return (LoginModel.fromJson(data), null);
24 |
25 | return (null, CustomError.unknown);
26 | }
27 | }
28 |
29 | mixin _NetworkMixin {
30 | static const String loginUrl = 'https://reqres.in/api/login';
31 | }
32 |
33 | enum CustomError {
34 | network,
35 | server,
36 | unknown;
37 |
38 | String get message {
39 | switch (this) {
40 | case CustomError.network:
41 | return 'Network Error';
42 | case CustomError.server:
43 | return 'Server Error';
44 | case CustomError.unknown:
45 | return 'Unknown Error';
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/lib/feature/login/view/login_view.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:twitch_best_practices/core/base/view/base_stateless.dart';
3 | import 'package:twitch_best_practices/feature/login/loading_state.dart';
4 | import 'package:twitch_best_practices/feature/login/project_general.dart';
5 | import 'package:twitch_best_practices/feature/login/viewModel/login_viewmodel.dart';
6 |
7 | extension MediaQueryExtension on BuildContext {
8 | Size get sizeOf => MediaQuery.sizeOf(this);
9 | }
10 |
11 | class LoginView extends StatefulWidget {
12 | const LoginView({super.key});
13 |
14 | @override
15 | State createState() => _LoginViewState();
16 | }
17 |
18 | class _LoginViewState extends State
19 | with BaseState, ViewState {
20 | @override
21 | final LoginViewModel viewModel = LoginViewModel();
22 |
23 | @override
24 | void onInitialize() {}
25 |
26 | @override
27 | Widget customBuild(BuildContext context) {
28 | return Scaffold(
29 | floatingActionButton: FloatingActionButton(
30 | onPressed: () async {},
31 | ),
32 | body: SingleChildScrollView(
33 | child: Center(
34 | child: Column(
35 | children: [
36 | SizedBox(height: context.sizeOf.height * .2),
37 | Padding(
38 | padding: ProjectLoginPadding.high.symmetricVertical,
39 | child: TextField(onChanged: viewModel.changeEmail),
40 | ),
41 | Padding(
42 | padding: ProjectLoginPadding.high.symmetricVertical,
43 | child: TextField(onChanged: viewModel.changePassword),
44 | ),
45 | ElevatedButton(
46 | onPressed: viewModel.login,
47 | child: const Text(ProjectGeneral.loginTitle),
48 | ),
49 | ],
50 | ),
51 | ),
52 | ),
53 | );
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/lib/feature/login/viewModel/login_viewmodel.dart:
--------------------------------------------------------------------------------
1 | import 'package:dio/dio.dart';
2 | import 'package:flutter/foundation.dart';
3 | import 'package:twitch_best_practices/core/base/viewModel/i_base_viewmodel.dart';
4 | import 'package:twitch_best_practices/feature/login/model/login_data_model.dart';
5 | import 'package:twitch_best_practices/feature/login/service/login_service.dart';
6 |
7 | final class LoginViewModel extends IBaseViewModel with _LoginViewModelMixin {
8 | final LoginService _loginService = LoginService(
9 | dio: Dio(),
10 | );
11 |
12 | @override
13 | Future init() async {}
14 |
15 | @override
16 | void reset() {}
17 |
18 | Future login() async {
19 | if (!validate) return;
20 | final (response, status) = await _loginService.login(
21 | LoginDataModel(email: _email, password: _password),
22 | );
23 |
24 | if (status != null) {
25 | if (kDebugMode) print(status.message);
26 | return;
27 | }
28 |
29 | if (response == null) return;
30 | if (response.token?.isEmpty ?? true) return;
31 | }
32 | }
33 |
34 | mixin _LoginViewModelMixin {
35 | String _email = '';
36 | String _password = '';
37 |
38 | void changeEmail(String email) {
39 | _email = email;
40 | }
41 |
42 | void changePassword(String password) {
43 | _password = password;
44 | }
45 |
46 | bool get validate => _password.isNotEmpty && _email.isNotEmpty;
47 | }
48 |
--------------------------------------------------------------------------------
/lib/feature/status/status_model.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | @immutable
4 | final class StatusModel {
5 | final bool? isOnline;
6 | final bool? isDelivery;
7 | final bool? isActive;
8 | final bool? isReturn;
9 | final String? name;
10 |
11 | const StatusModel(
12 | {this.isOnline,
13 | this.isDelivery,
14 | this.isActive,
15 | this.isReturn,
16 | this.name});
17 |
18 | static const StatusModel sample1 =
19 | StatusModel(isActive: true, isOnline: true, name: 'vb');
20 | static const StatusModel sample2 =
21 | StatusModel(isReturn: true, isOnline: true, isDelivery: true);
22 | }
23 |
24 | enum StatusType {
25 | online,
26 | delivery,
27 | active,
28 | canReturn,
29 | }
30 |
--------------------------------------------------------------------------------
/lib/feature/status/status_operation.dart:
--------------------------------------------------------------------------------
1 | import 'package:twitch_best_practices/feature/status/status_model.dart';
2 | import 'package:twitch_best_practices/feature/status/validator/online_validator.dart';
3 | import 'package:twitch_best_practices/feature/status/validator/validator_status.dart';
4 |
5 | final class StatusOperation {
6 | final StatusModel model;
7 |
8 | StatusOperation({required this.model});
9 |
10 | List makeStatusTypeItems() {
11 | final List items = [];
12 | final List validators = [
13 | OnlineValidator(model: model),
14 | ActiveValidator(model: model),
15 | ];
16 |
17 | final newItems = validators.map((e) => e.make()).toList();
18 | items.add(isOnlineType);
19 | items.add(isDeliveryType);
20 | items.add(isActiveType);
21 | items.add(isReturnType);
22 |
23 | return items
24 | .where((element) => element != null)
25 | .cast()
26 | .toList();
27 | }
28 |
29 | StatusType? get isOnlineType =>
30 | model.isOnline == true ? StatusType.online : null;
31 |
32 | StatusType? get isDeliveryType =>
33 | model.isDelivery == true ? StatusType.delivery : null;
34 |
35 | StatusType? get isActiveType =>
36 | model.isActive == true ? StatusType.active : null;
37 |
38 | StatusType? get isReturnType =>
39 | model.isReturn == true ? StatusType.canReturn : null;
40 | }
41 |
--------------------------------------------------------------------------------
/lib/feature/status/status_view.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:twitch_best_practices/feature/status/status_model.dart';
3 | import 'package:twitch_best_practices/feature/status/status_operation.dart';
4 | import 'package:twitch_best_practices/feature/status/status_view_mixin.dart';
5 |
6 | class StatusView extends StatefulWidget {
7 | const StatusView({Key? key}) : super(key: key);
8 | @override
9 | State createState() => _StatusViewState();
10 | }
11 |
12 | // 00:21
13 | class _StatusViewState extends State with StatusViewMixin {
14 | @override
15 | Widget build(BuildContext context) {
16 | return Scaffold(
17 | appBar: AppBar(),
18 | body: ValueListenableBuilder(
19 | valueListenable: statusModelNotifier,
20 | builder: (BuildContext context, StatusModel? value, Widget? child) {
21 | if (value == null) {
22 | return const Center(child: CircularProgressIndicator());
23 | }
24 | return _StatusColumn(statusModel: value);
25 | },
26 | ));
27 | }
28 | }
29 |
30 | class _StatusColumn extends StatelessWidget {
31 | _StatusColumn({
32 | required this.statusModel,
33 | }) {
34 | _items = StatusOperation(model: statusModel).makeStatusTypeItems();
35 | }
36 |
37 | late final List _items;
38 | final StatusModel statusModel;
39 |
40 | @override
41 | Widget build(BuildContext context) {
42 | return ListView.builder(
43 | itemCount: _items.length,
44 | itemBuilder: (BuildContext context, int index) {
45 | return _StatusCard(name: statusModel.name, type: _items[index]);
46 | },
47 | );
48 | }
49 | }
50 |
51 | class _StatusCard extends StatelessWidget {
52 | const _StatusCard({required this.name, required this.type});
53 |
54 | final String? name;
55 | final StatusType type;
56 |
57 | @override
58 | Widget build(BuildContext context) {
59 | return Column(
60 | children: [
61 | Text(name ?? ''),
62 | Text(type.name),
63 | ],
64 | );
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/lib/feature/status/status_view_mixin.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:twitch_best_practices/feature/status/status_model.dart';
3 | import 'package:twitch_best_practices/feature/status/status_view.dart';
4 |
5 | mixin StatusViewMixin on State {
6 | final ValueNotifier _statusModelNotifier = ValueNotifier(null);
7 | ValueNotifier get statusModelNotifier => _statusModelNotifier;
8 | @override
9 | void initState() {
10 | super.initState();
11 | _fetchSingleData();
12 | }
13 |
14 | Future _fetchSingleData() async {
15 | await Future.delayed(const Duration(seconds: 2));
16 | _statusModelNotifier.value = StatusModel.sample2;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/lib/feature/status/validator/online_validator.dart:
--------------------------------------------------------------------------------
1 | import 'package:twitch_best_practices/feature/status/status_model.dart';
2 | import 'package:twitch_best_practices/feature/status/validator/validator_status.dart';
3 |
4 | final class OnlineValidator extends ValidatorStatus {
5 | OnlineValidator({required super.model});
6 |
7 | @override
8 | StatusType? make() {
9 | if (model.isOnline == true) {
10 | return StatusType.online;
11 | }
12 |
13 | return null;
14 | }
15 | }
16 |
17 | final class ActiveValidator extends ValidatorStatus {
18 | ActiveValidator({required super.model});
19 |
20 | @override
21 | StatusType? make() {
22 | if (model.isActive == true) {
23 | return StatusType.active;
24 | }
25 |
26 | return null;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/lib/feature/status/validator/validator_status.dart:
--------------------------------------------------------------------------------
1 | import 'package:twitch_best_practices/feature/status/status_model.dart';
2 |
3 | abstract class ValidatorStatus {
4 | final StatusModel model;
5 |
6 | ValidatorStatus({required this.model});
7 | StatusType? make();
8 | }
9 |
--------------------------------------------------------------------------------
/lib/feature/text_field_bottom_sheet/text_bottom_mixin.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:twitch_best_practices/feature/text_field_bottom_sheet/text_bottom_sheet.dart';
3 | import 'package:twitch_best_practices/feature/text_field_bottom_sheet/text_field_bottom_sheet_view.dart';
4 |
5 | mixin TextBottomMixin on State {
6 | final ValueNotifier titleNotifier = ValueNotifier("");
7 |
8 | Future showTextFieldSheet() async {
9 | final response = await TextBottomSheet.show(context);
10 | if (response == null) return;
11 | titleNotifier.value = response.value;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/lib/feature/text_field_bottom_sheet/text_bottom_sheet.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | final class TextBottomModel {
4 | TextBottomModel({required this.value, required this.isCheck});
5 | final String value;
6 | final bool isCheck;
7 | }
8 |
9 | class TextBottomSheet extends StatefulWidget {
10 | const TextBottomSheet({super.key});
11 |
12 | static Future show(BuildContext context) {
13 | return showModalBottomSheet(
14 | context: context,
15 | builder: (context) {
16 | return const TextBottomSheet();
17 | },
18 | );
19 | }
20 |
21 | @override
22 | State createState() => _TextBottomSheetState();
23 | }
24 |
25 | class _TextBottomSheetState extends State with _TextMixin {
26 | static const String _buttonTitle = 'Save';
27 | @override
28 | Widget build(BuildContext context) {
29 | return Column(
30 | children: [
31 | TextField(
32 | onChanged: _updateText,
33 | ),
34 | Checkbox(
35 | value: _isCheck,
36 | onChanged: _updateCheckBox,
37 | ),
38 | IgnorePointer(
39 | ignoring: !_isValid,
40 | child: AnimatedOpacity(
41 | duration: const Duration(seconds: 1),
42 | opacity: _isValid ? 1 : 0.2,
43 | child: ElevatedButton(
44 | onPressed: _onButtonPressed,
45 | child: const Text(_buttonTitle),
46 | ),
47 | ),
48 | ),
49 | ],
50 | );
51 | }
52 | }
53 |
54 | mixin _TextMixin on State {
55 | bool _isCheck = false;
56 | String _textValue = '';
57 | bool get _isValid => _isCheck && _textValue.isNotEmpty;
58 | void _updateCheckBox(bool? value) {
59 | if (value == null) return;
60 | setState(() {
61 | _isCheck = value;
62 | });
63 | }
64 |
65 | void _updateText(String value) {
66 | setState(() {
67 | _textValue = value;
68 | });
69 | }
70 |
71 | void _onButtonPressed() {
72 | if (!_isValid) return;
73 | Navigator.pop(
74 | context,
75 | TextBottomModel(value: _textValue, isCheck: _isCheck),
76 | );
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/lib/feature/text_field_bottom_sheet/text_field_bottom_sheet_view.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:twitch_best_practices/feature/text_field_bottom_sheet/text_bottom_mixin.dart';
3 |
4 | class TextBottomSheetView extends StatefulWidget {
5 | const TextBottomSheetView({Key? key}) : super(key: key);
6 | @override
7 | State createState() => _TextBottomSheetViewState();
8 | }
9 |
10 | class _TextBottomSheetViewState extends State
11 | with TextBottomMixin {
12 | @override
13 | Widget build(BuildContext context) {
14 | return Scaffold(
15 | appBar: AppBar(
16 | title: ValueListenableBuilder(
17 | valueListenable: titleNotifier,
18 | builder: (BuildContext context, String value, Widget? child) {
19 | return Text(value);
20 | },
21 | ),
22 | ),
23 | floatingActionButton: FloatingActionButton(
24 | onPressed: showTextFieldSheet,
25 | child: const Icon(Icons.add),
26 | ),
27 | );
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:twitch_best_practices/feature/login/view/login_view.dart';
3 |
4 | void main() => runApp(const MyApp());
5 |
6 | class MyApp extends StatelessWidget {
7 | const MyApp({super.key});
8 |
9 | @override
10 | Widget build(BuildContext context) {
11 | return MaterialApp(
12 | title: 'Material App',
13 | home: LoginView(),
14 | );
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/lib/speed_code/authentic/authentic_board.dart:
--------------------------------------------------------------------------------
1 | final class AuthenticBoard {
2 | const AuthenticBoard({
3 | required this.title,
4 | required this.description,
5 | });
6 | final String title;
7 | final String description;
8 | }
9 |
--------------------------------------------------------------------------------
/lib/speed_code/authentic/authentic_on_board.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:twitch_best_practices/speed_code/authentic/authentic_board.dart';
3 |
4 | class AuthenticView extends StatefulWidget {
5 | const AuthenticView({super.key});
6 | @override
7 | State createState() => _AuthenticViewState();
8 | }
9 |
10 | class _AuthenticViewState extends State {
11 | @override
12 | Widget build(BuildContext context) {
13 | return const Scaffold(
14 | body: Column(
15 | children: [
16 | Expanded(flex: 4, child: _BodyHeader()),
17 | Expanded(
18 | flex: 3,
19 | child: _BodySubView(
20 | AuthenticBoard(
21 | title: 'Best Quality For Your Qutfit',
22 | description:
23 | "Explore the 2021's best clothes from over 20k brands",
24 | ),
25 | ),
26 | ),
27 | ],
28 | ),
29 | );
30 | }
31 | }
32 |
33 | class _BodyHeader extends StatelessWidget {
34 | const _BodyHeader();
35 |
36 | @override
37 | Widget build(BuildContext context) {
38 | // wee ned to change image to svg etc.
39 | return Image.asset(
40 | _ImagePath.women.png,
41 | fit: BoxFit.cover,
42 | );
43 | }
44 | }
45 |
46 | class _BodySubView extends StatelessWidget {
47 | const _BodySubView(this.model);
48 | final AuthenticBoard model;
49 |
50 | @override
51 | Widget build(BuildContext context) {
52 | return Column(
53 | children: [
54 | const _EmptyHeight(),
55 | Text(
56 | model.title,
57 | textAlign: TextAlign.center,
58 | style: Theme.of(context).textTheme.bodyLarge?.copyWith(
59 | fontWeight: FontWeight.bold,
60 | fontSize: Theme.of(context).textTheme.headlineLarge?.fontSize,
61 | ),
62 | ),
63 | const _EmptyHeight(),
64 | Text(
65 | model.description,
66 | textAlign: TextAlign.center,
67 | style: Theme.of(context).textTheme.headlineSmall?.copyWith(
68 | fontWeight: FontWeight.w300,
69 | ),
70 | ),
71 | const _EmptyHeight(),
72 | const _GetStarted(),
73 | ],
74 | );
75 | }
76 | }
77 |
78 | class _GetStarted extends StatelessWidget {
79 | const _GetStarted();
80 |
81 | @override
82 | Widget build(BuildContext context) {
83 | return ElevatedButton(
84 | onPressed: () {},
85 | style: ElevatedButton.styleFrom(
86 | shape: RoundedRectangleBorder(
87 | borderRadius: BorderRadius.circular(8),
88 | ),
89 | backgroundColor: Theme.of(context).colorScheme.error.withOpacity(0.8),
90 | ),
91 | child: Padding(
92 | padding: const EdgeInsets.all(24),
93 | child: SizedBox(
94 | width: MediaQuery.sizeOf(context).width * 0.5,
95 | child: const Center(child: Text('Get Started')),
96 | ),
97 | ),
98 | );
99 | }
100 | }
101 |
102 | class _EmptyHeight extends StatelessWidget {
103 | const _EmptyHeight();
104 |
105 | @override
106 | Widget build(BuildContext context) {
107 | return const SizedBox(height: 24);
108 | }
109 | }
110 |
111 | class _ImagePath {
112 | static const women = 'img_women';
113 | }
114 |
115 | extension on String {
116 | String get png => 'assets/img/$this.png';
117 | }
118 |
--------------------------------------------------------------------------------
/lib/speed_code/chat_william/chat_bottom.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/foundation.dart';
2 | import 'package:flutter/material.dart';
3 | import 'package:twitch_best_practices/speed_code/chat_william/utility/chat_page_size.dart';
4 | import 'package:twitch_best_practices/speed_code/chat_william/utility/space_box.dart';
5 |
6 | class ChatBottom extends StatefulWidget {
7 | const ChatBottom({required this.onSendPressed, super.key});
8 | final Future Function(String value) onSendPressed;
9 |
10 | @override
11 | State createState() => _ChatBottomState();
12 | }
13 |
14 | class _ChatBottomState extends State with _ChatBottomMixin {
15 | static const _buttonTitle = 'Write a message';
16 |
17 | @override
18 | Widget build(BuildContext context) {
19 | return BottomAppBar(
20 | child: Padding(
21 | padding: const EdgeInsets.symmetric(horizontal: ChatPageSize.normal),
22 | child: Row(
23 | children: [
24 | Expanded(
25 | child: TextField(
26 | controller: _textEditingController,
27 | onChanged: _updateMessageText,
28 | onTap: () {
29 | _updateOnTappedField(value: true);
30 | },
31 | onTapOutside: (event) {
32 | _updateOnTappedField(value: false);
33 | },
34 | decoration: InputDecoration(
35 | hintText: _buttonTitle,
36 | suffix: _SuffixLoading(
37 | isSendingMessageNotifier: _isSendingMessageNotifier,
38 | ),
39 | border: OutlineInputBorder(
40 | borderSide: BorderSide.none,
41 | borderRadius: BorderRadius.circular(ChatPageSize.small),
42 | ),
43 | ),
44 | ),
45 | ),
46 | _BottomAttachmentRow(onTextFieldTapped: _onTextFieldTappedNotifier),
47 | const SpaceBox.widthNormal(),
48 | ValueListenableBuilder(
49 | valueListenable: _messageTextNotifier,
50 | builder: (BuildContext context, String value, Widget? child) {
51 | return IconButton(
52 | onPressed: value.isEmpty ? null : _onSendPressed,
53 | icon: const Icon(Icons.send),
54 | );
55 | },
56 | ),
57 | const SpaceBox.widthNormal(),
58 | ],
59 | ),
60 | ),
61 | );
62 | }
63 | }
64 |
65 | mixin _ChatBottomMixin on State {
66 | final ValueNotifier _messageTextNotifier = ValueNotifier('');
67 | final ValueNotifier _onTextFieldTappedNotifier =
68 | ValueNotifier(false);
69 | final ValueNotifier _isSendingMessageNotifier =
70 | ValueNotifier(false);
71 |
72 | final TextEditingController _textEditingController = TextEditingController();
73 |
74 | Future _onSendPressed() async {
75 | if (_messageTextNotifier.value.isEmpty) return;
76 | _updateLoading(value: true);
77 | final response = await widget.onSendPressed(_messageTextNotifier.value);
78 | if (!response) return;
79 | _clear();
80 | }
81 |
82 | @override
83 | void dispose() {
84 | super.dispose();
85 | _messageTextNotifier.dispose();
86 | }
87 |
88 | void _updateLoading({required bool value}) {
89 | _isSendingMessageNotifier.value = value;
90 | }
91 |
92 | void _clear() {
93 | _textEditingController.clear();
94 | _messageTextNotifier.value = '';
95 | _onTextFieldTappedNotifier.value = false;
96 | _isSendingMessageNotifier.value = false;
97 | }
98 |
99 | void _updateMessageText(String text) {
100 | _messageTextNotifier.value = text;
101 | }
102 |
103 | void _updateOnTappedField({required bool value}) {
104 | _onTextFieldTappedNotifier.value = value;
105 | }
106 | }
107 |
108 | /// Export part of
109 | class _BottomAttachmentRow extends StatelessWidget {
110 | const _BottomAttachmentRow({
111 | required ValueNotifier onTextFieldTapped,
112 | }) : _onTextFieldTapped = onTextFieldTapped;
113 |
114 | final ValueNotifier _onTextFieldTapped;
115 | static const _duration = Duration(milliseconds: 300);
116 | @override
117 | Widget build(BuildContext context) {
118 | return ValueListenableBuilder(
119 | valueListenable: _onTextFieldTapped,
120 | builder: (context, value, child) {
121 | return AnimatedCrossFade(
122 | firstChild: Row(
123 | children: [
124 | IconButton(
125 | onPressed: () {},
126 | icon: const Icon(Icons.mic),
127 | ),
128 | IconButton(
129 | onPressed: () {},
130 | icon: const Icon(Icons.person),
131 | ),
132 | ],
133 | ),
134 | secondChild: const SizedBox(),
135 | crossFadeState:
136 | value ? CrossFadeState.showSecond : CrossFadeState.showFirst,
137 | duration: _duration,
138 | );
139 | },
140 | );
141 | }
142 | }
143 |
144 | class _SuffixLoading extends StatelessWidget {
145 | const _SuffixLoading({
146 | required ValueNotifier isSendingMessageNotifier,
147 | }) : _isSendingMessageNotifier = isSendingMessageNotifier;
148 |
149 | final ValueNotifier _isSendingMessageNotifier;
150 |
151 | @override
152 | Widget build(BuildContext context) {
153 | return ValueListenableBuilder(
154 | valueListenable: _isSendingMessageNotifier,
155 | builder: (context, value, child) {
156 | if (!value) return const SizedBox();
157 | return const SizedBox.square(
158 | dimension: ChatPageSize.large,
159 | child: CircularProgressIndicator(),
160 | );
161 | },
162 | );
163 | }
164 | }
165 |
--------------------------------------------------------------------------------
/lib/speed_code/chat_william/chat_william_view.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:twitch_best_practices/speed_code/chat_william/chat_bottom.dart';
3 | import 'package:twitch_best_practices/speed_code/chat_william/model/chat_user.dart';
4 | import 'package:twitch_best_practices/speed_code/chat_william/model/list_chat.dart';
5 | import 'package:twitch_best_practices/speed_code/chat_william/user_appbar.dart';
6 |
7 | class ChatWilliamView extends StatefulWidget {
8 | const ChatWilliamView({super.key});
9 | @override
10 | State createState() => _ChatWilliamViewState();
11 | }
12 |
13 | class _ChatWilliamViewState extends State {
14 | final users = ListChat.users;
15 | @override
16 | Widget build(BuildContext context) {
17 | return Scaffold(
18 | appBar: UserAppBar(user: ChatUserDummyMixin.dummyLegoUser),
19 | bottomNavigationBar: ChatBottom(
20 | onSendPressed: (value) async {
21 | await Future.delayed(const Duration(milliseconds: 500));
22 | return true;
23 | },
24 | ),
25 | body: ListView.separated(
26 | itemCount: users.length,
27 | separatorBuilder: (context, index) {
28 | if (index.isOdd) return const SizedBox();
29 | return const Center(child: Text('10:56 AM'));
30 | },
31 | padding: const EdgeInsets.symmetric(horizontal: 16),
32 | itemBuilder: (BuildContext context, int index) {
33 | return _UserChatCard(users[index]);
34 | },
35 | ),
36 | );
37 | }
38 | }
39 |
40 | class _UserChatCard extends StatelessWidget {
41 | const _UserChatCard(this.modal);
42 | final ListChat modal;
43 | @override
44 | Widget build(BuildContext context) {
45 | return Align(
46 | alignment: modal.isSenderOtherUser
47 | ? Alignment.centerRight
48 | : Alignment.centerLeft,
49 | child: ConstrainedBox(
50 | constraints: BoxConstraints(
51 | maxWidth: MediaQuery.sizeOf(context).width * 0.8,
52 | ),
53 | child: Card(
54 | shape: RoundedRectangleBorder(
55 | borderRadius: BorderRadius.circular(8),
56 | ),
57 | color: modal.isSenderOtherUser ? Colors.red : Colors.white,
58 | child: Padding(
59 | padding: const EdgeInsets.all(8),
60 | child: Text(
61 | modal.text,
62 | style: Theme.of(context).textTheme.bodyMedium?.copyWith(
63 | color:
64 | modal.isSenderOtherUser ? Colors.white : Colors.black,
65 | ),
66 | ),
67 | ),
68 | ),
69 | ),
70 | );
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/lib/speed_code/chat_william/model/chat_user.dart:
--------------------------------------------------------------------------------
1 | final class ChatUser {
2 | ChatUser({
3 | required this.fullName,
4 | required this.position,
5 | required this.profileImageUrl,
6 | });
7 | final String fullName;
8 | final String position;
9 | final String profileImageUrl;
10 | }
11 |
12 | mixin ChatUserDummyMixin {
13 | static ChatUser dummyLegoUser = ChatUser(
14 | fullName: 'William Watson',
15 | position: 'House Agent',
16 | profileImageUrl: 'https://randomuser.me/api/portraits/lego/2.jpg',
17 | );
18 | }
19 |
--------------------------------------------------------------------------------
/lib/speed_code/chat_william/model/list_chat.dart:
--------------------------------------------------------------------------------
1 | final class ListChat {
2 | ListChat({required this.text, required this.isSenderOtherUser});
3 |
4 | final String text;
5 | final bool isSenderOtherUser;
6 |
7 | static final List users = List.generate(20, (index) {
8 | ///create random message items
9 | return ListChat(
10 | text: '$index message ',
11 | isSenderOtherUser: index.isOdd,
12 | );
13 | });
14 | }
15 |
--------------------------------------------------------------------------------
/lib/speed_code/chat_william/user_appbar.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/services.dart';
3 | import 'package:twitch_best_practices/speed_code/chat_william/model/chat_user.dart';
4 |
5 | class UserAppBar extends StatelessWidget implements PreferredSizeWidget {
6 | const UserAppBar({
7 | required this.user,
8 | super.key,
9 | });
10 | final ChatUser user;
11 | @override
12 | Widget build(BuildContext context) {
13 | return AppBar(
14 | systemOverlayStyle: SystemUiOverlayStyle.dark,
15 | backgroundColor: Colors.transparent,
16 | leading: const Icon(Icons.arrow_back_sharp),
17 | elevation: 0,
18 | centerTitle: false,
19 | leadingWidth: 16,
20 | iconTheme: const IconThemeData(color: Colors.black),
21 | title: Row(
22 | children: [
23 | CircleAvatar(
24 | backgroundImage: NetworkImage(user.profileImageUrl),
25 | ),
26 | Padding(
27 | padding: const EdgeInsets.only(left: 8),
28 | child: Column(
29 | crossAxisAlignment: CrossAxisAlignment.start,
30 | children: [
31 | Text(
32 | user.fullName,
33 | style: Theme.of(context).textTheme.titleLarge,
34 | ),
35 | Text(
36 | user.position,
37 | style: Theme.of(context).textTheme.titleSmall,
38 | ),
39 | ],
40 | ),
41 | ),
42 | ],
43 | ),
44 | );
45 | }
46 |
47 | @override
48 | Size get preferredSize => const Size.fromHeight(kToolbarHeight);
49 | }
50 |
--------------------------------------------------------------------------------
/lib/speed_code/chat_william/utility/chat_page_size.dart:
--------------------------------------------------------------------------------
1 | final class ChatPageSize {
2 | ChatPageSize._();
3 |
4 | static const double cardHeight = 60;
5 |
6 | /// value 16
7 | static const double normal = 16;
8 |
9 | /// value 8
10 | static const double small = 8;
11 |
12 | /// value 24
13 | static const double large = 24;
14 | }
15 |
--------------------------------------------------------------------------------
/lib/speed_code/chat_william/utility/space_box.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class SpaceBox extends SizedBox {
4 | const SpaceBox({super.key});
5 |
6 | /// value is 16
7 | const SpaceBox.widthNormal({super.key}) : super(width: 16);
8 | }
9 |
--------------------------------------------------------------------------------
/lib/speed_code/ice_cream/ice_cream_view.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | part './widget/ice_app_bar.dart';
4 | part './widget/ice_card.dart';
5 |
6 | extension on BuildContext {
7 | // or use kartal
8 | Size get sizeOf => MediaQuery.sizeOf(this);
9 | ThemeData get themeOf => Theme.of(this);
10 | }
11 |
12 | final class IceCreamConstants {
13 | const IceCreamConstants._();
14 | static const paddingAll = 16.0;
15 |
16 | static const radius = 16.0;
17 |
18 | static const paddingNormal = 8.0;
19 |
20 | static const cardTitle = 'Yogurt Land';
21 |
22 | static const favoriteColor = Colors.pink;
23 | static const cardImageAsset = 'assets/img/img_yogurtland.png';
24 | static const cardBottomText = 'To Cart';
25 | static const stockTitle = 'In Stock';
26 | static const stockMoney = 8.5;
27 | static const titleHome = 'What would you like to eat?';
28 | }
29 |
30 | class IceCreamView extends StatefulWidget {
31 | const IceCreamView({super.key});
32 | @override
33 | State createState() => _IceCreamViewState();
34 | }
35 |
36 | class _IceCreamViewState extends State {
37 | @override
38 | Widget build(BuildContext context) {
39 | return Scaffold(
40 | appBar: _AppBar(),
41 | body: ListView(
42 | padding: EdgeInsets.zero,
43 | children: [
44 | Padding(
45 | padding: const EdgeInsets.all(IceCreamConstants.paddingAll),
46 | child: Column(
47 | crossAxisAlignment: CrossAxisAlignment.start,
48 | children: [
49 | Text(
50 | IceCreamConstants.titleHome,
51 | style: context.themeOf.textTheme.titleMedium,
52 | ),
53 | const Padding(
54 | padding: EdgeInsets.symmetric(
55 | vertical: IceCreamConstants.paddingAll,
56 | ),
57 | child: _SearchField(),
58 | ),
59 | ],
60 | ),
61 | ),
62 | const _PageBody(),
63 | ],
64 | ),
65 | );
66 | }
67 | }
68 |
69 | class _SearchField extends StatelessWidget {
70 | const _SearchField();
71 |
72 | @override
73 | Widget build(BuildContext context) {
74 | return Row(
75 | children: [
76 | Expanded(
77 | child: TextField(
78 | decoration: InputDecoration(
79 | hintText: 'Search',
80 | suffixIcon: const Icon(Icons.search),
81 | fillColor: Colors.grey[200],
82 | filled: true,
83 | border: const OutlineInputBorder(
84 | borderSide: BorderSide.none,
85 | borderRadius:
86 | BorderRadius.all(Radius.circular(IceCreamConstants.radius)),
87 | ),
88 | ),
89 | ),
90 | ),
91 | IconButton(
92 | onPressed: () {},
93 | icon: const Icon(Icons.filter_list_outlined),
94 | ),
95 | ],
96 | );
97 | }
98 | }
99 |
100 | class _PageBody extends StatelessWidget {
101 | const _PageBody();
102 |
103 | @override
104 | Widget build(BuildContext context) {
105 | return SizedBox(
106 | height: context.sizeOf.height * 0.6,
107 | child: ListView.builder(
108 | physics: const ClampingScrollPhysics(),
109 | itemCount: 5,
110 | padding: const EdgeInsets.all(IceCreamConstants.paddingAll),
111 | scrollDirection: Axis.horizontal,
112 | itemBuilder: (context, index) {
113 | return SizedBox(
114 | width: context.sizeOf.width * 0.7,
115 | height: context.sizeOf.height * 0.6,
116 | child: const Padding(
117 | padding: EdgeInsets.only(left: IceCreamConstants.paddingAll),
118 | child: _IceCard(),
119 | ),
120 | );
121 | },
122 | ),
123 | );
124 | }
125 | }
126 |
--------------------------------------------------------------------------------
/lib/speed_code/ice_cream/widget/ice_app_bar.dart:
--------------------------------------------------------------------------------
1 | part of '../ice_cream_view.dart';
2 |
3 | class _AppBar extends StatelessWidget implements PreferredSizeWidget {
4 | static const _randomUserUrl =
5 | 'https://randomuser.me/api/portraits/lego/1.jpg';
6 |
7 | @override
8 | Widget build(BuildContext context) {
9 | return AppBar(
10 | elevation: 0,
11 | iconTheme: const IconThemeData.fallback().copyWith(
12 | color: Colors.black,
13 | ),
14 | backgroundColor: Colors.transparent,
15 | title: Row(
16 | children: [
17 | _Avatar(),
18 | _Title(),
19 | ],
20 | ),
21 | actions: [
22 | _Menu(
23 | onPressed: () {},
24 | ),
25 | ],
26 | );
27 | }
28 |
29 | @override
30 | Size get preferredSize => const Size.fromHeight(kToolbarHeight);
31 | }
32 |
33 | class _Menu extends StatelessWidget {
34 | const _Menu({required this.onPressed});
35 |
36 | final VoidCallback onPressed;
37 |
38 | @override
39 | Widget build(BuildContext context) {
40 | return IconButton(
41 | onPressed: () {},
42 | icon: const Icon(Icons.menu_outlined),
43 | );
44 | }
45 | }
46 |
47 | class _Title extends StatelessWidget {
48 | @override
49 | Widget build(BuildContext context) {
50 | return Text(
51 | 'Hi, Train',
52 | style: Theme.of(context).textTheme.headlineSmall?.copyWith(
53 | fontWeight: FontWeight.w700,
54 | ),
55 | );
56 | }
57 | }
58 |
59 | class _Avatar extends StatelessWidget {
60 | @override
61 | Widget build(BuildContext context) {
62 | return const CircleAvatar(
63 | backgroundImage: NetworkImage(
64 | _AppBar._randomUserUrl,
65 | ),
66 | );
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/lib/speed_code/ice_cream/widget/ice_card.dart:
--------------------------------------------------------------------------------
1 | part of '../ice_cream_view.dart';
2 |
3 | class _IceCard extends StatelessWidget {
4 | const _IceCard();
5 |
6 | @override
7 | Widget build(BuildContext context) {
8 | return Card(
9 | child: Padding(
10 | padding: const EdgeInsets.all(IceCreamConstants.paddingAll),
11 | child: Column(
12 | children: [
13 | _Header(
14 | title: IceCreamConstants.cardTitle,
15 | onPressed: () {},
16 | ),
17 | Expanded(
18 | child: _BodyImage(),
19 | ),
20 | const _BottomField(
21 | IceCreamConstants.stockMoney,
22 | IceCreamConstants.stockTitle,
23 | ),
24 | ],
25 | ),
26 | ),
27 | );
28 | }
29 | }
30 |
31 | class _Header extends StatelessWidget {
32 | const _Header({required this.title, required this.onPressed});
33 |
34 | final String title;
35 | final VoidCallback onPressed;
36 | @override
37 | Widget build(BuildContext context) {
38 | return Row(
39 | children: [
40 | Text(title),
41 | const Spacer(),
42 | Card(
43 | child: IconButton.filled(
44 | onPressed: onPressed,
45 | icon: const Icon(
46 | Icons.favorite,
47 | color: IceCreamConstants.favoriteColor,
48 | ),
49 | ),
50 | ),
51 | ],
52 | );
53 | }
54 | }
55 |
56 | class _BodyImage extends StatelessWidget {
57 | @override
58 | Widget build(BuildContext context) {
59 | return Image.asset(IceCreamConstants.cardImageAsset);
60 | }
61 | }
62 |
63 | class _BottomField extends StatelessWidget {
64 | const _BottomField(this.money, this.storeName);
65 | final double money;
66 | final String storeName;
67 | @override
68 | Widget build(BuildContext context) {
69 | return Row(
70 | children: [
71 | Column(
72 | children: [
73 | Text(storeName),
74 | Text.rich(
75 | TextSpan(
76 | children: [
77 | const TextSpan(text: r'$'),
78 | TextSpan(
79 | text: '$money',
80 | style: Theme.of(context).textTheme.titleLarge?.copyWith(
81 | fontWeight: FontWeight.bold,
82 | ),
83 | ),
84 | ],
85 | ),
86 | ),
87 | ],
88 | ),
89 | const Spacer(),
90 | ElevatedButton(
91 | onPressed: () {},
92 | style: ElevatedButton.styleFrom(backgroundColor: Colors.red[300]),
93 | child: const Padding(
94 | padding: EdgeInsets.all(IceCreamConstants.paddingNormal),
95 | child: Row(
96 | children: [
97 | Text(IceCreamConstants.cardBottomText),
98 | Padding(
99 | padding:
100 | EdgeInsets.only(left: IceCreamConstants.paddingNormal),
101 | child: Icon(Icons.shopping_basket_outlined),
102 | ),
103 | ],
104 | ),
105 | ),
106 | ),
107 | ],
108 | );
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/lib/speed_code/lang_app/custom_decoration.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | @immutable
4 | final class CustomDecoration extends BoxDecoration {
5 | CustomDecoration()
6 | : super(
7 | borderRadius: const BorderRadius.all(Radius.circular(16)),
8 | gradient: LinearGradient(
9 | colors: [
10 | Colors.lightGreenAccent.shade700,
11 | Colors.green.shade900,
12 | ],
13 | stops: const [
14 | 0.2,
15 | 1.9,
16 | ],
17 | ),
18 | );
19 | }
20 |
--------------------------------------------------------------------------------
/lib/speed_code/lang_app/lang_app_view.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:twitch_best_practices/speed_code/lang_app/custom_decoration.dart';
3 | import 'package:twitch_best_practices/speed_code/lang_app/lang_dropdown.dart';
4 | import 'package:twitch_best_practices/speed_code/lang_app/widget/course_grid.dart';
5 |
6 | ///========================================================================
7 | /// KONUSMAK YOK :)
8 | ///=====================================================================
9 |
10 | part './widget/today_challange_card.dart';
11 |
12 | class LangAppView extends StatefulWidget {
13 | const LangAppView({super.key});
14 | @override
15 | State createState() => _LangAppViewState();
16 | }
17 |
18 | class _LangAppViewState extends State {
19 | static const _imageUrl = 'https://randomuser.me/api/portraits/lego/7.jpg';
20 | @override
21 | Widget build(BuildContext context) {
22 | return Scaffold(
23 | appBar: const _AppBar(),
24 | body: ListView(
25 | padding: const EdgeInsets.symmetric(horizontal: 16),
26 | children: const [
27 | _Header(),
28 | _WelcomeBackCard(),
29 | _TodaysChallenge(),
30 | _YourCourseCard(),
31 | CourseGrid(),
32 | ],
33 | ),
34 | );
35 | }
36 | }
37 |
38 | class _YourCourseCard extends StatelessWidget {
39 | const _YourCourseCard();
40 |
41 | @override
42 | Widget build(BuildContext context) {
43 | return Padding(
44 | padding: _PagePadding.verticalNormal,
45 | child: Row(
46 | mainAxisAlignment: MainAxisAlignment.spaceBetween,
47 | children: [
48 | Text(
49 | 'Your Courses',
50 | style: Theme.of(context).textTheme.headlineMedium?.copyWith(
51 | fontWeight: FontWeight.bold,
52 | ),
53 | ),
54 | TextButton(
55 | onPressed: () {},
56 | child: const Text(
57 | 'View all',
58 | // it need to use theme
59 | style: TextStyle(color: _AppColors.primary),
60 | ),
61 | ),
62 | ],
63 | ),
64 | );
65 | }
66 | }
67 |
68 | class _WelcomeBackCard extends StatelessWidget {
69 | const _WelcomeBackCard();
70 |
71 | @override
72 | Widget build(BuildContext context) {
73 | return Padding(
74 | padding: _PagePadding.verticalNormal,
75 | child: Text(
76 | 'Welcome back!',
77 | style: Theme.of(context).textTheme.titleLarge?.copyWith(
78 | fontSize: Theme.of(context).textTheme.headlineMedium?.fontSize,
79 | ),
80 | ),
81 | );
82 | }
83 | }
84 |
85 | class _Header extends StatelessWidget {
86 | const _Header();
87 | @override
88 | Widget build(BuildContext context) {
89 | return ListTile(
90 | leading: const CircleAvatar(
91 | backgroundImage: NetworkImage(_LangAppViewState._imageUrl),
92 | ),
93 | title: Text(
94 | 'Alias Jordan',
95 | style: Theme.of(context).textTheme.titleLarge,
96 | ),
97 | subtitle: const Padding(
98 | padding: EdgeInsets.only(top: 8),
99 | child: Row(
100 | children: [
101 | Icon(Icons.pin_drop_outlined, color: Colors.red),
102 | SizedBox(width: 5),
103 | Text('United kingdom'),
104 | ],
105 | ),
106 | ),
107 | );
108 | }
109 | }
110 |
111 | class _AppBar extends StatelessWidget implements PreferredSizeWidget {
112 | const _AppBar();
113 |
114 | @override
115 | Widget build(BuildContext context) {
116 | return AppBar(
117 | elevation: 0,
118 | backgroundColor: Colors.transparent,
119 | iconTheme: const IconThemeData(
120 | color: Colors.black,
121 | ),
122 | leading: const Icon(Icons.menu_outlined),
123 | actions: const [
124 | LangDropDown(),
125 | ],
126 | );
127 | }
128 |
129 | @override
130 | Size get preferredSize => const Size.fromHeight(kToolbarHeight);
131 | }
132 |
133 | //MARK: Helpful
134 |
135 | @immutable
136 | final class _PagePadding {
137 | const _PagePadding._();
138 | static const onlyLeft = EdgeInsets.only(left: 16);
139 |
140 | static const EdgeInsets allNormal = EdgeInsets.all(16);
141 |
142 | static const EdgeInsets horizontalNormal =
143 | EdgeInsets.symmetric(horizontal: 16);
144 |
145 | static const EdgeInsets verticalNormal = EdgeInsets.symmetric(vertical: 16);
146 | static const EdgeInsets verticalLow = EdgeInsets.symmetric(vertical: 8);
147 | }
148 |
149 | @immutable
150 | class _AppColors {
151 | const _AppColors._();
152 |
153 | static const Color primary = Colors.green;
154 | }
155 |
--------------------------------------------------------------------------------
/lib/speed_code/lang_app/lang_dropdown.dart:
--------------------------------------------------------------------------------
1 | import 'package:equatable/equatable.dart';
2 | import 'package:flutter/material.dart';
3 |
4 | class LangDropDown extends StatefulWidget {
5 | const LangDropDown({super.key});
6 |
7 | @override
8 | State createState() => _LangDropDownState();
9 | }
10 |
11 | class _LangDropDownState extends State {
12 | final ValueNotifier _itemNotifier = ValueNotifier(null);
13 |
14 | @override
15 | Widget build(BuildContext context) {
16 | return ValueListenableBuilder(
17 | valueListenable: _itemNotifier,
18 | builder: (context, value, child) {
19 | return DropdownButton(
20 | value: _itemNotifier.value,
21 | items: LangAppItem.samples.map((e) {
22 | return DropdownMenuItem(
23 | value: e,
24 | child: _DropdownCardItem(e),
25 | );
26 | }).toList(),
27 | onChanged: (value) {
28 | _itemNotifier.value = value;
29 | },
30 | );
31 | },
32 | );
33 | }
34 | }
35 |
36 | class _DropdownCardItem extends StatelessWidget {
37 | const _DropdownCardItem(this.item);
38 | final LangAppItem item;
39 |
40 | @override
41 | Widget build(BuildContext context) {
42 | return Card(
43 | child: Row(
44 | children: [
45 | Icon(item.icon),
46 | const SizedBox(
47 | width: 10,
48 | ),
49 | Text(item.title),
50 | ],
51 | ),
52 | );
53 | }
54 | }
55 |
56 | final class LangAppItem extends Equatable {
57 | const LangAppItem({required this.icon, required this.title});
58 |
59 | final IconData icon;
60 | final String title;
61 |
62 | static final List samples = [
63 | const LangAppItem(icon: Icons.flag, title: 'French'),
64 | const LangAppItem(icon: Icons.face, title: 'Turkish'),
65 | ];
66 |
67 | @override
68 | List