├── .flutter-plugins
├── .flutter-plugins-dependencies
├── .gitattributes
├── .github
└── workflows
│ └── main.yml
├── .gitignore
├── .idea
├── .gitignore
├── Flutter-Widge-Of-The-Week.iml
├── libraries
│ ├── Dart_SDK.xml
│ └── Flutter_Plugins.xml
├── modules.xml
└── vcs.xml
├── README.md
├── analysis_options.yaml
├── android
├── .gitignore
├── app
│ ├── build.gradle
│ └── src
│ │ ├── debug
│ │ └── AndroidManifest.xml
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── kotlin
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── asif
│ │ │ │ └── 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
├── asif_android.iml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
└── settings.gradle
├── asif.iml
├── assets
├── fonts
│ ├── Nunito-ExtraBold.ttf
│ └── Nunito-Regular.ttf
├── images
│ ├── avatar_1.png
│ ├── avatar_2.png
│ ├── avatar_3.png
│ ├── avatar_4.png
│ └── avatar_5.png
├── json
│ └── profiles.json
└── profilepictures
│ ├── placeholder.jpg
│ ├── profile_1.jpg
│ ├── profile_2.jpg
│ ├── profile_3.jpg
│ ├── profile_4.jpg
│ ├── profile_5.jpg
│ └── profile_6.jpg
├── images
├── category_icon.png
└── splash_pic.jpg
├── 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
├── l10n.yaml
├── lib
├── dating_app
│ ├── model
│ │ └── profile.dart
│ └── widgets
│ │ ├── action_button_widget.dart
│ │ ├── background_curve_widget.dart
│ │ ├── cards_stack_widget.dart
│ │ ├── drag_widget.dart
│ │ ├── profile_card.dart
│ │ └── tag_widget.dart
├── error_example
│ └── error_example.dart
├── extensions
│ ├── country_code_country_flag_extension.dart
│ └── sizebox_extension.dart
├── freeze
│ ├── freeze_screen.dart
│ ├── person.dart
│ ├── person.freezed.dart
│ └── person.g.dart
├── html_editor.dart
├── json_files
│ └── countries_code.json
├── l10n
│ ├── app_en.arb
│ └── app_es.arb
├── main.dart
├── math_ai_screen.dart
├── message_grouping_with_time_stamp.dart
├── permissions
│ ├── location_permission.dart
│ ├── permission_screen.dart
│ └── permission_services.dart
├── provider
│ ├── app_language
│ │ └── app_language.dart
│ └── provider_screen.dart
├── rating_screen.dart
├── screen
│ ├── pagination_screen
│ │ ├── model
│ │ │ └── post_model.dart
│ │ ├── pagination_controller
│ │ │ └── pagination_controller.dart
│ │ ├── pagination_screen.dart
│ │ └── repository
│ │ │ └── post_repository.dart
│ └── search_places_api
│ │ └── google_map_search_places_api.dart
├── shared_preferenace_widget.dart
├── utils
│ ├── date_utils.dart
│ ├── session_controller.dart
│ └── validation_utils.dart
└── widgets
│ ├── animated_container_widget.dart
│ ├── animated_list_view_builder_widget.dart
│ ├── change_lanugage_widget.dart
│ ├── country_code_picker.dart
│ ├── custom_button.dart
│ ├── custom_drop_down_widget.dart
│ ├── custom_height_picker.dart
│ ├── custom_slider.dart
│ ├── dates_and_time_widget.dart
│ ├── dragable_example.dart
│ ├── filter_list_view_builder_widget.dart
│ ├── flutter_fancy_tree_widget.dart
│ ├── flutter_slidebale_widget.dart
│ ├── future_builder_widget.dart
│ ├── height_picker.dart
│ ├── image_compressor_widget.dart
│ ├── image_widget.dart
│ ├── ineractive_viewer_widget.dart
│ ├── internet_connection.dart
│ ├── re_orderable_list_view_builder_widget.dart
│ └── streams_builder_screen.dart
├── pubspec.lock
├── pubspec.yaml
├── test
├── counter_test.dart
└── widget_test.dart
└── web
├── favicon.png
├── icons
├── Icon-192.png
├── Icon-512.png
├── Icon-maskable-192.png
└── Icon-maskable-512.png
├── index.html
└── manifest.json
/.flutter-plugins:
--------------------------------------------------------------------------------
1 | # This is a generated file; do not edit or check into version control.
2 | connectivity_plus=/Users/asiftaj/.pub-cache/hosted/pub.dev/connectivity_plus-6.0.5/
3 | file_selector_linux=/Users/asiftaj/.pub-cache/hosted/pub.dev/file_selector_linux-0.9.2+1/
4 | file_selector_macos=/Users/asiftaj/.pub-cache/hosted/pub.dev/file_selector_macos-0.9.4+1/
5 | file_selector_windows=/Users/asiftaj/.pub-cache/hosted/pub.dev/file_selector_windows-0.9.3+2/
6 | flutter_image_compress=/Users/asiftaj/.pub-cache/hosted/pub.dev/flutter_image_compress-2.3.0/
7 | flutter_image_compress_common=/Users/asiftaj/.pub-cache/hosted/pub.dev/flutter_image_compress_common-1.0.5/
8 | flutter_image_compress_macos=/Users/asiftaj/.pub-cache/hosted/pub.dev/flutter_image_compress_macos-1.0.2/
9 | flutter_image_compress_ohos=/Users/asiftaj/.pub-cache/hosted/pub.dev/flutter_image_compress_ohos-0.0.3/
10 | flutter_image_compress_web=/Users/asiftaj/.pub-cache/hosted/pub.dev/flutter_image_compress_web-0.1.4+1/
11 | flutter_keyboard_visibility=/Users/asiftaj/.pub-cache/hosted/pub.dev/flutter_keyboard_visibility-6.0.0/
12 | flutter_keyboard_visibility_linux=/Users/asiftaj/.pub-cache/hosted/pub.dev/flutter_keyboard_visibility_linux-1.0.0/
13 | flutter_keyboard_visibility_macos=/Users/asiftaj/.pub-cache/hosted/pub.dev/flutter_keyboard_visibility_macos-1.0.0/
14 | flutter_keyboard_visibility_web=/Users/asiftaj/.pub-cache/hosted/pub.dev/flutter_keyboard_visibility_web-2.0.0/
15 | flutter_keyboard_visibility_windows=/Users/asiftaj/.pub-cache/hosted/pub.dev/flutter_keyboard_visibility_windows-1.0.0/
16 | flutter_localization=/Users/asiftaj/.pub-cache/hosted/pub.dev/flutter_localization-0.2.2/
17 | flutter_plugin_android_lifecycle=/Users/asiftaj/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.22/
18 | flutter_secure_storage=/Users/asiftaj/.pub-cache/hosted/pub.dev/flutter_secure_storage-9.2.2/
19 | flutter_secure_storage_linux=/Users/asiftaj/.pub-cache/hosted/pub.dev/flutter_secure_storage_linux-1.2.1/
20 | flutter_secure_storage_macos=/Users/asiftaj/.pub-cache/hosted/pub.dev/flutter_secure_storage_macos-3.1.2/
21 | flutter_secure_storage_web=/Users/asiftaj/.pub-cache/hosted/pub.dev/flutter_secure_storage_web-1.2.1/
22 | flutter_secure_storage_windows=/Users/asiftaj/.pub-cache/hosted/pub.dev/flutter_secure_storage_windows-3.1.2/
23 | geolocator=/Users/asiftaj/.pub-cache/hosted/pub.dev/geolocator-13.0.1/
24 | geolocator_android=/Users/asiftaj/.pub-cache/hosted/pub.dev/geolocator_android-4.6.1/
25 | geolocator_apple=/Users/asiftaj/.pub-cache/hosted/pub.dev/geolocator_apple-2.3.7/
26 | geolocator_web=/Users/asiftaj/.pub-cache/hosted/pub.dev/geolocator_web-4.1.1/
27 | geolocator_windows=/Users/asiftaj/.pub-cache/hosted/pub.dev/geolocator_windows-0.2.3/
28 | image_cropper=/Users/asiftaj/.pub-cache/hosted/pub.dev/image_cropper-8.0.2/
29 | image_cropper_for_web=/Users/asiftaj/.pub-cache/hosted/pub.dev/image_cropper_for_web-6.0.2/
30 | image_picker=/Users/asiftaj/.pub-cache/hosted/pub.dev/image_picker-1.1.2/
31 | image_picker_android=/Users/asiftaj/.pub-cache/hosted/pub.dev/image_picker_android-0.8.12+13/
32 | image_picker_for_web=/Users/asiftaj/.pub-cache/hosted/pub.dev/image_picker_for_web-3.0.5/
33 | image_picker_ios=/Users/asiftaj/.pub-cache/hosted/pub.dev/image_picker_ios-0.8.12/
34 | image_picker_linux=/Users/asiftaj/.pub-cache/hosted/pub.dev/image_picker_linux-0.2.1+1/
35 | image_picker_macos=/Users/asiftaj/.pub-cache/hosted/pub.dev/image_picker_macos-0.2.1+1/
36 | image_picker_windows=/Users/asiftaj/.pub-cache/hosted/pub.dev/image_picker_windows-0.2.1+1/
37 | images_picker=/Users/asiftaj/.pub-cache/hosted/pub.dev/images_picker-1.2.11/
38 | path_provider=/Users/asiftaj/.pub-cache/hosted/pub.dev/path_provider-2.1.4/
39 | path_provider_android=/Users/asiftaj/.pub-cache/hosted/pub.dev/path_provider_android-2.2.10/
40 | path_provider_foundation=/Users/asiftaj/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.0/
41 | path_provider_linux=/Users/asiftaj/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/
42 | path_provider_windows=/Users/asiftaj/.pub-cache/hosted/pub.dev/path_provider_windows-2.3.0/
43 | permission_handler=/Users/asiftaj/.pub-cache/hosted/pub.dev/permission_handler-11.3.1/
44 | permission_handler_android=/Users/asiftaj/.pub-cache/hosted/pub.dev/permission_handler_android-12.0.12/
45 | permission_handler_apple=/Users/asiftaj/.pub-cache/hosted/pub.dev/permission_handler_apple-9.4.5/
46 | permission_handler_html=/Users/asiftaj/.pub-cache/hosted/pub.dev/permission_handler_html-0.1.3+2/
47 | permission_handler_windows=/Users/asiftaj/.pub-cache/hosted/pub.dev/permission_handler_windows-0.2.1/
48 | quill_native_bridge=/Users/asiftaj/.pub-cache/hosted/pub.dev/quill_native_bridge-10.6.2/
49 | shared_preferences=/Users/asiftaj/.pub-cache/hosted/pub.dev/shared_preferences-2.3.2/
50 | shared_preferences_android=/Users/asiftaj/.pub-cache/hosted/pub.dev/shared_preferences_android-2.3.2/
51 | shared_preferences_foundation=/Users/asiftaj/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.5.2/
52 | shared_preferences_linux=/Users/asiftaj/.pub-cache/hosted/pub.dev/shared_preferences_linux-2.4.1/
53 | shared_preferences_web=/Users/asiftaj/.pub-cache/hosted/pub.dev/shared_preferences_web-2.4.2/
54 | shared_preferences_windows=/Users/asiftaj/.pub-cache/hosted/pub.dev/shared_preferences_windows-2.4.1/
55 | url_launcher=/Users/asiftaj/.pub-cache/hosted/pub.dev/url_launcher-6.3.0/
56 | url_launcher_android=/Users/asiftaj/.pub-cache/hosted/pub.dev/url_launcher_android-6.3.10/
57 | url_launcher_ios=/Users/asiftaj/.pub-cache/hosted/pub.dev/url_launcher_ios-6.3.1/
58 | url_launcher_linux=/Users/asiftaj/.pub-cache/hosted/pub.dev/url_launcher_linux-3.2.0/
59 | url_launcher_macos=/Users/asiftaj/.pub-cache/hosted/pub.dev/url_launcher_macos-3.2.1/
60 | url_launcher_web=/Users/asiftaj/.pub-cache/hosted/pub.dev/url_launcher_web-2.3.3/
61 | url_launcher_windows=/Users/asiftaj/.pub-cache/hosted/pub.dev/url_launcher_windows-3.1.2/
62 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/.github/workflows/main.yml:
--------------------------------------------------------------------------------
1 | on:
2 | pull_request:
3 | branches:
4 | - main
5 | - master
6 | push:
7 | branches:
8 | - main
9 | - master
10 | - develop
11 | name: "Build & Release"
12 | jobs:
13 | build:
14 | name: Build & Release
15 | runs-on: macos-latest
16 | steps:
17 | - uses: actions/checkout@v3
18 | - uses: actions/setup-java@v3
19 | with:
20 | distribution: 'zulu'
21 | java-version: '12'
22 | - uses: subosito/flutter-action@v2
23 | with:
24 | channel: 'stable'
25 | architecture: x64
26 |
27 | - run: flutter build apk --release --split-per-abi
28 | - run: |
29 | flutter build ios --no-codesign
30 | cd build/ios/iphoneos
31 | mkdir Payload
32 | cd Payload
33 | ln -s ../Runner.app
34 | cd ..
35 | zip -r app.ipa Payload
36 | - name: Push to Releases
37 | uses: ncipollo/release-action@v1
38 | with:
39 | artifacts: "build/app/outputs/apk/release/*,build/ios/iphoneos/app.ipa"
40 | tag: v1.0.${{ github.run_number }}
41 | token: ${{ secrets.TOKEN }}
42 |
43 |
44 |
45 |
46 |
47 |
48 | # push to master, main, develop
49 | # pull request on main master
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .dart_tool
2 | build
3 | asif
4 | .idea
5 | .flutter-plugins
6 | .flutter-plugins-dependencies
7 | # Miscellaneous
8 | *.class
9 | *.log
10 | *.pyc
11 | *.swp
12 | .DS_Store
13 | .atom/
14 | .buildlog/
15 | .history
16 | .svn/
17 |
18 | # IntelliJ related
19 | *.iml
20 | *.ipr
21 | *.iws
22 | .idea/
23 |
24 | # Visual Studio Code related
25 | .vscode/
26 |
27 | # Flutter/Dart/Pub related
28 | **/doc/api/
29 | .dart_tool/
30 | .flutter-plugins
31 | .packages
32 | .pub-cache/
33 | .pub/
34 | /build/
35 |
36 | # Android related
37 | **/android/**/gradle-wrapper.jar
38 | **/android/.gradle
39 | **/android/captures/
40 | **/android/gradlew
41 | **/android/gradlew.bat
42 | **/android/local.properties
43 | **/android/**/GeneratedPluginRegistrant.java
44 |
45 | # iOS/XCode related
46 | **/ios/**/*.mode1v3
47 | **/ios/**/*.mode2v3
48 | **/ios/**/*.moved-aside
49 | **/ios/**/*.pbxuser
50 | **/ios/**/*.perspectivev3
51 | **/ios/**/*sync/
52 | **/ios/**/.sconsign.dblite
53 | **/ios/**/.tags*
54 | **/ios/**/.vagrant/
55 | **/ios/**/DerivedData/
56 | **/ios/**/Icon?
57 | **/ios/**/Pods/
58 | **/ios/**/.symlinks/
59 | **/ios/**/profile
60 | **/ios/**/xcuserdata
61 | **/ios/.generated/
62 | **/ios/Flutter/App.framework
63 | **/ios/Flutter/Flutter.framework
64 | **/ios/Flutter/Generated.xcconfig
65 | **/ios/Flutter/app.flx
66 | **/ios/Flutter/app.zip
67 | **/ios/Flutter/flutter_assets/
68 | **/ios/ServiceDefinitions.json
69 | **/ios/Runner/GeneratedPluginRegistrant.*
70 |
71 | # Exceptions to above rules.
72 | !**/ios/**/default.mode1v3
73 | !**/ios/**/default.mode2v3
74 | !**/ios/**/default.pbxuser
75 | !**/ios/**/default.perspectivev3
76 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
77 |
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/.idea/libraries/Dart_SDK.xml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/.idea/libraries/Flutter_Plugins.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | ## Flutter Widget Of The week
3 |
4 | I have created this playkist on youtube to teach you everyday a new widget a bit more in details with practical exmaples.
5 |
6 | - [Tutorials: Youtube](https://youtube.com/playlist?list=PLFyjjoCMAPtyjgH1Y2vBt4GlAd9FZ5xeh)
7 |
8 | ## Flutter Bootcamp 2022
9 |
10 | - [Playlist: Youtube](https://youtube.com/playlist?list=PLFyjjoCMAPtxq8V9fuVmgsYKLNIKqSEV4)
11 | - [RoadMap: Docs File ](https://lnkd.in/dHF8yc68)
12 |
--------------------------------------------------------------------------------
/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | # This file configures the analyzer, which statically analyzes Dart code to
2 | # check for errors, warnings, and lints.
3 | #
4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6 | # invoked from the command line by running `flutter analyze`.
7 |
8 | # The following line activates a set of recommended lints for Flutter apps,
9 | # packages, and plugins designed to encourage good coding practices.
10 | include: package:flutter_lints/flutter.yaml
11 |
12 | linter:
13 | # The lint rules applied to this project can be customized in the
14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml`
15 | # included above or to enable additional rules. A list of all available lints
16 | # and their documentation is published at
17 | # https://dart-lang.github.io/linter/lints/index.html.
18 | #
19 | # Instead of disabling a lint rule for the entire project in the
20 | # section below, it can also be suppressed for a single line of code
21 | # or a specific dart file by using the `// ignore: name_of_lint` and
22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file
23 | # producing the lint.
24 | rules:
25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule
26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27 |
28 | # Additional information about this file can be found at
29 | # https://dart.dev/guides/language/analysis-options
30 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 | **/*.keystore
13 | **/*.jks
14 |
--------------------------------------------------------------------------------
/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | apply plugin: 'kotlin-android'
26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27 |
28 | android {
29 | compileSdkVersion 34
30 | ndkVersion flutter.ndkVersion
31 |
32 | compileOptions {
33 | sourceCompatibility JavaVersion.VERSION_1_8
34 | targetCompatibility JavaVersion.VERSION_1_8
35 | }
36 |
37 | kotlinOptions {
38 | jvmTarget = '1.8'
39 | }
40 |
41 | sourceSets {
42 | main.java.srcDirs += 'src/main/kotlin'
43 | }
44 |
45 | defaultConfig {
46 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
47 | applicationId "com.techase.asif"
48 | // You can update the following values to match your application needs.
49 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
50 | minSdkVersion 21
51 | targetSdkVersion 33
52 | versionCode flutterVersionCode.toInteger()
53 | versionName flutterVersionName
54 | }
55 |
56 | buildTypes {
57 | release {
58 | // TODO: Add your own signing config for the release build.
59 | // Signing with the debug keys for now, so `flutter run --release` works.
60 | signingConfig signingConfigs.debug
61 | }
62 | }
63 | }
64 |
65 | flutter {
66 | source '../..'
67 | }
68 |
69 | dependencies {
70 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
71 | }
72 |
--------------------------------------------------------------------------------
/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
15 |
23 |
27 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
39 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/asif/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.asif
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/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/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 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/android/asif_android.iml:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.6.10'
3 | repositories {
4 | google()
5 | mavenCentral()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:7.1.2'
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 | #Fri Jun 23 08:50:38 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
7 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4 | def properties = new Properties()
5 |
6 | assert localPropertiesFile.exists()
7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
8 |
9 | def flutterSdkPath = properties.getProperty("flutter.sdk")
10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
12 |
--------------------------------------------------------------------------------
/asif.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/assets/fonts/Nunito-ExtraBold.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/assets/fonts/Nunito-ExtraBold.ttf
--------------------------------------------------------------------------------
/assets/fonts/Nunito-Regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/assets/fonts/Nunito-Regular.ttf
--------------------------------------------------------------------------------
/assets/images/avatar_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/assets/images/avatar_1.png
--------------------------------------------------------------------------------
/assets/images/avatar_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/assets/images/avatar_2.png
--------------------------------------------------------------------------------
/assets/images/avatar_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/assets/images/avatar_3.png
--------------------------------------------------------------------------------
/assets/images/avatar_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/assets/images/avatar_4.png
--------------------------------------------------------------------------------
/assets/images/avatar_5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/assets/images/avatar_5.png
--------------------------------------------------------------------------------
/assets/json/profiles.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "id": "1234",
4 | "userName": "Peter",
5 | "userAge": 27,
6 | "userDescription": "No pain no gain!",
7 | "profileImageSrc": "assets/profilepictures/profile_1.jpg"
8 | },
9 | {
10 | "id": "2345",
11 | "userName": "Greta",
12 | "userAge": 24,
13 | "userDescription": "I enjoy long walks to the fridge",
14 | "profileImageSrc": "assets/profilepictures/profile_2.jpg"
15 | },
16 | {
17 | "id": "3456",
18 | "userName": "Alex",
19 | "userAge": 33,
20 | "userDescription": "Let's connect and chat!",
21 | "profileImageSrc": "assets/profilepictures/profile_3.jpg"
22 | },
23 | {
24 | "id": "4567",
25 | "userName": "Sophie",
26 | "userAge": 26,
27 | "userDescription": "Please be patient, not often on this app",
28 | "profileImageSrc": "assets/profilepictures/profile_4.jpg"
29 | },
30 | {
31 | "id": "5678",
32 | "userName": "Karen",
33 | "userAge": 27,
34 | "userDescription": "Just ask!",
35 | "profileImageSrc": "assets/profilepictures/profile_5.jpg"
36 | },
37 | {
38 | "id": "6789",
39 | "userName": "Daniel",
40 | "userAge": 29,
41 | "userDescription": "Hiking & Travelling",
42 | "profileImageSrc": "assets/profilepictures/profile_6.jpg"
43 | }
44 | ]
--------------------------------------------------------------------------------
/assets/profilepictures/placeholder.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/assets/profilepictures/placeholder.jpg
--------------------------------------------------------------------------------
/assets/profilepictures/profile_1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/assets/profilepictures/profile_1.jpg
--------------------------------------------------------------------------------
/assets/profilepictures/profile_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/assets/profilepictures/profile_2.jpg
--------------------------------------------------------------------------------
/assets/profilepictures/profile_3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/assets/profilepictures/profile_3.jpg
--------------------------------------------------------------------------------
/assets/profilepictures/profile_4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/assets/profilepictures/profile_4.jpg
--------------------------------------------------------------------------------
/assets/profilepictures/profile_5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/assets/profilepictures/profile_5.jpg
--------------------------------------------------------------------------------
/assets/profilepictures/profile_6.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/assets/profilepictures/profile_6.jpg
--------------------------------------------------------------------------------
/images/category_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/images/category_icon.png
--------------------------------------------------------------------------------
/images/splash_pic.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/images/splash_pic.jpg
--------------------------------------------------------------------------------
/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 | 12.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, '12.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 | end
36 |
37 | post_install do |installer|
38 | installer.pods_project.targets.each do |target|
39 | flutter_additional_ios_build_settings(target)
40 | end
41 | end
42 |
--------------------------------------------------------------------------------
/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - connectivity_plus (0.0.1):
3 | - Flutter
4 | - FlutterMacOS
5 | - Flutter (1.0.0)
6 | - flutter_image_compress_common (1.0.0):
7 | - Flutter
8 | - Mantle
9 | - SDWebImage
10 | - SDWebImageWebPCoder
11 | - flutter_keyboard_visibility (0.0.1):
12 | - Flutter
13 | - flutter_localization (0.0.1):
14 | - Flutter
15 | - flutter_secure_storage (6.0.0):
16 | - Flutter
17 | - geolocator_apple (1.2.0):
18 | - Flutter
19 | - image_cropper (0.0.4):
20 | - Flutter
21 | - TOCropViewController (~> 2.7.4)
22 | - image_picker_ios (0.0.1):
23 | - Flutter
24 | - images_picker (0.0.1):
25 | - Flutter
26 | - ZLPhotoBrowser (= 4.2.5)
27 | - libwebp (1.3.2):
28 | - libwebp/demux (= 1.3.2)
29 | - libwebp/mux (= 1.3.2)
30 | - libwebp/sharpyuv (= 1.3.2)
31 | - libwebp/webp (= 1.3.2)
32 | - libwebp/demux (1.3.2):
33 | - libwebp/webp
34 | - libwebp/mux (1.3.2):
35 | - libwebp/demux
36 | - libwebp/sharpyuv (1.3.2)
37 | - libwebp/webp (1.3.2):
38 | - libwebp/sharpyuv
39 | - Mantle (2.2.0):
40 | - Mantle/extobjc (= 2.2.0)
41 | - Mantle/extobjc (2.2.0)
42 | - path_provider_foundation (0.0.1):
43 | - Flutter
44 | - FlutterMacOS
45 | - permission_handler_apple (9.3.0):
46 | - Flutter
47 | - quill_native_bridge (0.0.1):
48 | - Flutter
49 | - SDWebImage (5.19.7):
50 | - SDWebImage/Core (= 5.19.7)
51 | - SDWebImage/Core (5.19.7)
52 | - SDWebImageWebPCoder (0.14.6):
53 | - libwebp (~> 1.0)
54 | - SDWebImage/Core (~> 5.17)
55 | - shared_preferences_foundation (0.0.1):
56 | - Flutter
57 | - FlutterMacOS
58 | - TOCropViewController (2.7.4)
59 | - url_launcher_ios (0.0.1):
60 | - Flutter
61 | - ZLPhotoBrowser (4.2.5):
62 | - ZLPhotoBrowser/Core (= 4.2.5)
63 | - ZLPhotoBrowser/Core (4.2.5)
64 |
65 | DEPENDENCIES:
66 | - connectivity_plus (from `.symlinks/plugins/connectivity_plus/darwin`)
67 | - Flutter (from `Flutter`)
68 | - flutter_image_compress_common (from `.symlinks/plugins/flutter_image_compress_common/ios`)
69 | - flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`)
70 | - flutter_localization (from `.symlinks/plugins/flutter_localization/ios`)
71 | - flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
72 | - geolocator_apple (from `.symlinks/plugins/geolocator_apple/ios`)
73 | - image_cropper (from `.symlinks/plugins/image_cropper/ios`)
74 | - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
75 | - images_picker (from `.symlinks/plugins/images_picker/ios`)
76 | - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
77 | - permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
78 | - quill_native_bridge (from `.symlinks/plugins/quill_native_bridge/ios`)
79 | - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
80 | - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
81 |
82 | SPEC REPOS:
83 | trunk:
84 | - libwebp
85 | - Mantle
86 | - SDWebImage
87 | - SDWebImageWebPCoder
88 | - TOCropViewController
89 | - ZLPhotoBrowser
90 |
91 | EXTERNAL SOURCES:
92 | connectivity_plus:
93 | :path: ".symlinks/plugins/connectivity_plus/darwin"
94 | Flutter:
95 | :path: Flutter
96 | flutter_image_compress_common:
97 | :path: ".symlinks/plugins/flutter_image_compress_common/ios"
98 | flutter_keyboard_visibility:
99 | :path: ".symlinks/plugins/flutter_keyboard_visibility/ios"
100 | flutter_localization:
101 | :path: ".symlinks/plugins/flutter_localization/ios"
102 | flutter_secure_storage:
103 | :path: ".symlinks/plugins/flutter_secure_storage/ios"
104 | geolocator_apple:
105 | :path: ".symlinks/plugins/geolocator_apple/ios"
106 | image_cropper:
107 | :path: ".symlinks/plugins/image_cropper/ios"
108 | image_picker_ios:
109 | :path: ".symlinks/plugins/image_picker_ios/ios"
110 | images_picker:
111 | :path: ".symlinks/plugins/images_picker/ios"
112 | path_provider_foundation:
113 | :path: ".symlinks/plugins/path_provider_foundation/darwin"
114 | permission_handler_apple:
115 | :path: ".symlinks/plugins/permission_handler_apple/ios"
116 | quill_native_bridge:
117 | :path: ".symlinks/plugins/quill_native_bridge/ios"
118 | shared_preferences_foundation:
119 | :path: ".symlinks/plugins/shared_preferences_foundation/darwin"
120 | url_launcher_ios:
121 | :path: ".symlinks/plugins/url_launcher_ios/ios"
122 |
123 | SPEC CHECKSUMS:
124 | connectivity_plus: ddd7f30999e1faaef5967c23d5b6d503d10434db
125 | Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
126 | flutter_image_compress_common: ec1d45c362c9d30a3f6a0426c297f47c52007e3e
127 | flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
128 | flutter_localization: f43b18844a2b3d2c71fd64f04ffd6b1e64dd54d4
129 | flutter_secure_storage: d33dac7ae2ea08509be337e775f6b59f1ff45f12
130 | geolocator_apple: 6cbaf322953988e009e5ecb481f07efece75c450
131 | image_cropper: 37d40f62177c101ff4c164906d259ea2c3aa70cf
132 | image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1
133 | images_picker: fa9364e3a7d3083c49f865fcfb2b9e7cdc574d3a
134 | libwebp: 1786c9f4ff8a279e4dac1e8f385004d5fc253009
135 | Mantle: c5aa8794a29a022dfbbfc9799af95f477a69b62d
136 | path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
137 | permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
138 | quill_native_bridge: e5afa7d49c08cf68c52a5e23bc272eba6925c622
139 | SDWebImage: 8a6b7b160b4d710e2a22b6900e25301075c34cb3
140 | SDWebImageWebPCoder: e38c0a70396191361d60c092933e22c20d5b1380
141 | shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
142 | TOCropViewController: 80b8985ad794298fb69d3341de183f33d1853654
143 | url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe
144 | ZLPhotoBrowser: 4bfab86b851042e18d7f413284472aa68759626a
145 |
146 | PODFILE CHECKSUM: ce13d36744da294d67f8e460dbb7aed7c09bd7f4
147 |
148 | COCOAPODS: 1.15.2
149 |
--------------------------------------------------------------------------------
/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 |
41 |
42 |
52 |
54 |
60 |
61 |
62 |
63 |
69 |
71 |
77 |
78 |
79 |
80 |
82 |
83 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/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 | @main
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/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/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/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/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/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/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/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/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/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/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/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/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/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/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/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/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/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/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/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/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/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/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/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/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/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/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/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/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/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/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/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/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 |
6 | NSCameraUsageDescription
7 | To capture profile photo please grant camera access
8 | NSPhotoLibraryUsageDescription
9 | App needs access to photo lib for profile images
10 |
11 | CADisableMinimumFrameDurationOnPhone
12 |
13 | CFBundleDevelopmentRegion
14 | $(DEVELOPMENT_LANGUAGE)
15 | CFBundleDisplayName
16 | Asif
17 | CFBundleExecutable
18 | $(EXECUTABLE_NAME)
19 | CFBundleIdentifier
20 | $(PRODUCT_BUNDLE_IDENTIFIER)
21 | CFBundleInfoDictionaryVersion
22 | 6.0
23 | CFBundleName
24 | asif
25 | CFBundlePackageType
26 | APPL
27 | CFBundleShortVersionString
28 | $(FLUTTER_BUILD_NAME)
29 | CFBundleSignature
30 | ????
31 | CFBundleVersion
32 | $(FLUTTER_BUILD_NUMBER)
33 | LSRequiresIPhoneOS
34 |
35 | NSLocationAlwaysAndWhenInUsageDescription
36 | App app want's to access your location to get address
37 | NSLocationAlwaysAndWhenInUseUsageDescription
38 | App app want's to access your location to get address.
39 | NSLocationAlwaysUsageDescription
40 | App app want's to access your location to get address.
41 | NSLocationWhenInUseUsageDescription
42 | App want's to access your location to get address.
43 | UIApplicationSupportsIndirectInputEvents
44 |
45 | UILaunchStoryboardName
46 | LaunchScreen
47 | UIMainStoryboardFile
48 | Main
49 | UISupportedInterfaceOrientations
50 |
51 | UIInterfaceOrientationPortrait
52 | UIInterfaceOrientationLandscapeLeft
53 | UIInterfaceOrientationLandscapeRight
54 |
55 | UISupportedInterfaceOrientations~ipad
56 |
57 | UIInterfaceOrientationPortrait
58 | UIInterfaceOrientationPortraitUpsideDown
59 | UIInterfaceOrientationLandscapeLeft
60 | UIInterfaceOrientationLandscapeRight
61 |
62 | UIViewControllerBasedStatusBarAppearance
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/l10n.yaml:
--------------------------------------------------------------------------------
1 | arb-dir: lib/l10n
2 | template-arb-file: app_en.arb
3 | output-localization-file: app_localizations.dart
--------------------------------------------------------------------------------
/lib/dating_app/model/profile.dart:
--------------------------------------------------------------------------------
1 | class Profile {
2 | const Profile({
3 | required this.name,
4 | required this.distance,
5 | required this.imageAsset,
6 | });
7 | final String name;
8 | final String distance;
9 | final String imageAsset;
10 | }
11 |
--------------------------------------------------------------------------------
/lib/dating_app/widgets/action_button_widget.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class ActionButtonWidget extends StatelessWidget {
4 | const ActionButtonWidget(
5 | {Key? key, required this.onPressed, required this.icon})
6 | : super(key: key);
7 | final VoidCallback onPressed;
8 | final Icon icon;
9 |
10 | @override
11 | Widget build(BuildContext context) {
12 | return Material(
13 | shape: const CircleBorder(),
14 | child: Card(
15 | elevation: 10,
16 | shape: RoundedRectangleBorder(
17 | borderRadius: BorderRadius.circular(35.0),
18 | ),
19 | child: IconButton(onPressed: onPressed, icon: icon),
20 | ),
21 | );
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/lib/dating_app/widgets/background_curve_widget.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class BackgroudCurveWidget extends StatelessWidget {
4 | const BackgroudCurveWidget({Key? key}) : super(key: key);
5 |
6 | @override
7 | Widget build(BuildContext context) {
8 | return Container(
9 | width: double.infinity,
10 | height: 350,
11 | decoration: const ShapeDecoration(
12 | shape: RoundedRectangleBorder(
13 | borderRadius: BorderRadius.only(
14 | bottomLeft: Radius.circular(64),
15 | bottomRight: Radius.circular(64),
16 | ),
17 | ),
18 | gradient: LinearGradient(
19 | colors: [
20 | Color(0xFFFD0E42),
21 | Color(0xFFC30F31),
22 | ],
23 | ),
24 | ),
25 | child: const Padding(
26 | padding: EdgeInsets.only(top: 46.0, left: 20.0),
27 | child: Text(
28 | 'Discover',
29 | style: TextStyle(
30 | fontFamily: 'Nunito',
31 | fontWeight: FontWeight.w800,
32 | color: Colors.white,
33 | fontSize: 36,
34 | ),
35 | ),
36 | ),
37 | );
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/lib/dating_app/widgets/cards_stack_widget.dart:
--------------------------------------------------------------------------------
1 |
2 | import 'package:asif/dating_app/widgets/action_button_widget.dart';
3 | import 'package:asif/dating_app/widgets/drag_widget.dart';
4 | import 'package:flutter/material.dart';
5 |
6 | import '../model/profile.dart';
7 |
8 | class CardsStackWidget extends StatefulWidget {
9 | const CardsStackWidget({Key? key}) : super(key: key);
10 |
11 | @override
12 | State createState() => _CardsStackWidgetState();
13 | }
14 |
15 | enum Swipe { left, right, none }
16 |
17 | class _CardsStackWidgetState extends State
18 | with SingleTickerProviderStateMixin {
19 | List draggableItems = [
20 | const Profile(
21 | name: 'Rohini',
22 | distance: '10 miles away',
23 | imageAsset: 'assets/images/avatar_1.png'),
24 | const Profile(
25 | name: 'Rohini',
26 | distance: '10 miles away',
27 | imageAsset: 'assets/images/avatar_2.png'),
28 | const Profile(
29 | name: 'Rohini',
30 | distance: '10 miles away',
31 | imageAsset: 'assets/images/avatar_3.png'),
32 | const Profile(
33 | name: 'Rohini',
34 | distance: '10 miles away',
35 | imageAsset: 'assets/images/avatar_4.png'),
36 | const Profile(
37 | name: 'Rohini',
38 | distance: '10 miles away',
39 | imageAsset: 'assets/images/avatar_5.png'),
40 | ];
41 |
42 | ValueNotifier swipeNotifier = ValueNotifier(Swipe.none);
43 | late final AnimationController _animationController;
44 |
45 | @override
46 | void initState() {
47 | super.initState();
48 | _animationController = AnimationController(
49 | duration: const Duration(milliseconds: 500),
50 | vsync: this,
51 | );
52 | _animationController.addStatusListener((status) {
53 | if (status == AnimationStatus.completed) {
54 | draggableItems.removeLast();
55 | _animationController.reset();
56 | swipeNotifier.value = Swipe.none;
57 | }
58 | });
59 | }
60 |
61 | @override
62 | Widget build(BuildContext context) {
63 | return Scaffold(
64 | body: Stack(
65 | clipBehavior: Clip.none,
66 | children: [
67 | ClipRRect(
68 | borderRadius: BorderRadius.circular(10),
69 | child: ValueListenableBuilder(
70 | valueListenable: swipeNotifier,
71 | builder: (context, swipe, _) => Stack(
72 | clipBehavior: Clip.none,
73 | alignment: Alignment.center,
74 | children: List.generate(draggableItems.length, (index) {
75 | if (index == draggableItems.length - 1) {
76 | return PositionedTransition(
77 | rect: RelativeRectTween(
78 | begin: RelativeRect.fromSize(
79 | const Rect.fromLTWH(0, 0, 580, 340),
80 | const Size(580, 340)),
81 | end: RelativeRect.fromSize(
82 | Rect.fromLTWH(
83 | swipe != Swipe.none
84 | ? swipe == Swipe.left
85 | ? -300
86 | : 300
87 | : 0,
88 | 0,
89 | 580,
90 | 340),
91 | const Size(580, 340)),
92 | ).animate(CurvedAnimation(
93 | parent: _animationController,
94 | curve: Curves.easeInOut,
95 | )),
96 | child: RotationTransition(
97 | turns: Tween(
98 | begin: 0,
99 | end: swipe != Swipe.none
100 | ? swipe == Swipe.left
101 | ? -0.1 * 0.3
102 | : 0.1 * 0.3
103 | : 0.0)
104 | .animate(
105 | CurvedAnimation(
106 | parent: _animationController,
107 | curve:
108 | const Interval(0, 0.4, curve: Curves.easeInOut),
109 | ),
110 | ),
111 | child: DragWidget(
112 | profile: draggableItems[index],
113 | index: index,
114 | swipeNotifier: swipeNotifier,
115 | isLastCard: true,
116 | ),
117 | ),
118 | );
119 | } else {
120 | return DragWidget(
121 | profile: draggableItems[index],
122 | index: index,
123 | swipeNotifier: swipeNotifier,
124 | );
125 | }
126 | }),
127 | ),
128 | ),
129 | ),
130 |
131 | Positioned(
132 | bottom: 10,
133 | left: 0,
134 | right: 0,
135 | child: Padding(
136 | padding: const EdgeInsets.only(bottom: 46.0),
137 | child: Row(
138 | mainAxisAlignment: MainAxisAlignment.center,
139 | children: [
140 | ActionButtonWidget(
141 | onPressed: () {
142 | swipeNotifier.value = Swipe.left;
143 | _animationController.forward();
144 | },
145 | icon: const Icon(
146 | Icons.close,
147 | color: Colors.grey,
148 | ),
149 | ),
150 | const SizedBox(width: 20),
151 | ActionButtonWidget(
152 | onPressed: () {
153 | swipeNotifier.value = Swipe.right;
154 | _animationController.forward();
155 | },
156 | icon: const Icon(
157 | Icons.favorite,
158 | color: Colors.red,
159 | ),
160 | ),
161 | ],
162 | ),
163 | ),
164 | ),
165 | ],
166 | ),
167 | );
168 | }
169 | }
170 |
--------------------------------------------------------------------------------
/lib/dating_app/widgets/drag_widget.dart:
--------------------------------------------------------------------------------
1 |
2 |
3 | import 'package:asif/dating_app/model/profile.dart';
4 | import 'package:asif/dating_app/widgets/profile_card.dart';
5 | import 'package:asif/dating_app/widgets/tag_widget.dart';
6 | import 'package:flutter/material.dart';
7 | import 'cards_stack_widget.dart';
8 |
9 | class DragWidget extends StatefulWidget {
10 | const DragWidget({
11 | Key? key,
12 | required this.profile,
13 | required this.index,
14 | required this.swipeNotifier,
15 | this.isLastCard = false,
16 | }) : super(key: key);
17 | final Profile profile;
18 | final int index;
19 | final ValueNotifier swipeNotifier;
20 | final bool isLastCard;
21 |
22 | @override
23 | State createState() => _DragWidgetState();
24 | }
25 |
26 | class _DragWidgetState extends State {
27 | @override
28 | Widget build(BuildContext context) {
29 | print(widget.swipeNotifier.value );
30 | return Center(
31 | child: Draggable(
32 | // Data is the value this Draggable stores.
33 | data: widget.index,
34 | feedback: Material(
35 | color: Colors.transparent,
36 | child: ValueListenableBuilder(
37 | valueListenable: widget.swipeNotifier,
38 | builder: (context, swipe, _) {
39 | return RotationTransition(
40 | turns: widget.swipeNotifier.value != Swipe.none
41 | ? widget.swipeNotifier.value == Swipe.left
42 | ? const AlwaysStoppedAnimation(-15 / 360)
43 | : const AlwaysStoppedAnimation(15 / 360)
44 | : const AlwaysStoppedAnimation(0),
45 | child: Stack(
46 | children: [
47 | ProfileCard(profile: widget.profile),
48 | widget.swipeNotifier.value != Swipe.none
49 | ? widget.swipeNotifier.value == Swipe.right
50 | ? Positioned(
51 | top: 40,
52 | left: 20,
53 | child: Transform.rotate(
54 | angle: 12,
55 | child: TagWidget(
56 | text: 'LIKE',
57 | color: Colors.green[400]!,
58 | ),
59 | ),
60 | )
61 | : Positioned(
62 | top: 50,
63 | right: 24,
64 | child: Transform.rotate(
65 | angle: -12,
66 | child: TagWidget(
67 | text: 'DISLIKE',
68 | color: Colors.red[400]!,
69 | ),
70 | ),
71 | )
72 | : const SizedBox.shrink(),
73 | ],
74 | ),
75 | );
76 | },
77 | ),
78 | ),
79 | onDragUpdate: (DragUpdateDetails dragUpdateDetails) {
80 | if (dragUpdateDetails.delta.dx > 0 &&
81 | dragUpdateDetails.globalPosition.dx >
82 | MediaQuery.of(context).size.width / 2) {
83 | widget.swipeNotifier.value = Swipe.right;
84 | }
85 | if (dragUpdateDetails.delta.dx < 0 &&
86 | dragUpdateDetails.globalPosition.dx <
87 | MediaQuery.of(context).size.width / 2) {
88 | widget.swipeNotifier.value = Swipe.left;
89 | }
90 | },
91 | onDragEnd: (drag) {
92 | widget.swipeNotifier.value = Swipe.none;
93 | },
94 |
95 | childWhenDragging: Container(
96 | color: Colors.transparent,
97 | ),
98 |
99 | //This will be visible when we press action button
100 | child: ValueListenableBuilder(
101 | valueListenable: widget.swipeNotifier,
102 | builder: (BuildContext context, Swipe swipe, Widget? child) {
103 | return Stack(
104 | children: [
105 | ProfileCard(profile: widget.profile),
106 | // heck if this is the last card and Swipe is not equal to Swipe.none
107 | swipe != Swipe.none && widget.isLastCard
108 | ? swipe == Swipe.right
109 | ? Positioned(
110 | top: 40,
111 | left: 20,
112 | child: Transform.rotate(
113 | angle: 12,
114 | child: TagWidget(
115 | text: 'LIKE',
116 | color: Colors.green[400]!,
117 | ),
118 | ),
119 | )
120 | : Positioned(
121 | top: 50,
122 | right: 24,
123 | child: Transform.rotate(
124 | angle: -12,
125 | child: TagWidget(
126 | text: 'DISLIKE',
127 | color: Colors.red[400]!,
128 | ),
129 | ),
130 | )
131 | : const SizedBox.shrink(),
132 | ],
133 | );
134 | }),
135 | ),
136 | );
137 | }
138 | }
139 |
--------------------------------------------------------------------------------
/lib/dating_app/widgets/profile_card.dart:
--------------------------------------------------------------------------------
1 |
2 | import 'package:asif/dating_app/model/profile.dart';
3 | import 'package:flutter/material.dart';
4 |
5 |
6 | class ProfileCard extends StatelessWidget {
7 | const ProfileCard({Key? key, required this.profile}) : super(key: key);
8 | final Profile profile;
9 |
10 | @override
11 | Widget build(BuildContext context) {
12 | return Container(
13 | height: 580,
14 | width: 340,
15 | padding: const EdgeInsets.symmetric(vertical: 10),
16 | child: Stack(
17 | children: [
18 | Positioned.fill(
19 | child: ClipRRect(
20 | borderRadius: BorderRadius.circular(10),
21 | child: Image.asset(
22 | profile.imageAsset,
23 | fit: BoxFit.fitHeight,
24 | ),
25 | ),
26 | ),
27 | Positioned(
28 | bottom: 0,
29 | child: Container(
30 | height: 80,
31 | width: 340,
32 | decoration: ShapeDecoration(
33 | color: Colors.white,
34 | shape: RoundedRectangleBorder(
35 | borderRadius: BorderRadius.circular(10),
36 | ),
37 | shadows: [
38 | BoxShadow(
39 | color: Colors.black.withOpacity(0.05),
40 | blurRadius: 8,
41 | ),
42 | ],
43 | ),
44 | child: Padding(
45 | padding: const EdgeInsets.only(left: 20),
46 | child: Column(
47 | crossAxisAlignment: CrossAxisAlignment.start,
48 | mainAxisAlignment: MainAxisAlignment.center,
49 | children: [
50 | Text(
51 | profile.name,
52 | style: const TextStyle(
53 | fontFamily: 'Nunito',
54 | fontWeight: FontWeight.w800,
55 | fontSize: 21,
56 | ),
57 | ),
58 | Text(
59 | profile.distance,
60 | style: const TextStyle(
61 | fontFamily: 'Nunito',
62 | fontWeight: FontWeight.w400,
63 | fontSize: 14,
64 | color: Colors.grey,
65 | ),
66 | ),
67 | ],
68 | ),
69 | ),
70 | ),
71 | ),
72 | ],
73 | ),
74 | );
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/lib/dating_app/widgets/tag_widget.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class TagWidget extends StatelessWidget {
4 | const TagWidget({
5 | Key? key,
6 | required this.text,
7 | required this.color,
8 | }) : super(key: key);
9 | final String text;
10 | final Color color;
11 |
12 | @override
13 | Widget build(BuildContext context) {
14 | return Container(
15 | padding: const EdgeInsets.symmetric(horizontal: 12),
16 | decoration: ShapeDecoration(
17 | shape: RoundedRectangleBorder(
18 | borderRadius: BorderRadius.circular(10),
19 | side: BorderSide(
20 | color: color,
21 | width: 4,
22 | ),
23 | ),
24 | ),
25 | child: Text(
26 | text,
27 | style: TextStyle(
28 | color: color,
29 | fontSize: 36,
30 | ),
31 | ),
32 | );
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/lib/error_example/error_example.dart:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | import 'package:flutter/material.dart';
5 |
6 | class ErrorExamplesScreen extends StatefulWidget {
7 | const ErrorExamplesScreen({Key? key}) : super(key: key);
8 |
9 | @override
10 | State createState() => _ErrorExamplesScreenState();
11 | }
12 |
13 | class _ErrorExamplesScreenState extends State {
14 |
15 |
16 | @override
17 | Widget build(BuildContext context) {
18 | return const Scaffold(
19 |
20 | body: Column(
21 |
22 |
23 | ),
24 | );
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/lib/extensions/country_code_country_flag_extension.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/foundation.dart';
2 | import 'package:flutter/material.dart';
3 | import "package:equatable/equatable.dart";
4 |
5 |
6 |
7 | class Person {
8 | final String name;
9 | final int age;
10 | const Person({required this.name, required this.age});
11 |
12 | }
13 | class CountryCodeToFlagExtension extends StatelessWidget {
14 | const CountryCodeToFlagExtension({Key? key}) : super(key: key);
15 |
16 | @override
17 | Widget build(BuildContext context) {
18 | return Scaffold(
19 | floatingActionButton: FloatingActionButton(
20 | onPressed: (){
21 | Person bob = const Person(name: "Bob", age: 40);
22 | Person bob1 = const Person(name: "Bob", age: 40);
23 |
24 | },
25 | ),
26 | appBar: AppBar(
27 | title: const Text('Flag Extension'),
28 | ),
29 | body: Center(
30 | child: Text("IND".toFlag.toString(), style: const TextStyle(fontSize: 50),)),
31 | );
32 | }
33 | }
34 |
35 |
36 | extension ConvertFlag on String {
37 | String get toFlag {
38 |
39 | return (this).toUpperCase().replaceAllMapped(RegExp(r'[A-Z]'),
40 | (match) => String.fromCharCode(match.group(0)!.codeUnitAt(0) + 127397));
41 | }
42 | }
--------------------------------------------------------------------------------
/lib/extensions/sizebox_extension.dart:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | import 'package:flutter/material.dart';
5 |
6 | class SizeBoxExtensionWidget extends StatelessWidget {
7 | const SizeBoxExtensionWidget({Key? key}) : super(key: key);
8 |
9 | @override
10 | Widget build(BuildContext context) {
11 | return Scaffold(
12 | appBar: AppBar(),
13 | body: SafeArea(
14 | child: Column(
15 | children: [
16 | Text(
17 | 'Hello, World!',
18 | style: Theme.of(context).textTheme.bodyMedium,
19 | ).center(),
20 | 20.ph,//I
21 | const ContainerWidget(),
22 | // This is size box extension which will return SizedBox(height: 100)
23 | 50.ph,
24 | const ContainerWidget(),
25 | 50.ph,
26 | Row(
27 | children: [
28 | const Expanded(child: ContainerWidget()),
29 | 100.pw,
30 | const Expanded(child: ContainerWidget()),
31 | ],
32 | )
33 | ],
34 | ),
35 | ),
36 | );
37 | }
38 | }
39 |
40 | // creating extension for Size box on number to return double value
41 | extension PaddingHeight on num {
42 | SizedBox get ph => SizedBox(height:toDouble() ,);
43 | SizedBox get pw => SizedBox(width:toDouble() ,);
44 | }
45 |
46 | extension WidgetExtension on Widget{
47 | Widget horizontalPadding(double padding)=>Padding(
48 | padding:EdgeInsets.symmetric(horizontal: padding),
49 | child:this);
50 |
51 | Widget center()=> Center(child:this);
52 | }
53 |
54 | extension MediaQueryValues on BuildContext {
55 | double get mediaQueryWidth => MediaQuery.of(this).size.width;
56 | double get mediaQueryHeight => MediaQuery.of(this).size.height ;
57 | }
58 |
59 |
60 | class ContainerWidget extends StatelessWidget {
61 | const ContainerWidget({Key? key}) : super(key: key);
62 |
63 | @override
64 | Widget build(BuildContext context) {
65 | return Container(
66 | height: 50,
67 | width: 100,
68 | color: Colors.red,
69 | );
70 | }
71 | }
72 |
73 |
74 |
--------------------------------------------------------------------------------
/lib/freeze/freeze_screen.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_gen/gen_l10n/app_localizations.dart';
3 |
4 | class FreezeScreen extends StatefulWidget {
5 | const FreezeScreen({Key? key}) : super(key: key);
6 |
7 | @override
8 | State createState() => _FreezeScreenState();
9 | }
10 |
11 | class _FreezeScreenState extends State {
12 | @override
13 | Widget build(BuildContext context) {
14 | return Scaffold(
15 | appBar: AppBar(
16 | title: Text(AppLocalizations.of(context)!.helloWorld),
17 | ),
18 | body: Center(
19 | child: TextButton(
20 | onPressed: () {
21 | context.showCustomSnackBar(message: 'Message delete', textColor: Colors.orangeAccent);
22 | },
23 | child: Text('Click Me'),
24 | ),
25 | ),
26 | );
27 | }
28 | }
29 |
30 | extension SnackBarExtention on BuildContext {
31 | void showCustomSnackBar({
32 | required String message,
33 | Color textColor = Colors.white,
34 | }) {
35 | ScaffoldMessenger.of(this).showSnackBar(
36 | SnackBar(
37 | content: Text(
38 | message,
39 | style: TextStyle(color: textColor),
40 | ),
41 | backgroundColor: Colors.green,
42 | ),
43 | );
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/lib/freeze/person.dart:
--------------------------------------------------------------------------------
1 |
2 | import 'package:freezed_annotation/freezed_annotation.dart';
3 | import 'package:flutter/foundation.dart';
4 |
5 | part 'person.freezed.dart';
6 | part 'person.g.dart';
7 |
8 | @Freezed()
9 | class UserModel with _$UserModel {
10 | @JsonSerializable(fieldRename: FieldRename.snake)
11 | factory UserModel({
12 | required String firstName,
13 | required String lastName,
14 | @Default(24) int age,
15 | }) = _UserModel;
16 |
17 | factory UserModel.fromJson(Map json) => _$UserModelFromJson(json);
18 | }
19 |
20 |
--------------------------------------------------------------------------------
/lib/freeze/person.freezed.dart:
--------------------------------------------------------------------------------
1 | // coverage:ignore-file
2 | // GENERATED CODE - DO NOT MODIFY BY HAND
3 | // ignore_for_file: type=lint
4 | // ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
5 |
6 | part of 'person.dart';
7 |
8 | // **************************************************************************
9 | // FreezedGenerator
10 | // **************************************************************************
11 |
12 | T _$identity(T value) => value;
13 |
14 | final _privateConstructorUsedError = UnsupportedError(
15 | 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
16 |
17 | UserModel _$UserModelFromJson(Map json) {
18 | return _UserModel.fromJson(json);
19 | }
20 |
21 | /// @nodoc
22 | mixin _$UserModel {
23 | String get firstName => throw _privateConstructorUsedError;
24 | String get lastName => throw _privateConstructorUsedError;
25 | int get age => throw _privateConstructorUsedError;
26 |
27 | Map toJson() => throw _privateConstructorUsedError;
28 | @JsonKey(ignore: true)
29 | $UserModelCopyWith get copyWith =>
30 | throw _privateConstructorUsedError;
31 | }
32 |
33 | /// @nodoc
34 | abstract class $UserModelCopyWith<$Res> {
35 | factory $UserModelCopyWith(UserModel value, $Res Function(UserModel) then) =
36 | _$UserModelCopyWithImpl<$Res, UserModel>;
37 | @useResult
38 | $Res call({String firstName, String lastName, int age});
39 | }
40 |
41 | /// @nodoc
42 | class _$UserModelCopyWithImpl<$Res, $Val extends UserModel>
43 | implements $UserModelCopyWith<$Res> {
44 | _$UserModelCopyWithImpl(this._value, this._then);
45 |
46 | // ignore: unused_field
47 | final $Val _value;
48 | // ignore: unused_field
49 | final $Res Function($Val) _then;
50 |
51 | @pragma('vm:prefer-inline')
52 | @override
53 | $Res call({
54 | Object? firstName = null,
55 | Object? lastName = null,
56 | Object? age = null,
57 | }) {
58 | return _then(_value.copyWith(
59 | firstName: null == firstName
60 | ? _value.firstName
61 | : firstName // ignore: cast_nullable_to_non_nullable
62 | as String,
63 | lastName: null == lastName
64 | ? _value.lastName
65 | : lastName // ignore: cast_nullable_to_non_nullable
66 | as String,
67 | age: null == age
68 | ? _value.age
69 | : age // ignore: cast_nullable_to_non_nullable
70 | as int,
71 | ) as $Val);
72 | }
73 | }
74 |
75 | /// @nodoc
76 | abstract class _$$_UserModelCopyWith<$Res> implements $UserModelCopyWith<$Res> {
77 | factory _$$_UserModelCopyWith(
78 | _$_UserModel value, $Res Function(_$_UserModel) then) =
79 | __$$_UserModelCopyWithImpl<$Res>;
80 | @override
81 | @useResult
82 | $Res call({String firstName, String lastName, int age});
83 | }
84 |
85 | /// @nodoc
86 | class __$$_UserModelCopyWithImpl<$Res>
87 | extends _$UserModelCopyWithImpl<$Res, _$_UserModel>
88 | implements _$$_UserModelCopyWith<$Res> {
89 | __$$_UserModelCopyWithImpl(
90 | _$_UserModel _value, $Res Function(_$_UserModel) _then)
91 | : super(_value, _then);
92 |
93 | @pragma('vm:prefer-inline')
94 | @override
95 | $Res call({
96 | Object? firstName = null,
97 | Object? lastName = null,
98 | Object? age = null,
99 | }) {
100 | return _then(_$_UserModel(
101 | firstName: null == firstName
102 | ? _value.firstName
103 | : firstName // ignore: cast_nullable_to_non_nullable
104 | as String,
105 | lastName: null == lastName
106 | ? _value.lastName
107 | : lastName // ignore: cast_nullable_to_non_nullable
108 | as String,
109 | age: null == age
110 | ? _value.age
111 | : age // ignore: cast_nullable_to_non_nullable
112 | as int,
113 | ));
114 | }
115 | }
116 |
117 | /// @nodoc
118 |
119 | @JsonSerializable(fieldRename: FieldRename.snake)
120 | class _$_UserModel with DiagnosticableTreeMixin implements _UserModel {
121 | _$_UserModel(
122 | {required this.firstName, required this.lastName, this.age = 24});
123 |
124 | factory _$_UserModel.fromJson(Map json) =>
125 | _$$_UserModelFromJson(json);
126 |
127 | @override
128 | final String firstName;
129 | @override
130 | final String lastName;
131 | @override
132 | @JsonKey()
133 | final int age;
134 |
135 | @override
136 | String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
137 | return 'UserModel(firstName: $firstName, lastName: $lastName, age: $age)';
138 | }
139 |
140 | @override
141 | void debugFillProperties(DiagnosticPropertiesBuilder properties) {
142 | super.debugFillProperties(properties);
143 | properties
144 | ..add(DiagnosticsProperty('type', 'UserModel'))
145 | ..add(DiagnosticsProperty('firstName', firstName))
146 | ..add(DiagnosticsProperty('lastName', lastName))
147 | ..add(DiagnosticsProperty('age', age));
148 | }
149 |
150 | @override
151 | bool operator ==(dynamic other) {
152 | return identical(this, other) ||
153 | (other.runtimeType == runtimeType &&
154 | other is _$_UserModel &&
155 | (identical(other.firstName, firstName) ||
156 | other.firstName == firstName) &&
157 | (identical(other.lastName, lastName) ||
158 | other.lastName == lastName) &&
159 | (identical(other.age, age) || other.age == age));
160 | }
161 |
162 | @JsonKey(ignore: true)
163 | @override
164 | int get hashCode => Object.hash(runtimeType, firstName, lastName, age);
165 |
166 | @JsonKey(ignore: true)
167 | @override
168 | @pragma('vm:prefer-inline')
169 | _$$_UserModelCopyWith<_$_UserModel> get copyWith =>
170 | __$$_UserModelCopyWithImpl<_$_UserModel>(this, _$identity);
171 |
172 | @override
173 | Map toJson() {
174 | return _$$_UserModelToJson(
175 | this,
176 | );
177 | }
178 | }
179 |
180 | abstract class _UserModel implements UserModel {
181 | factory _UserModel(
182 | {required final String firstName,
183 | required final String lastName,
184 | final int age}) = _$_UserModel;
185 |
186 | factory _UserModel.fromJson(Map json) =
187 | _$_UserModel.fromJson;
188 |
189 | @override
190 | String get firstName;
191 | @override
192 | String get lastName;
193 | @override
194 | int get age;
195 | @override
196 | @JsonKey(ignore: true)
197 | _$$_UserModelCopyWith<_$_UserModel> get copyWith =>
198 | throw _privateConstructorUsedError;
199 | }
200 |
--------------------------------------------------------------------------------
/lib/freeze/person.g.dart:
--------------------------------------------------------------------------------
1 | // GENERATED CODE - DO NOT MODIFY BY HAND
2 |
3 | part of 'person.dart';
4 |
5 | // **************************************************************************
6 | // JsonSerializableGenerator
7 | // **************************************************************************
8 |
9 | _$_UserModel _$$_UserModelFromJson(Map json) => _$_UserModel(
10 | firstName: json['first_name'] as String,
11 | lastName: json['last_name'] as String,
12 | age: json['age'] as int? ?? 24,
13 | );
14 |
15 | Map _$$_UserModelToJson(_$_UserModel instance) =>
16 | {
17 | 'first_name': instance.firstName,
18 | 'last_name': instance.lastName,
19 | 'age': instance.age,
20 | };
21 |
--------------------------------------------------------------------------------
/lib/html_editor.dart:
--------------------------------------------------------------------------------
1 |
2 |
3 | import 'dart:async';
4 | import 'dart:convert';
5 |
6 | import 'package:flutter/material.dart';
7 | import 'package:flutter_quill/flutter_quill.dart' hide Text;
8 | import 'package:tuple/tuple.dart';
9 |
10 | class HtmlEditor extends StatefulWidget {
11 | const HtmlEditor({Key? key}) : super(key: key);
12 |
13 | @override
14 | State createState() => _HtmlEditorState();
15 | }
16 |
17 | enum _SelectionType {
18 | none,
19 | word,
20 | // line,
21 | }
22 |
23 |
24 | class _HtmlEditorState extends State {
25 |
26 | QuillController _controller = QuillController.basic();
27 | final bodyFocusNode = FocusNode();
28 | _SelectionType _selectionType = _SelectionType.none;
29 | Timer? _selectAllTimer;
30 | bool _onTripleClickSelection() {
31 | final controller = _controller!;
32 |
33 | _selectAllTimer?.cancel();
34 | _selectAllTimer = null;
35 |
36 | // If you want to select all text after paragraph, uncomment this line
37 | // if (_selectionType == _SelectionType.line) {
38 | // final selection = TextSelection(
39 | // baseOffset: 0,
40 | // extentOffset: controller.document.length,
41 | // );
42 |
43 | // controller.updateSelection(selection, ChangeSource.REMOTE);
44 |
45 | // _selectionType = _SelectionType.none;
46 |
47 | // return true;
48 | // }
49 |
50 | if (controller.selection.isCollapsed) {
51 | _selectionType = _SelectionType.none;
52 | }
53 |
54 | if (_selectionType == _SelectionType.none) {
55 | _selectionType = _SelectionType.word;
56 | _startTripleClickTimer();
57 | return false;
58 | }
59 |
60 | if (_selectionType == _SelectionType.word) {
61 | final child = controller.document.queryChild(
62 | controller.selection.baseOffset,
63 | );
64 | final offset = child.node?.documentOffset ?? 0;
65 | final length = child.node?.length ?? 0;
66 |
67 | final selection = TextSelection(
68 | baseOffset: offset,
69 | extentOffset: offset + length,
70 | );
71 |
72 | controller.updateSelection(selection, ChangeSource.remote);
73 |
74 | // _selectionType = _SelectionType.line;
75 |
76 | _selectionType = _SelectionType.none;
77 |
78 | _startTripleClickTimer();
79 |
80 | return true;
81 | }
82 |
83 | return false;
84 | }
85 |
86 | void _startTripleClickTimer() {
87 | _selectAllTimer = Timer(const Duration(milliseconds: 900), () {
88 | _selectionType = _SelectionType.none;
89 | });
90 | }
91 | var length ;
92 | @override
93 | void initState() {
94 | // TODO: implement initState
95 | super.initState();
96 |
97 |
98 | _controller.addListener(() {
99 |
100 |
101 | setState(() {
102 |
103 | });
104 | }) ;
105 |
106 | }
107 | @override
108 | Widget build(BuildContext context) {
109 | return Scaffold(
110 | body: SafeArea(
111 | child: Column(
112 | children: [
113 | Text(length.toString()),
114 | Text((_controller.plainTextEditingValue.text.length-1).toString()),
115 | Text(_controller.selection.baseOffset.toString()),
116 | Text(_controller.selection.extentOffset.toString()),
117 | Text(_controller.selection.base.toString()),
118 |
119 | Container(
120 | decoration: const BoxDecoration(
121 | borderRadius: BorderRadius.only(
122 | topRight: Radius.circular(8),
123 | topLeft: Radius.circular(8)
124 | )
125 | ),
126 | child: QuillToolbar.simple(controller: _controller ),
127 | ),
128 | Container(
129 | height: 200,
130 | decoration: const BoxDecoration(
131 | color: Colors.grey,
132 | borderRadius: BorderRadius.only(
133 | bottomRight: Radius.circular(8),
134 | bottomLeft: Radius.circular(8)
135 | )
136 |
137 | ),
138 | child: Theme(
139 | data: ThemeData.dark(),
140 | child: MouseRegion(
141 | cursor: SystemMouseCursors.text,
142 | child: Padding(
143 | padding: const EdgeInsets.only(left: 15 , top: 15, bottom: 20),
144 | child: QuillEditor(
145 | controller: _controller,
146 | scrollController: ScrollController(),
147 | focusNode: bodyFocusNode,
148 | ),
149 | ),
150 | ),
151 | ),
152 | ),
153 | ],
154 | ),
155 | ),
156 | );
157 | }
158 | }
159 |
--------------------------------------------------------------------------------
/lib/l10n/app_en.arb:
--------------------------------------------------------------------------------
1 | {
2 | "helloWorld": "Hello World!",
3 | "@helloWorld": {
4 | "description": "The conventional newborn programmer greeting"
5 | },
6 | "email": "Email",
7 | "password": "Password" ,
8 | "login": "Login"
9 | }
--------------------------------------------------------------------------------
/lib/l10n/app_es.arb:
--------------------------------------------------------------------------------
1 | {
2 | "helloWorld": "¡Hola Mundo!" ,
3 | "email": "Correo electrónico",
4 | "password": "Contraseña",
5 | "login": "Acceso"
6 | }
--------------------------------------------------------------------------------
/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:asif/provider/app_language/app_language.dart';
2 | import 'package:asif/rating_screen.dart';
3 | import 'package:asif/screen/pagination_screen/pagination_screen.dart';
4 | import 'package:asif/screen/search_places_api/google_map_search_places_api.dart';
5 | import 'package:asif/utils/session_controller.dart';
6 |
7 | import 'package:flutter/material.dart';
8 | import 'package:flutter_localizations/flutter_localizations.dart';
9 | import 'package:flutter_gen/gen_l10n/app_localizations.dart' ;
10 | import 'package:provider/provider.dart';
11 | import 'package:shared_preferences/shared_preferences.dart';
12 |
13 | import 'freeze/freeze_screen.dart';
14 |
15 |
16 | AppLanguage appLanguage = AppLanguage();
17 |
18 | void main() async{
19 | WidgetsFlutterBinding.ensureInitialized();
20 | final prefs = await SharedPreferences.getInstance();
21 | final String languageCode = prefs.getString('language_code') ?? '' ;
22 | await SessionController.instance.loadSession();
23 | runApp( MyApp(locale: languageCode ));
24 | }
25 |
26 | class MyApp extends StatelessWidget {
27 | final String locale ;
28 | const MyApp({Key? key , required this.locale}) : super(key: key);
29 |
30 |
31 | // This widget is the root of your application.
32 | @override
33 | Widget build(BuildContext context) {
34 | return MultiProvider(
35 | providers: [
36 | ChangeNotifierProvider(create: (_) => AppLanguage()),
37 | ],
38 | child: Consumer(
39 | builder: (context, provider, child) {
40 | if (provider.appLocal == null) {
41 | if (locale.isEmpty) {
42 | provider.changeLanguage(Locale('en'));
43 | } else {
44 | provider.changeLanguage(Locale(locale));
45 | }
46 | }
47 | return MaterialApp(
48 | title: 'Flutter Demo',
49 | debugShowCheckedModeBanner: false,
50 | theme: ThemeData(
51 | brightness: Brightness.dark
52 | ),
53 | locale: locale == '' ? Locale( 'en') : provider.appLocal == null ? Locale(locale) : Provider.of(context).appLocal,
54 | localizationsDelegates: const [
55 | AppLocalizations.delegate,
56 | GlobalMaterialLocalizations.delegate,
57 | GlobalWidgetsLocalizations.delegate,
58 | GlobalCupertinoLocalizations.delegate,
59 | ],
60 | supportedLocales: const [
61 | Locale('en'), // English
62 | Locale('es'), // Spanish
63 | ],
64 |
65 | home: const RatingScreen(),
66 | );
67 | },
68 | )
69 |
70 | );
71 | }
72 |
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/lib/math_ai_screen.dart:
--------------------------------------------------------------------------------
1 | import 'dart:convert';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'dart:io';
5 | import 'package:flutter/foundation.dart';
6 | import 'package:image_cropper/image_cropper.dart';
7 | import 'package:path_provider/path_provider.dart' as path_provider;
8 | import 'package:flutter/material.dart';
9 | import 'package:http/http.dart' as http;
10 | import 'package:flutter_image_compress/flutter_image_compress.dart';
11 | import 'package:image_picker/image_picker.dart';
12 |
13 | class MathAiScreen extends StatefulWidget {
14 | const MathAiScreen({super.key});
15 |
16 | @override
17 | State createState() => _MathAiScreenState();
18 | }
19 |
20 | class _MathAiScreenState extends State {
21 |
22 | File? newImage ;
23 | XFile? image ;
24 | final picker = ImagePicker();
25 |
26 | // method to pick single image while replacing the photo
27 | Future imagePickerFromGallery ()async{
28 |
29 | image = (await picker.pickImage(source: ImageSource.gallery))!;
30 |
31 | CroppedFile? croppedFile = await ImageCropper().cropImage(
32 | sourcePath: image!.path,
33 | uiSettings: [
34 | AndroidUiSettings(
35 | toolbarTitle: 'Cropper',
36 | toolbarColor: Colors.deepOrange,
37 | toolbarWidgetColor: Colors.white,
38 | aspectRatioPresets: [
39 | CropAspectRatioPreset.original,
40 | CropAspectRatioPreset.square,
41 | CropAspectRatioPreset.ratio3x2,
42 | CropAspectRatioPreset.ratio4x3,
43 | CropAspectRatioPreset.ratio5x4,
44 | CropAspectRatioPreset.ratio16x9,
45 | CropAspectRatioPreset.ratio5x4,
46 | // CropAspectRatioPresetCustom(),
47 | ],
48 | ),
49 | IOSUiSettings(
50 | title: 'Cropper',
51 | aspectRatioPresets: [
52 | CropAspectRatioPreset.original,
53 | CropAspectRatioPreset.square,
54 | // CropAspectRatioPresetCustom(), // IMPORTANT: iOS supports only one custom aspect ratio in preset list
55 | ],
56 | ),
57 | WebUiSettings(
58 | context: context,
59 | ),
60 | ],
61 | );
62 | newImage = File(croppedFile!.path) ;
63 |
64 | setState(() {});
65 |
66 | }
67 |
68 |
69 | Future sendImage(File imageFile)async{
70 | String base64Image = base64Encode(imageFile.readAsBytesSync());
71 | String apiKey = 'AIzaSyCNPXTgr6aDQyy2GJgunSUdaLJ7gF1rwpg';
72 |
73 | String requestBody = json.encode(
74 | {
75 | "contents": [
76 | {
77 | "role": "user",
78 | "parts": [
79 | {
80 | "fileData": {
81 | "fileUri": base64Image,
82 | "mimeType": "image/png"
83 | }
84 | },
85 | {
86 | "text": "Solve this mathematic equation and write step by step details and reason behind that step ? "
87 | }
88 | ]
89 | },
90 | {
91 | "role": "model",
92 | "parts": [
93 | {
94 | "text": "The given equation is the quadratic formula. This formula is used to find the solutions (also called roots) of a quadratic equation in the form ax² + bx + c = 0. Here'\''s how it works:\\n\\n**1. Identify the Coefficients:**\\n\\n* The quadratic equation is in the form ax² + bx + c = 0.\\n* Identify the coefficients '\''a'\'', '\''b'\'', and '\''c'\'' from the given equation.\\n\\n**2. Substitute the Values into the Quadratic Formula:**\\n\\n* The quadratic formula is: \\n x = (-b ± √(b² - 4ac)) / 2a \\n\\n* Substitute the values of '\''a'\'', '\''b'\'', and '\''c'\'' into the formula.\\n\\n**3. Simplify the Expression:**\\n\\n* Calculate the value inside the square root (b² - 4ac). This is called the discriminant.\\n* Calculate the rest of the expression, simplifying as needed.\\n\\n**4. Find the Solutions:**\\n\\n* The quadratic formula will give you two solutions, one with a plus sign (+) and one with a minus sign (-) before the square root. These solutions are the roots of the quadratic equation.\\n\\n**Example:**\\n\\nLet'\''s say you have the quadratic equation 2x² + 5x - 3 = 0.\\n\\n* a = 2, b = 5, c = -3\\n\\nSubstituting into the quadratic formula:\\n\\nx = (-5 ± √(5² - 4 * 2 * -3)) / (2 * 2)\\nx = (-5 ± √(49)) / 4\\nx = (-5 ± 7) / 4\\n\\nTherefore, the solutions are:\\n\\n* x1 = (-5 + 7) / 4 = 1/2\\n* x2 = (-5 - 7) / 4 = -3 \\n\\n**Important Note:**\\n\\nThe quadratic formula can be used to solve any quadratic equation, even if the discriminant (b² - 4ac) is negative. If the discriminant is negative, the solutions will be complex numbers.\\n"
95 | }
96 | ]
97 | },
98 | {
99 | "role": "user",
100 | "parts": [
101 | {
102 | "text": "INSERT_INPUT_HERE"
103 | }
104 | ]
105 | }
106 | ],
107 | "generationConfig": {
108 | "temperature": 1,
109 | "topK": 64,
110 | "topP": 0.95,
111 | "maxOutputTokens": 8192,
112 | "responseMimeType": "text/plain"
113 | },
114 | "safetySettings": [
115 | {
116 | "category": "HARM_CATEGORY_HARASSMENT",
117 | "threshold": "BLOCK_MEDIUM_AND_ABOVE"
118 | },
119 | {
120 | "category": "HARM_CATEGORY_HATE_SPEECH",
121 | "threshold": "BLOCK_MEDIUM_AND_ABOVE"
122 | },
123 | {
124 | "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
125 | "threshold": "BLOCK_MEDIUM_AND_ABOVE"
126 | },
127 | {
128 | "category": "HARM_CATEGORY_DANGEROUS_CONTENT",
129 | "threshold": "BLOCK_MEDIUM_AND_ABOVE"
130 | }
131 | ]
132 | }
133 | );
134 |
135 | final response = await http.post(Uri.parse('https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent?key=${apiKey}'),
136 | headers: {"Content-Type": "application/json"} ,
137 | body: requestBody
138 | );
139 |
140 | if(response.statusCode == 200){
141 | print(response.body);
142 | }else {
143 | print('failed');
144 | }
145 | }
146 | @override
147 | Widget build(BuildContext context) {
148 | return Scaffold(
149 | floatingActionButton: FloatingActionButton(
150 | onPressed: (){
151 | imagePickerFromGallery();
152 | },
153 | ),
154 | body: SafeArea(
155 | child: Column(
156 | children: [
157 | if(image != null )
158 | SizedBox(
159 | child: Image.file(
160 | File(newImage !.path),
161 | fit: BoxFit.fitHeight,
162 | ),
163 | ),
164 |
165 | ],
166 | ),
167 | ),
168 | );
169 | }
170 | }
171 |
172 |
173 |
--------------------------------------------------------------------------------
/lib/permissions/location_permission.dart:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | import 'package:flutter/foundation.dart';
5 | import 'package:flutter/material.dart';
6 | import 'package:geolocator/geolocator.dart';
7 |
8 | class LocationPermissionWidget extends StatefulWidget {
9 | const LocationPermissionWidget({Key? key}) : super(key: key);
10 |
11 | @override
12 | State createState() => _LocationPermissionWidgetState();
13 | }
14 |
15 | class _LocationPermissionWidgetState extends State {
16 |
17 |
18 | /* iPhone Permissions
19 | * Permission you need to add inorder to get run timer permission
20 | * This is the message that will show in the app for ios
21 | * Add this into you info.plist file file
22 | * */
23 | // NSLocationAlwaysAndWhenInUsageDescription
24 | // App app want's to access your location to get address
25 | // NSLocationAlwaysAndWhenInUseUsageDescription
26 | // App app want's to access your location to get address.
27 | // NSLocationAlwaysUsageDescription
28 | // App app want's to access your location to get address.
29 | // NSLocationWhenInUseUsageDescription
30 | // App want's to access your location to get address.
31 |
32 | /* Android Permissions
33 | * Permission you need to add inorder to get run timer permission
34 | * Add this into your android main manifest file
35 | * */
36 | //
37 | //
38 |
39 | // function to check if user has granted location permissions are
40 | Future requestLocationPermission() async {
41 | bool serviceEnabled;
42 | LocationPermission permission;
43 |
44 | // Test if location services are enabled.
45 | serviceEnabled = await Geolocator.isLocationServiceEnabled();
46 | if (!serviceEnabled) {
47 | return Future.error('Location services are disabled.');
48 | }
49 |
50 | permission = await Geolocator.checkPermission();
51 | if (permission == LocationPermission.denied) {
52 | permission = await Geolocator.requestPermission();
53 | if (permission == LocationPermission.denied) {
54 | return false;
55 | }
56 | }
57 |
58 | if (permission == LocationPermission.deniedForever) {
59 | return false ;
60 | }
61 |
62 | return true ;
63 | }
64 |
65 | @override
66 | Widget build(BuildContext context) {
67 | return Scaffold(
68 | appBar: AppBar(
69 | title: const Text('Request Location Permissions'),
70 | ),
71 | body: Center(
72 | child: Padding(
73 | padding: const EdgeInsets.symmetric(horizontal: 40),
74 | child: InkWell(
75 | onTap: (){
76 | requestLocationPermission().then((value){
77 | if(value){
78 | if (kDebugMode) {
79 | print('permission granted');
80 | }
81 | }else {
82 | Geolocator.openAppSettings();
83 | }
84 | });
85 | },
86 | child: Container(
87 | height: 50,
88 | color: Colors.green,
89 | width: double.infinity,
90 | child: const Center(child: Text('Request Permission')),
91 | ),
92 | ),
93 | ),
94 | ),
95 | );
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/lib/permissions/permission_screen.dart:
--------------------------------------------------------------------------------
1 | import 'package:asif/permissions/permission_services.dart';
2 | import 'package:flutter/material.dart';
3 | import 'package:permission_handler/permission_handler.dart';
4 |
5 |
6 |
7 | class PermissionScreen extends StatelessWidget {
8 | const PermissionScreen({Key? key}) : super(key: key);
9 |
10 | @override
11 | Widget build(BuildContext context) {
12 | return Scaffold(
13 | body: SafeArea(
14 | child: Center(
15 | child: Column(
16 | children: [
17 | ElevatedButton(onPressed: (){
18 | final permisison = CameraPermission();
19 |
20 | permisison.requestPermission().then((value){
21 | if(value.isPermanentlyDenied){
22 | // permisison.openAppSettingsForTheCameraPermission();
23 | }
24 | });
25 |
26 | }, child: Text('Camera Permissin'))
27 | ],
28 | ),
29 | ),
30 | ),
31 | );
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/lib/permissions/permission_services.dart:
--------------------------------------------------------------------------------
1 |
2 |
3 | import 'package:permission_handler/permission_handler.dart';
4 |
5 | abstract class CameraServices {
6 |
7 | Stream get cameraStateChanges;
8 |
9 | Future requestPermission();
10 |
11 | Future openAppSettingsForTheCameraPermission();
12 | }
13 |
14 |
15 | class CameraPermission implements CameraServices {
16 |
17 | @override
18 | Stream get cameraStateChanges {
19 | const camera = Permission.camera;
20 |
21 | return camera.status.asStream().map(
22 | (permissionStatus) {
23 | if (permissionStatus.isGranted) {
24 | return PermissionStatus.granted;
25 | } else if (permissionStatus.isLimited) {
26 | return PermissionStatus.limited;
27 | } else if (permissionStatus.isDenied) {
28 | return PermissionStatus.denied;
29 | } else if (permissionStatus.isRestricted) {
30 | return PermissionStatus.restricted;
31 | } else {
32 | return PermissionStatus.permanentlyDenied;
33 | }
34 | },
35 | );
36 | }
37 |
38 | @override
39 | Future requestPermission() async {
40 | const camera = Permission.camera;
41 |
42 | final permissionStatus = await camera.request();
43 |
44 | return permissionStatus;
45 | }
46 |
47 | @override
48 | Future openAppSettingsForTheCameraPermission() async {
49 | await openAppSettings();
50 | }
51 | }
--------------------------------------------------------------------------------
/lib/provider/app_language/app_language.dart:
--------------------------------------------------------------------------------
1 |
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:shared_preferences/shared_preferences.dart';
5 |
6 | class AppLanguage extends ChangeNotifier {
7 |
8 | Locale? _appLocale ;
9 | Locale? get appLocal => _appLocale ;
10 |
11 |
12 | fetchLocale() async {
13 | var prefs = await SharedPreferences.getInstance();
14 | if (prefs.getString('language_code') == null) {
15 | _appLocale = const Locale('en');
16 | return null;
17 | }
18 | String local = prefs.getString('language_code') ?? 'en';
19 | _appLocale = Locale(local.toString());
20 | return null;
21 | }
22 |
23 | void changeLanguage(Locale type) async {
24 | var prefs = await SharedPreferences.getInstance();
25 | if (_appLocale == type) {
26 | return;
27 | }
28 | if (type ==const Locale("es")) {
29 | print(type);
30 | _appLocale =const Locale("es");
31 | await prefs.setString('language_code', 'es');
32 | await prefs.setString('countryCode', 'es');
33 | } else {
34 | print(type);
35 | _appLocale = const Locale("en");
36 | await prefs.setString('language_code', 'en');
37 | await prefs.setString('countryCode', 'en');
38 | }
39 | notifyListeners();
40 | }
41 | }
--------------------------------------------------------------------------------
/lib/provider/provider_screen.dart:
--------------------------------------------------------------------------------
1 |
2 | import 'package:flutter/material.dart';
3 | import 'package:provider/provider.dart';
4 |
5 |
6 | class ProviderScreen extends StatefulWidget {
7 | const ProviderScreen({Key? key}) : super(key: key);
8 |
9 | @override
10 | State createState() => _ProviderScreenState();
11 | }
12 |
13 | class _ProviderScreenState extends State {
14 | @override
15 | Widget build(BuildContext context) {
16 | return Scaffold(
17 | body: ChangeNotifierProvider(
18 | create: (_) => ProviderVM(),
19 | child: SafeArea(
20 | child: Consumer(
21 | builder: (context, value, child){
22 | return TextButton(onPressed: (){
23 | context.read().setValue();
24 | // Navigator.push(context, MaterialPageRoute(builder: (context) => NewScreen()));
25 | }, child: Center(child: Text(context.watch().value.toString())));
26 | },
27 | ),
28 | ),
29 | ),
30 | );
31 | }
32 | }
33 |
34 |
35 | class NewScreen extends StatelessWidget {
36 | const NewScreen({Key? key}) : super(key: key);
37 |
38 | @override
39 | Widget build(BuildContext context) {
40 | return Scaffold(
41 | body: Consumer(
42 | builder: (context, value, child){
43 | return TextButton(onPressed: (){
44 | value.setValue();
45 | }, child: Center(child: Text(value.value.toString())));
46 | },
47 | ),
48 | );
49 | }
50 | }
51 |
52 |
53 |
54 | class ProviderVM with ChangeNotifier {
55 |
56 | int _value = 20 ;
57 | int get value => _value ;
58 |
59 | setValue(){
60 | _value++ ;
61 | notifyListeners();
62 | }
63 | }
--------------------------------------------------------------------------------
/lib/rating_screen.dart:
--------------------------------------------------------------------------------
1 |
2 |
3 | import 'package:flutter/foundation.dart';
4 | import 'package:flutter/material.dart';
5 |
6 | class RatingScreen extends StatefulWidget {
7 | const RatingScreen({super.key});
8 |
9 | @override
10 | State createState() => _RatingScreenState();
11 | }
12 |
13 | class _RatingScreenState extends State {
14 |
15 | List ratingList= [1, 2, 3,4,5] ;
16 | int tempSelectedRating = -1 ;
17 |
18 | @override
19 | Widget build(BuildContext context) {
20 | return MaterialApp(
21 | home: Scaffold(
22 | appBar: AppBar(),
23 | body: Center(
24 | child: SizedBox(
25 | height: 100,
26 | child: ListView.builder(
27 | scrollDirection: Axis.horizontal,
28 | itemCount: ratingList.length ,
29 | itemBuilder: (context, index){
30 | return IconButton(
31 | onPressed: (){
32 |
33 | tempSelectedRating = index ;
34 |
35 | if (kDebugMode) {
36 | print(tempSelectedRating);
37 | }
38 | setState(() {});
39 |
40 | },
41 | icon: Icon( tempSelectedRating == -1 ? Icons.star_border_outlined : index <= tempSelectedRating ? Icons.star : Icons.star_border_outlined )
42 |
43 | );
44 | }),
45 | ),
46 | ),
47 | ),
48 | );
49 | }
50 |
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/lib/screen/pagination_screen/model/post_model.dart:
--------------------------------------------------------------------------------
1 | class PostModel {
2 | final int id;
3 | final String title;
4 | final String body;
5 |
6 | PostModel({required this.id, required this.title, required this.body});
7 |
8 | factory PostModel.fromJson(Map json) {
9 | return PostModel(
10 | id: json['id'],
11 | title: json['title'],
12 | body: json['body'],
13 | );
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/lib/screen/pagination_screen/pagination_controller/pagination_controller.dart:
--------------------------------------------------------------------------------
1 | import 'package:asif/screen/pagination_screen/model/post_model.dart';
2 | import 'package:asif/screen/pagination_screen/repository/post_repository.dart';
3 | import 'package:flutter/material.dart';
4 |
5 | class PostProvider with ChangeNotifier {
6 | final _postService = PostRepository();
7 |
8 | List _posts = [];
9 |
10 | bool _isLoading = false;
11 | bool _hasMore = true;
12 | int _page = 1;
13 | final int _limit = 20; // Adjust the limit as needed
14 |
15 | List get posts => _posts;
16 | bool get isLoading => _isLoading;
17 | bool get hasMore => _hasMore;
18 |
19 | Future fetchPosts() async {
20 | if (_isLoading || !_hasMore) return;
21 |
22 | _isLoading = true;
23 | notifyListeners();
24 |
25 | try {
26 | List newPosts = await _postService.fetchPosts(_page, _limit);
27 | if (newPosts.isEmpty) {
28 | _hasMore = false; // No more posts to load
29 | } else {
30 | _posts.addAll(newPosts);
31 | _page++; // Increment the page for the next fetch
32 | }
33 | } catch (e) {
34 | print("Error fetching posts: $e");
35 | } finally {
36 | _isLoading = false;
37 | notifyListeners();
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/lib/screen/pagination_screen/pagination_screen.dart:
--------------------------------------------------------------------------------
1 | import 'package:asif/screen/pagination_screen/pagination_controller/pagination_controller.dart';
2 | import 'package:asif/utils/session_controller.dart';
3 | import 'package:flutter/material.dart';
4 | import 'package:provider/provider.dart';
5 |
6 | class PaginationScreen extends StatefulWidget {
7 | const PaginationScreen({super.key});
8 |
9 | @override
10 | State createState() => _PaginationScreenState();
11 | }
12 |
13 | class _PaginationScreenState extends State {
14 | late PostProvider postProvider;
15 |
16 | @override
17 | void initState() {
18 | // TODO: implement initState
19 | super.initState();
20 | postProvider = PostProvider();
21 |
22 | }
23 |
24 | @override
25 | Widget build(BuildContext context) {
26 | final auth = SessionController.instance;
27 |
28 | return Scaffold(
29 | backgroundColor: Colors.black,
30 | appBar: AppBar(title: Text('Posts with Pagination')),
31 | body: ChangeNotifierProvider(
32 | create: (_) => postProvider..fetchPosts(),
33 | child: Consumer(
34 | builder: (context, postProvider, child) {
35 | return NotificationListener(
36 | onNotification: (ScrollNotification scrollInfo) {
37 | if (scrollInfo.metrics.pixels == scrollInfo.metrics.maxScrollExtent && !postProvider.isLoading) {
38 | postProvider.fetchPosts();
39 | }
40 | return false;
41 | },
42 | child: ListView.builder(
43 | itemCount: postProvider.posts.length + (postProvider.hasMore ? 1 : 0), // Show loading indicator if there are more posts
44 | itemBuilder: (context, index) {
45 | if (index == postProvider.posts.length) {
46 | return Center(child: CircularProgressIndicator());
47 | }
48 | final post = postProvider.posts[index];
49 | return Card(
50 | child: ListTile(
51 | title: Text(post.title),
52 | subtitle: Text(post.body),
53 | ),
54 | );
55 | },
56 | ),
57 | );
58 | },
59 | ),
60 | ),
61 | );
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/lib/screen/pagination_screen/repository/post_repository.dart:
--------------------------------------------------------------------------------
1 | import 'package:asif/screen/pagination_screen/model/post_model.dart';
2 | import "package:http/http.dart" as http;
3 | import 'dart:convert';
4 |
5 | class PostRepository {
6 | static const String _baseUrl = 'https://jsonplaceholder.typicode.com/posts';
7 |
8 | Future> fetchPosts(int page, int limit) async {
9 | final response = await http.get(Uri.parse('$_baseUrl?_page=$page&_limit=$limit'));
10 |
11 | if (response.statusCode == 200) {
12 | List jsonResponse = jsonDecode(response.body);
13 | return jsonResponse.map((data) => PostModel.fromJson(data)).toList();
14 | } else {
15 | throw Exception('Failed to load posts');
16 | }
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/lib/screen/search_places_api/google_map_search_places_api.dart:
--------------------------------------------------------------------------------
1 | import 'dart:convert';
2 | import 'dart:math';
3 | import 'package:flutter/foundation.dart';
4 | import 'package:flutter/material.dart';
5 | import 'package:http/http.dart' as http;
6 |
7 |
8 | class GoogleMapSearchPlacesApi extends StatefulWidget {
9 | const GoogleMapSearchPlacesApi({super.key});
10 |
11 | @override
12 | State createState() => _GoogleMapSearchPlacesApiState();
13 | }
14 |
15 | class _GoogleMapSearchPlacesApiState extends State {
16 |
17 | final _controller = TextEditingController();
18 |
19 | String _sessionToken = '1234567890';
20 | List _placeList = [];
21 |
22 | @override
23 | void initState() {
24 | super.initState();
25 | _controller.addListener(() {
26 | _onChanged();
27 | });
28 | }
29 |
30 | _onChanged() {
31 | if (_sessionToken == null) {
32 | setState(() {
33 | _sessionToken = (Random(12222322).toString());
34 | });
35 | }
36 | getSuggestion(_controller.text);
37 | }
38 |
39 | void getSuggestion(String input) async {
40 |
41 |
42 | // you can get this free api key from this platform
43 | // http://gomaps.pro
44 | const String PLACES_API_KEY = "AlzaSylWA7uT25ETubtvijIXRMiDXjrYG6fmcFR";
45 |
46 | try{
47 | String baseURL = 'https://maps.gomaps.pro/maps/api/place/autocomplete/json';
48 | String request = '$baseURL?input=$input&key=$PLACES_API_KEY&sessiontoken=$_sessionToken';
49 | var response = await http.get(Uri.parse(request));
50 | var data = json.decode(response.body);
51 | if (kDebugMode) {
52 | print('mydata');
53 | print(data);
54 | }
55 | if (response.statusCode == 200) {
56 | setState(() {
57 | _placeList = json.decode(response.body)['predictions'];
58 | });
59 | } else {
60 | throw Exception('Failed to load predictions');
61 | }
62 | }catch(e){
63 | print(e);
64 | }
65 |
66 | }
67 |
68 | @override
69 | Widget build(BuildContext context) {
70 | return Scaffold(
71 | appBar: AppBar(
72 | elevation: 0,
73 | title: const Text('Search places Api' ,),
74 | ),
75 | body: Column(
76 | mainAxisAlignment: MainAxisAlignment.start,
77 | children: [
78 | Align(
79 | alignment: Alignment.topCenter,
80 | child: TextField(
81 | controller: _controller,
82 | decoration: InputDecoration(
83 | hintText: "Search your location here",
84 | focusColor: Colors.white,
85 | floatingLabelBehavior: FloatingLabelBehavior.never,
86 | prefixIcon: const Icon(Icons.map),
87 | suffixIcon: IconButton(
88 | icon: const Icon(Icons.cancel), onPressed: () {
89 | _controller.clear() ;
90 | },
91 | ),
92 | ),
93 | ),
94 | ),
95 | Expanded(
96 | child: ListView.builder(
97 | physics: NeverScrollableScrollPhysics(),
98 | shrinkWrap: true,
99 | itemCount: _placeList.length,
100 | itemBuilder: (context, index) {
101 | return GestureDetector(
102 | onTap: () async {
103 |
104 | },
105 | child: ListTile(
106 | title: Text(_placeList[index]["description"]),
107 | ),
108 | );
109 | },
110 | ),
111 | )
112 | ],
113 | ),
114 | );
115 | }
116 | }
117 |
118 |
119 |
--------------------------------------------------------------------------------
/lib/shared_preferenace_widget.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:shared_preferences/shared_preferences.dart';
3 |
4 |
5 | class SharedPreferenceWidget extends StatefulWidget {
6 | const SharedPreferenceWidget({Key? key}) : super(key: key);
7 |
8 | @override
9 | State createState() => _SharedPreferenceWidgetState();
10 | }
11 |
12 | class _SharedPreferenceWidgetState extends State {
13 |
14 | String name = '' ;
15 | late int age ;
16 |
17 | @override
18 | void initState() {
19 | // TODO: implement initState
20 | super.initState();
21 |
22 | isLogin();
23 | }
24 |
25 | void isLogin()async{
26 | SharedPreferences sp = await SharedPreferences.getInstance() ;
27 | name = sp.getString('string') ?? '';
28 | age = sp.getInt('age') ?? 0;
29 | setState(() {
30 |
31 | });
32 | }
33 |
34 |
35 | @override
36 | Widget build(BuildContext context) {
37 | return Scaffold(
38 | appBar: AppBar(
39 | title: Text('Shared Preferance'),
40 | ),
41 | body: Column(
42 | children: [
43 | Text(name.toString()),
44 | Text(age.toString()),
45 | FutureBuilder(
46 | future: SharedPreferences.getInstance(),
47 | builder: (context ,AsyncSnapshot snapshot){
48 | return Text(snapshot.data!.getString('string').toString());
49 | }
50 | )
51 | ],
52 | ),
53 | floatingActionButton: FloatingActionButton(
54 | onPressed: ()async{
55 |
56 | SharedPreferences sp = await SharedPreferences.getInstance() ;
57 |
58 | sp.setInt('age', 25);
59 | sp.setDouble('lucky_number', 20.2);
60 | sp.setString('string', 'Asif Taj');
61 | sp.setBool('isLogin', false);
62 |
63 | setState(() {
64 |
65 | });
66 |
67 | },
68 | child: Icon(Icons.add),
69 | ),
70 | );
71 | }
72 | }
73 |
74 |
--------------------------------------------------------------------------------
/lib/utils/date_utils.dart:
--------------------------------------------------------------------------------
1 |
2 |
3 | import 'package:intl/intl.dart';
4 |
5 | class DateUtils {
6 |
7 | String changeMDYToYMD(String inputDate){
8 |
9 | try{
10 |
11 | DateFormat originalFormat = DateFormat("MM/dd/yyyy");
12 | DateTime dateTime = originalFormat.parse(inputDate);
13 |
14 | // Format the date to 'yyyy-MM-dd'
15 | DateFormat desiredFormat = DateFormat("yyyy-MM-dd");
16 | String formattedDate = desiredFormat.format(dateTime);
17 | return formattedDate;
18 |
19 | }catch(e){
20 |
21 | return '' ;
22 | }
23 |
24 | }
25 |
26 | }
--------------------------------------------------------------------------------
/lib/utils/session_controller.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_secure_storage/flutter_secure_storage.dart';
2 | import 'package:shared_preferences/shared_preferences.dart';
3 |
4 | class SessionController {
5 |
6 | SessionController._internal();
7 | static final SessionController _instance = SessionController._internal();
8 | static SessionController get instance => _instance;
9 |
10 | String? userId;
11 | String? token;
12 | DateTime? expiryDate;
13 |
14 | bool get isSessionActive {
15 | if (token == null || expiryDate == null) return false;
16 | return DateTime.now().isBefore(expiryDate!);
17 | }
18 |
19 | void setSession(String userId, String token, DateTime expiryDate) async {
20 | this.userId = userId;
21 | this.token = token;
22 | this.expiryDate = expiryDate;
23 |
24 | final storage = const FlutterSecureStorage();
25 | await storage.write( key: 'userId', value: userId);
26 | await storage.write(key:'token', value:token);
27 | await storage.write(key: 'expiryDate',value: expiryDate.toIso8601String());
28 | }
29 |
30 | Future loadSession() async {
31 | final storage = const FlutterSecureStorage();
32 | final response = await Future.wait([
33 | storage.read(key: 'userId'),
34 | storage.read(key: 'token'),
35 | storage.read(key: 'expiryDate')
36 | ]);
37 | userId = response[0];
38 | token = response[1];
39 | String? expiryDateString = response[2];
40 | if (expiryDateString != null) {
41 | expiryDate = DateTime.parse(expiryDateString);
42 | }
43 | }
44 |
45 | void clearSession() async {
46 | userId = null;
47 | token = null;
48 | expiryDate = null;
49 |
50 | final storage = const FlutterSecureStorage();
51 | await Future.wait([
52 | storage.delete(key: 'userId'),
53 | storage.delete(key: 'token'),
54 | storage.delete(key: 'expiryDate')
55 | ]);
56 | }
57 | }
58 |
59 |
--------------------------------------------------------------------------------
/lib/utils/validation_utils.dart:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | class ValidationUtils {
5 |
6 | static bool emailValidator(String email) {
7 | bool emailValid = RegExp(r'^.+@[a-zA-Z]+\.{1}[a-zA-Z]+(\.{0,1}[a-zA-Z]+)$')
8 | .hasMatch(email);
9 | return emailValid;
10 | }
11 |
12 | }
--------------------------------------------------------------------------------
/lib/widgets/animated_container_widget.dart:
--------------------------------------------------------------------------------
1 | import 'dart:math';
2 |
3 | import 'package:flutter/material.dart';
4 |
5 |
6 | class AnimatedContainerWidget extends StatefulWidget {
7 | const AnimatedContainerWidget({Key? key}) : super(key: key);
8 |
9 | @override
10 | State createState() => _AnimatedContainerWidgetState();
11 | }
12 |
13 | class _AnimatedContainerWidgetState extends State {
14 |
15 | double height = 100 ;
16 | double width = 100 ;
17 | Color color = Colors.green ;
18 | BorderRadiusGeometry radiusGeometry = BorderRadius.circular(8);
19 |
20 |
21 | @override
22 | Widget build(BuildContext context) {
23 | return Scaffold(
24 | appBar: AppBar(
25 | title: Text('Animated cotnainer'),
26 | ),
27 | body: Center(
28 | child: AnimatedContainer(
29 | height: height,
30 | width: width,
31 | decoration: BoxDecoration(
32 | color: color ,
33 | borderRadius: radiusGeometry
34 | ),
35 | duration: Duration(milliseconds: 500),
36 | curve: Curves.fastOutSlowIn,
37 | ),
38 | ),
39 | floatingActionButton: FloatingActionButton(
40 | onPressed: (){
41 | final random =Random();
42 | height = random.nextInt(300).toDouble() ;
43 | width = random.nextInt(300).toDouble() ;
44 |
45 | color = Color.fromRGBO(
46 | random.nextInt(256),
47 | random.nextInt(256),
48 | random.nextInt(256),
49 | 1
50 | ) ;
51 |
52 | radiusGeometry = BorderRadius.circular(random.nextInt(100).toDouble());
53 | setState(() {
54 |
55 | });
56 | },
57 | child: Icon(Icons.refresh),
58 | ),
59 | );
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/lib/widgets/animated_list_view_builder_widget.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class AnimatedListViewBuilderWidget extends StatefulWidget {
4 | const AnimatedListViewBuilderWidget({super.key});
5 |
6 | @override
7 | State createState() => _AnimatedListViewBuilderWidgetState();
8 | }
9 |
10 | class _AnimatedListViewBuilderWidgetState extends State {
11 |
12 |
13 | /// Will used to access the Animated list
14 | final GlobalKey listKey = GlobalKey();
15 |
16 | /// This holds the items
17 | List _items = [];
18 |
19 | /// This holds the item count
20 | int counter = 0;
21 |
22 | Widget build(BuildContext context) {
23 | return Scaffold(
24 | appBar: AppBar(
25 | actions: [
26 | IconButton(onPressed: (){
27 | listKey.currentState!.removeItem(0, (_, animation) => sizeIt(context, 0, animation),
28 | duration: const Duration(milliseconds: 500));
29 | _items.removeAt(0);
30 | }, icon: const Icon(Icons.remove_circle_outline))
31 | ],
32 | ),
33 | floatingActionButton: FloatingActionButton(
34 | onPressed: (){
35 | listKey.currentState!.insertItem(0, duration: const Duration(milliseconds: 500));
36 | _items = []..add(counter++)
37 | ..addAll(_items);
38 | },
39 | ),
40 | body: SafeArea(
41 | child: AnimatedList(
42 | key: listKey,
43 | initialItemCount: _items.length,
44 | itemBuilder: (context, index, animation){
45 | return InkWell(
46 | onTap: (){
47 | listKey.currentState!.removeItem(0, (_, animation) => sizeIt(context, 0, animation),
48 | duration: const Duration(milliseconds: 500));
49 | _items.removeAt(index);
50 | },
51 | child: slideIt(context, index, animation));
52 | },
53 | ),
54 | ),
55 | );
56 | }
57 |
58 |
59 | // slide transition animation
60 | Widget slideIt(BuildContext context, int index, animation) {
61 | int item = _items[index];
62 | return SlideTransition(
63 | position: Tween(
64 | begin: const Offset(-1, 0),
65 | end: Offset(0, 0),
66 | ).animate(animation),
67 | child: SizedBox( // Actual widget to display
68 | height: 128.0,
69 | child: Card(
70 | color: Colors.primaries[item % Colors.primaries.length],
71 | child: Center(
72 | child: Text('Item $item', style: Theme.of(context).textTheme.bodyMedium),
73 | ),
74 | ),
75 | ),
76 | );
77 | }
78 |
79 |
80 | Widget sizeIt(BuildContext context, int index, animation) {
81 | int item = _items[index];
82 | return SizeTransition(
83 | axis: Axis.vertical,
84 | sizeFactor: animation,
85 | child: SizedBox(
86 | height: 100.0,
87 | child: Card(
88 | color: Colors.primaries[item % Colors.primaries.length],
89 | child: Center(
90 | child: Text('Item $item', style: Theme.of(context).textTheme.bodyMedium),
91 | ),
92 | ),
93 | ),
94 | );
95 | }
96 | }
--------------------------------------------------------------------------------
/lib/widgets/change_lanugage_widget.dart:
--------------------------------------------------------------------------------
1 |
2 | import 'package:asif/provider/app_language/app_language.dart';
3 | import 'package:flutter/material.dart';
4 | import 'package:flutter_gen/gen_l10n/app_localizations.dart' ;
5 | import 'package:provider/provider.dart';
6 |
7 |
8 | enum SampleItem { itemOne, itemTwo }
9 | class ChangeLanguageWidget extends StatefulWidget {
10 | const ChangeLanguageWidget({Key? key}) : super(key: key);
11 |
12 | @override
13 | State createState() => _ChangeLanguageWidgetState();
14 | }
15 |
16 | class _ChangeLanguageWidgetState extends State {
17 |
18 | SampleItem? selectedMenu;
19 | @override
20 | Widget build(BuildContext context) {
21 | return Scaffold(
22 | appBar: AppBar(
23 | title: Text(AppLocalizations.of(context)!.helloWorld.toString()),
24 | actions: [
25 | Consumer(
26 | builder: (context, provider, child){
27 | return PopupMenuButton(
28 | initialValue: selectedMenu,
29 | // Callback that sets the selected popup menu item.
30 | onSelected: (SampleItem item) {
31 |
32 | if(SampleItem.itemOne.name == item.name){
33 | provider.changeLanguage(const Locale('es'));
34 | }else {
35 | provider.changeLanguage(const Locale('en'));
36 | }
37 | // provider.changeLanguage(const Locale('en'));
38 |
39 | },
40 | itemBuilder: (BuildContext context) => >[
41 | const PopupMenuItem(
42 | value: SampleItem.itemOne,
43 | child: Text('Spanish'),
44 | ),
45 | const PopupMenuItem(
46 | value: SampleItem.itemTwo,
47 | child: Text('English'),
48 | ),
49 |
50 | ],
51 | );
52 | }
53 | ),
54 |
55 |
56 | ],
57 | ),
58 | body: Padding(
59 | padding: const EdgeInsets.symmetric(horizontal: 20),
60 | child: Column(
61 | crossAxisAlignment: CrossAxisAlignment.center,
62 | mainAxisAlignment: MainAxisAlignment.start,
63 | children: [
64 | SizedBox(height: 100,),
65 | Text(AppLocalizations.of(context)!.login.toString()),
66 | SizedBox(height: 30,),
67 | TextFormField(
68 | decoration: InputDecoration(
69 | hintText: AppLocalizations.of(context)!.email.toString() ,
70 | enabledBorder: OutlineInputBorder()
71 | ),
72 | ),
73 | const SizedBox(height: 20,),
74 | TextFormField(
75 | decoration: InputDecoration(
76 | hintText: AppLocalizations.of(context)!.password.toString() ,
77 | enabledBorder: OutlineInputBorder()
78 | ),
79 | ),
80 | const SizedBox(height: 50,),
81 | Container(
82 | height: 40,
83 | width: double.infinity,
84 | decoration: BoxDecoration(
85 | borderRadius: BorderRadius.circular(10),
86 | color: Colors.green
87 | ),
88 |
89 | child: Center(child: Text(AppLocalizations.of(context)!.login.toString())),
90 | )
91 | ],
92 | ),
93 | ),
94 | );
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/lib/widgets/country_code_picker.dart:
--------------------------------------------------------------------------------
1 | import 'package:country_picker/country_picker.dart';
2 | import 'package:flutter/material.dart';
3 |
4 |
5 | class CountryCodePickerWidget extends StatefulWidget {
6 | const CountryCodePickerWidget({Key? key}) : super(key: key);
7 |
8 | @override
9 | State createState() => _CountryCodePickerWidgetState();
10 | }
11 |
12 | class _CountryCodePickerWidgetState extends State {
13 | String countryCode = '' ;
14 | @override
15 | Widget build(BuildContext context) {
16 | return Scaffold(
17 | appBar: AppBar(
18 | title: const Text('Country code picker'),
19 | ),
20 | body: Column(
21 | mainAxisAlignment: MainAxisAlignment.center,
22 | crossAxisAlignment: CrossAxisAlignment.center,
23 | children: [
24 | Text(countryCode.toString()),
25 | Center(
26 | child: TextButton(onPressed: (){
27 | showCountryPicker(
28 | context: context,
29 | showPhoneCode: true,
30 | countryListTheme: CountryListThemeData(
31 | borderRadius: BorderRadius.only(
32 | topLeft: Radius.circular(10)
33 | ),
34 | inputDecoration: InputDecoration(
35 | hintText: 'Start typing to sear' ,
36 | labelText: 'Search ' ,
37 | )
38 | ),
39 | favorite: ['PK'],
40 | onSelect: (Country value){
41 | print(value.countryCode.toString());
42 | print(value.phoneCode.toString());
43 |
44 | countryCode = value.phoneCode.toString();
45 | setState(() {
46 |
47 | });
48 | }
49 | );
50 | }, child: Text('Tap')),
51 | )
52 | ],
53 | ),
54 | );
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/lib/widgets/custom_button.dart:
--------------------------------------------------------------------------------
1 |
2 |
3 | import 'package:flutter/material.dart';
4 |
5 | class CustomButtonScreen extends StatefulWidget {
6 | const CustomButtonScreen({super.key});
7 |
8 | @override
9 | State createState() => _CustomButtonScreenState();
10 | }
11 |
12 | class _CustomButtonScreenState extends State {
13 | @override
14 | Widget build(BuildContext context) {
15 | return Scaffold(
16 | body: SafeArea(
17 | child: Column(
18 | children: [
19 | CustomButton(label: 'Login', onPressed: (){}),
20 | SizedBox(height: 20,),
21 | GradientButton(label: 'Regi', onPressed: () { }, gradientColors: [Colors.red , Colors.pink],)
22 | ],
23 | ),
24 | ),
25 | );
26 | }
27 | }
28 |
29 |
30 | class CustomButton extends StatelessWidget {
31 | final String label;
32 | final VoidCallback onPressed;
33 |
34 | const CustomButton({
35 | Key? key,
36 | required this.label,
37 | required this.onPressed,
38 | }) : super(key: key);
39 |
40 | @override
41 | Widget build(BuildContext context) {
42 | return ElevatedButton(
43 | onPressed: onPressed,
44 | child: Text(label),
45 | );
46 | }
47 | }
48 |
49 |
50 | class GradientButton extends CustomButton {
51 | final List gradientColors;
52 |
53 | const GradientButton({
54 | Key? key,
55 | required String label,
56 | required VoidCallback onPressed,
57 | required this.gradientColors,
58 | }) : super(
59 | key: key,
60 | label: label,
61 | onPressed: onPressed,
62 | );
63 |
64 | @override
65 | Widget build(BuildContext context) {
66 | return Container(
67 | decoration: BoxDecoration(
68 | gradient: LinearGradient(
69 | colors: gradientColors,
70 | ),
71 | borderRadius: BorderRadius.circular(8.0),
72 | ),
73 | child: ElevatedButton(
74 | onPressed: onPressed,
75 | style: ElevatedButton.styleFrom(
76 | shadowColor: Colors.transparent,
77 |
78 | ),
79 | child: Text(label),
80 | ),
81 | );
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/lib/widgets/custom_drop_down_widget.dart:
--------------------------------------------------------------------------------
1 |
2 |
3 | import 'package:flutter/material.dart';
4 |
5 | class CustomDropDownWidget extends StatefulWidget {
6 | const CustomDropDownWidget({Key? key}) : super(key: key);
7 |
8 | @override
9 | State createState() => _CustomDropDownWidgetState();
10 | }
11 |
12 | class _CustomDropDownWidgetState extends State {
13 |
14 | bool isExpanded = false ;
15 | String selectedValue = 'Select option' ;
16 |
17 | //list that will be expanded
18 | List politicsList = ['Left Wing', 'Liberal', 'Moderate', 'Conservative', 'Libertarian', 'Apolitical'] ;
19 |
20 |
21 | @override
22 | Widget build(BuildContext context) {
23 | return Scaffold(
24 | appBar: AppBar(
25 | title: Text('Drop Down'),
26 | ),
27 | body: SingleChildScrollView(
28 | child: Padding(
29 | padding: const EdgeInsets.symmetric(horizontal: 20),
30 | child: Column(
31 |
32 | children: [
33 | SizedBox(height: 150,),
34 | Container(
35 | width: double.infinity,
36 | height: 60,
37 | decoration: BoxDecoration(
38 | color: Colors.grey.shade300,
39 | borderRadius: BorderRadius.only(
40 | topLeft: const Radius.circular(5),
41 | topRight: const Radius.circular(5),
42 | bottomLeft: Radius.circular( isExpanded ? 0 : 5),
43 | bottomRight: Radius.circular(isExpanded ? 0 :5),
44 |
45 | ),
46 |
47 | ),
48 | child: Center(
49 | child: Padding(
50 | padding: const EdgeInsets.symmetric(horizontal: 15),
51 | child: InkWell(
52 | onTap: (){
53 | FocusScope.of(context).unfocus();
54 | isExpanded = !isExpanded;
55 | setState(() {
56 |
57 | });
58 | },
59 | child: Row(
60 | mainAxisAlignment: MainAxisAlignment.spaceBetween,
61 | children: [
62 | Expanded(child: Text(selectedValue, style: Theme.of(context).textTheme.bodyMedium!.copyWith(fontSize: 16))),
63 | Icon( isExpanded ? Icons.keyboard_arrow_up : Icons.keyboard_arrow_down ,
64 | color: isExpanded ? Colors.red : Colors.blue,
65 | )
66 | ],
67 | )),
68 | ),
69 | ),
70 | ),
71 | if(isExpanded)
72 | ListView(
73 | shrinkWrap: true,
74 | physics: NeverScrollableScrollPhysics(),
75 | children: politicsList.map((e) =>
76 | InkWell(
77 | onTap: (){
78 | isExpanded = false ;
79 | selectedValue = e ;
80 | setState(() {
81 |
82 | });
83 | },
84 | child: Container(
85 | height: 40,
86 | width: double.infinity,
87 | decoration: BoxDecoration(
88 | color: selectedValue == e ? Colors.pink: Colors.grey.shade300,
89 |
90 | ),
91 | child: Center(child: Text(e.toString() ,
92 | style:Theme.of(context).textTheme.headlineLarge!.copyWith(
93 | fontSize: 14,
94 | color: selectedValue == e ? Colors.black : Colors.blue
95 | ) ,))
96 | ),
97 | )
98 | ).toList(),
99 | )
100 | ],
101 | ),
102 | ),
103 | ),
104 | );
105 |
106 | }
107 |
108 | }
109 |
--------------------------------------------------------------------------------
/lib/widgets/custom_height_picker.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/cupertino.dart';
2 | import 'package:flutter/material.dart';
3 |
4 |
5 | class CustomerHeightPicker extends StatefulWidget {
6 | const CustomerHeightPicker({super.key});
7 |
8 | @override
9 | State createState() => _CustomerHeightPickerState();
10 | }
11 |
12 | class _CustomerHeightPickerState extends State {
13 |
14 | int _inches = 0;
15 | int _feet = 0;
16 |
17 | List _inchesList = [
18 | 1,
19 | 2,
20 | 3,
21 | 4,
22 | 5,6,7,8,9,10,11
23 | ];
24 |
25 | List _feetList = [
26 |
27 | 4,
28 | 5,6,7,8
29 | ];
30 |
31 |
32 | Future _showMyDialog() async {
33 |
34 | return showDialog(
35 | context: context,
36 | barrierDismissible: false, // user must tap button!
37 | builder: (BuildContext context) {
38 |
39 | return AlertDialog(
40 | title: const Text('Height Picker'),
41 | content: SingleChildScrollView(
42 | child: ListBody(
43 | children: [
44 | Container(
45 | width: 40,
46 | height: 40,
47 | decoration: BoxDecoration(
48 | color: Colors.transparent
49 | ),
50 | child: Row(
51 | children: [
52 | Expanded(
53 | child: Theme(
54 | data: ThemeData.light().copyWith(
55 | primaryColor: Colors.transparent ,
56 | cardColor: Colors.transparent,
57 | dividerColor: Colors.transparent ,
58 | //selectedRowColor: Colors.transparent
59 | ),
60 | child: CupertinoPicker(
61 | useMagnifier: true,
62 | itemExtent: 40,
63 | // if you wan to remove background over lay color uncomment this
64 | // selectionOverlay: CupertinoPickerDefaultSelectionOverlay(background: Colors.transparent,),
65 | scrollController: FixedExtentScrollController(initialItem: _inches),
66 | children: List.generate(_feetList.length, (int index) {
67 | return Center(
68 | child: Text(
69 | _feetList[index].toString(),
70 | ),
71 | );
72 | }),
73 | onSelectedItemChanged: (value) {
74 | setState(() {
75 | _feet = value;
76 | });
77 | },
78 | ),
79 | ),
80 | ),
81 | Expanded(
82 | child: CupertinoPicker(
83 | backgroundColor: Colors.white,
84 | itemExtent: 50,
85 | looping: true,
86 | scrollController: FixedExtentScrollController(initialItem: _inches),
87 | children: List.generate(_inchesList.length, (int index) {
88 | return Center(
89 | child: Text(
90 | _inchesList[index].toString(),
91 | ),
92 | );
93 | }),
94 | onSelectedItemChanged: (value) {
95 | setState(() {
96 | _inches = value;
97 | });
98 | },
99 | ),
100 | ),
101 |
102 | ],
103 | ),
104 | )
105 | ],
106 | ),
107 | ),
108 | actions: [
109 | TextButton(
110 | child: const Text('Ok'),
111 | onPressed: () {
112 | Navigator.of(context).pop();
113 | },
114 | ),
115 | ],
116 | );
117 |
118 |
119 | },
120 | );
121 | }
122 |
123 | @override
124 | Widget build(BuildContext context) {
125 | return Scaffold(
126 | body: SafeArea(
127 | child: Column(
128 | mainAxisAlignment: MainAxisAlignment.center,
129 | crossAxisAlignment: CrossAxisAlignment.center,
130 | children: [
131 | const Text('Initial Value: '),
132 | SizedBox(height: 20,),
133 | Row(
134 | crossAxisAlignment: CrossAxisAlignment.center,
135 | mainAxisAlignment: MainAxisAlignment.center,
136 | children: [
137 | Text( _feetList[_feet].toString()+"'" , style: TextStyle(fontSize: 40),),
138 | SizedBox(width: 12,),
139 | Text( _inchesList[_inches].toString()+'"' , style: TextStyle(fontSize: 40)),
140 |
141 | ],
142 | ),
143 | Center(
144 | child: CupertinoButton(
145 | padding: EdgeInsets.zero,
146 | // Display a CupertinoPicker with list of fruits.
147 | onPressed: () {
148 | _showMyDialog();
149 | },
150 | // This displays the selected fruit name.
151 | child: Text(
152 | 'Click to pick height',
153 | style: const TextStyle(
154 | fontSize: 22.0,
155 | ),
156 | ),
157 | ),
158 | ),
159 | ],
160 | ),
161 | ),
162 | );
163 | }
164 | }
165 |
166 |
--------------------------------------------------------------------------------
/lib/widgets/custom_slider.dart:
--------------------------------------------------------------------------------
1 | import 'dart:math';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:syncfusion_flutter_sliders/sliders.dart';
5 |
6 |
7 |
8 |
9 | class NewSlide extends StatefulWidget {
10 | const NewSlide({Key? key}) : super(key: key);
11 |
12 | @override
13 | State createState() => _NewSlideState();
14 | }
15 |
16 | class _NewSlideState extends State {
17 |
18 | late SfRangeValues _values;
19 | late double _numberFormat;
20 | late TextEditingController _rangeStartController;
21 | late TextEditingController _rangeEndController;
22 |
23 | Widget _buildThumbIcon(TextEditingController controller) {
24 | return Transform.translate(
25 | // Here 20 is thumb diameter and 5 is spacing between thumb and text.
26 | offset: const Offset(0, 25),
27 | child: OverflowBox(
28 | maxWidth: 150,
29 | child: TextField(
30 | textAlign: TextAlign.center,
31 | decoration:
32 | const InputDecoration(border: InputBorder.none, isDense: true),
33 | controller: controller,
34 | ),
35 | ),
36 | );
37 | }
38 |
39 | String _getFormattedText(dynamic value) {
40 | return 'asdf';
41 | }
42 |
43 | @override
44 | void initState() {
45 | _values = const SfRangeValues(3.0, 7.0);
46 | _rangeStartController = TextEditingController();
47 | _rangeEndController = TextEditingController();
48 | super.initState();
49 | }
50 |
51 | @override
52 | void dispose() {
53 | _rangeStartController.dispose();
54 | _rangeEndController.dispose();
55 | super.dispose();
56 | }
57 |
58 | @override
59 | Widget build(BuildContext context) {
60 | return Scaffold(
61 | body: SfRangeSlider(
62 | min: 0.0,
63 | max: 10.0,
64 | startThumbIcon: _buildThumbIcon(_rangeStartController),
65 | endThumbIcon: _buildThumbIcon(_rangeEndController),
66 | values: _values,
67 | onChangeStart: (SfRangeValues newValues) {
68 | _rangeStartController.text = _getFormattedText(newValues.start);
69 | _rangeEndController.text = _getFormattedText(newValues.end);
70 | },
71 | onChanged: (SfRangeValues newValues) {
72 | setState(() {
73 | _rangeStartController.text = _getFormattedText(newValues.start);
74 | _rangeEndController.text = _getFormattedText(newValues.end);
75 | _values = newValues;
76 | });
77 | },
78 | onChangeEnd: (SfRangeValues newValues) {
79 | _rangeStartController.text = "";
80 | _rangeEndController.text = "";
81 | },
82 | ),
83 | );
84 | }
85 |
86 | }
87 |
88 | class WaveSlider extends StatefulWidget {
89 | @override
90 | State createState() => WaveSliderState();
91 | }
92 |
93 | class WaveSliderState extends State {
94 |
95 | double _value = 0;
96 |
97 |
98 | @override
99 | Widget build(BuildContext context) {
100 | return Scaffold(
101 | body: Center(
102 | child: _slider(200, 200),
103 | ),
104 | );
105 | }
106 |
107 | double percentage = 0.1;
108 | Widget _slider(double width, double height) {
109 | return GestureDetector(
110 | onVerticalDragStart: (details) {
111 | percentage = (height - details.localPosition.dy) / height;
112 | setState(() {});
113 | },
114 | onVerticalDragUpdate: (details) {
115 | percentage = (height - details.localPosition.dy) / height;
116 | setState(() {});
117 | },
118 | child: Container(
119 | width: width,
120 | height: height,
121 | decoration: BoxDecoration(
122 | borderRadius: BorderRadius.circular(width / 2),
123 | color: Colors.blueGrey,
124 | ),
125 | child: Container(
126 | width: double.infinity,
127 | height: double.infinity,
128 | decoration: BoxDecoration(
129 | borderRadius: BorderRadius.circular(width / 2),
130 | gradient: LinearGradient(
131 | begin: Alignment.topCenter,
132 | end: Alignment.bottomCenter,
133 | stops: [
134 | 0.0,
135 | 1 - percentage,
136 | 1 - percentage,
137 | 1.0,
138 | ],
139 | colors: const [
140 | Colors.transparent,
141 | Colors.transparent,
142 | Colors.blue,
143 | Colors.blue,
144 | ],
145 | ),
146 | ),
147 | ),
148 | ),
149 | );
150 | }
151 |
152 | }
153 |
154 |
155 |
156 | class CustomTrackShape extends RoundedRectSliderTrackShape {
157 | Rect getPreferredRect({
158 | required RenderBox parentBox,
159 | Offset offset = Offset.zero,
160 | required SliderThemeData sliderTheme,
161 | bool isEnabled = false,
162 | bool isDiscrete = false,
163 | }) {
164 | final double trackHeight = sliderTheme.trackHeight!;
165 | final double trackLeft = offset.dx;
166 | final double trackTop = offset.dy + (parentBox.size.height - trackHeight) / 2;
167 | final double trackWidth = parentBox.size.width;
168 | return Rect.fromLTWH(trackLeft, trackTop, trackWidth, trackHeight);
169 | }
170 | }
--------------------------------------------------------------------------------
/lib/widgets/filter_list_view_builder_widget.dart:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | import 'package:flutter/cupertino.dart';
5 | import 'package:flutter/material.dart';
6 |
7 | class FilterListViewBuilderWidget extends StatefulWidget {
8 | const FilterListViewBuilderWidget({Key? key}) : super(key: key);
9 |
10 | @override
11 | State createState() => _FilterListViewBuilderWidgetState();
12 | }
13 |
14 | class _FilterListViewBuilderWidgetState extends State {
15 |
16 | TextEditingController controller = TextEditingController();
17 |
18 | List list = [
19 | Users(name: "Asif Taj" ,subTitle: 'Flutter developer', image: "https://cdn.pixabay.com/photo/2016/11/21/14/53/man-1845814_960_720.jpg" , isFavourite: true),
20 | Users(name: "John" ,subTitle: 'Github.com', image: "https://cdn.pixabay.com/photo/2015/01/06/16/14/woman-590490_960_720.jpg" , isFavourite: true),
21 | Users(name: "Alina" ,subTitle: 'Marketing guy', image: "https://cdn.pixabay.com/photo/2017/04/05/10/45/girl-2204622_960_720.jpg" , isFavourite: false),
22 | Users(name: "Escort" , subTitle: 'Java developer',image: "https://cdn.pixabay.com/photo/2017/12/01/08/02/paint-2990357_960_720.jpg" , isFavourite: true),
23 | Users(name: "Dave Johnson" , subTitle: 'Blockchain is new trend',image: "https://cdn.pixabay.com/photo/2016/03/26/22/13/man-1281562_960_720.jpg" , isFavourite: true),
24 | Users(name: "John Elia" ,subTitle: 'Exploring world', image: "https://cdn.pixabay.com/photo/2020/05/17/20/21/cat-5183427_960_720.jpg" , isFavourite: false),
25 | Users(name: "Aizaz khan" ,subTitle: 'TRS on Fiverr', image: "https://cdn.pixabay.com/photo/2021/11/09/15/54/man-6781827_960_720.jpg" , isFavourite: false),
26 | Users(name: "Burlin" ,subTitle: 'Money hiest', image: "https://cdn.pixabay.com/photo/2021/03/02/16/34/woman-6063087_960_720.jpg" , isFavourite: true),
27 | Users(name: "John Wick" ,subTitle: 'Who kill my dog', image: "https://cdn.pixabay.com/photo/2020/05/17/20/21/cat-5183427_960_720.jpg" , isFavourite: false),
28 | Users(name: "Tokyo" ,subTitle: 'Capital of Japan', image: "https://cdn.pixabay.com/photo/2021/05/01/09/59/city-6220689_960_720.jpg" , isFavourite: true),
29 |
30 | ] ;
31 |
32 | //source code github.com/axiftaj
33 | // check widget of the week repo
34 |
35 | @override
36 | Widget build(BuildContext context) {
37 | return Scaffold(
38 |
39 | body: SafeArea(
40 | child: Center(
41 | child: Padding(
42 | padding: const EdgeInsets.symmetric(vertical: 20),
43 | child: Column(
44 | mainAxisAlignment: MainAxisAlignment.start,
45 | children: [
46 | Padding(
47 | padding: const EdgeInsets.symmetric(horizontal: 20 , vertical: 10),
48 | child: CupertinoSearchTextField(
49 | placeholder: 'Search',
50 |
51 | onChanged: (value){
52 | setState(() {});
53 | },
54 | onSubmitted: (value){
55 | },
56 | controller: controller,
57 | ),
58 | ),
59 | Expanded(
60 | child: ListView.builder(
61 | itemCount: list.length,
62 | itemBuilder: (context , index){
63 | String name = list[index].name ;
64 |
65 | if(controller.text.isEmpty){
66 | return ListTile(
67 | leading: CircleAvatar(
68 | backgroundImage: NetworkImage(list[index].image),
69 | ),
70 | title: Text(list[index].name),
71 | subtitle: Text(list[index].subTitle),
72 |
73 | trailing: list[index].isFavourite ? Icon(Icons.favorite , color: Colors.red.shade600,) : Icon(Icons.favorite_border),
74 | );
75 | }else if(name.toLowerCase().contains(controller.text.toLowerCase())){
76 | return ListTile(
77 | leading: CircleAvatar(
78 | backgroundImage: NetworkImage(list[index].image),
79 | ),
80 | title: Text(list[index].name),
81 | subtitle: Text(list[index].subTitle),
82 |
83 | trailing: list[index].isFavourite ? Icon(Icons.favorite , color: Colors.red.shade600,) : Icon(Icons.favorite_border),
84 | );
85 |
86 | }else {
87 | return Container();
88 | }
89 |
90 | }))
91 | ],
92 |
93 | ),
94 | ),
95 | ),
96 | ),
97 | );
98 | }
99 | }
100 |
101 |
102 | class Users {
103 |
104 | String name, image , subTitle ;
105 | bool isFavourite;
106 |
107 | Users({required this.name , required this.isFavourite , required this.image , required this.subTitle});
108 | }
--------------------------------------------------------------------------------
/lib/widgets/flutter_fancy_tree_widget.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_fancy_tree_view/flutter_fancy_tree_view.dart';
2 |
3 |
4 | import 'package:flutter/material.dart';
5 |
6 |
7 |
8 |
9 | // Create a class to hold your hierarchical data (optional, could be a Map or
10 | // any other data structure that's capable of representing hierarchical data).
11 | class CommentsModel {
12 | const CommentsModel({
13 | required this.title,
14 | this.children = const [],
15 | });
16 |
17 | final String title;
18 | final List children;
19 | }
20 |
21 | class ReplyModelList {
22 | const ReplyModelList({
23 | required this.title,
24 | this.children = const [],
25 | });
26 |
27 | final String title;
28 | final List children;
29 | }
30 |
31 |
32 | class FlutterFancyTreeWidget extends StatefulWidget {
33 | const FlutterFancyTreeWidget({super.key});
34 |
35 | @override
36 | State createState() => _FlutterFancyTreeWidgetState();
37 | }
38 |
39 | class _FlutterFancyTreeWidgetState extends State {
40 | // In this example a static nested tree is used, but your hierarchical data
41 | // can be composed and stored in many different ways.
42 | static const List commentsList = [
43 | CommentsModel(
44 | title: 'Root 1',
45 | children: [
46 | CommentsModel(
47 | title: 'Node 1.1',
48 | ),
49 | CommentsModel(title: 'Node 1.2'),
50 | ],
51 | ),
52 | CommentsModel(
53 | title: 'Root 2',
54 | children: [
55 | CommentsModel(
56 | title: 'Node 2.1',
57 |
58 | ),
59 | CommentsModel(title: 'Node 2.2')
60 | ],
61 | ),
62 | ];
63 |
64 | // This controller is responsible for both providing your hierarchical data
65 | // to tree views and also manipulate the states of your tree nodes.
66 | late final TreeController treeController;
67 |
68 | @override
69 | void initState() {
70 | super.initState();
71 | treeController = TreeController(
72 | // Provide the root nodes that will be used as a starting point when
73 | // traversing your hierarchical data.
74 | roots: commentsList,
75 | // Provide a callback for the controller to get the children of a
76 | // given node when traversing your hierarchical data. Avoid doing
77 | // heavy computations in this method, it should behave like a getter.
78 | childrenProvider: (CommentsModel node) => node.children,
79 | );
80 | }
81 |
82 | @override
83 | void dispose() {
84 | // Remember to dispose your tree controller to release resources.
85 | treeController.dispose();
86 | super.dispose();
87 | }
88 |
89 | @override
90 | Widget build(BuildContext context) {
91 |
92 | // experiences.
93 | return Scaffold(
94 | appBar: AppBar(
95 | title: Text('Hello'),
96 | ),
97 | body: TreeView(
98 | // This controller is used by tree views to build a flat representation
99 | // of a tree structure so it can be lazy rendered by a SliverList.
100 | // It is also used to store and manipulate the different states of the
101 | // tree nodes.
102 | treeController: treeController,
103 | // Provide a widget builder callback to map your tree nodes into widgets.
104 | nodeBuilder: (BuildContext context, TreeEntry entry) {
105 | // Provide a widget to display your tree nodes in the tree view.
106 | //
107 | // Can be any widget, just make sure to include a [TreeIndentation]
108 | // within its widget subtree to properly indent your tree nodes.
109 | return MyTreeTile(
110 | // Add a key to your tiles to avoid syncing descendant animations.
111 | key: ValueKey(entry.node),
112 | // Your tree nodes are wrapped in TreeEntry instances when traversing
113 | // the tree, these objects hold important details about its node
114 | // relative to the tree, like: expansion state, level, parent, etc.
115 | //
116 | // TreeEntrys are short lived, each time TreeController.rebuild is
117 | // called, a new TreeEntry is created for each node so its properties
118 | // are always up to date.
119 | entry: entry,
120 | // Add a callback to toggle the expansion state of this node.
121 | onTap: () => treeController.toggleExpansion(entry.node),
122 | );
123 | },
124 | ),
125 | );
126 | }
127 | }
128 |
129 | // Create a widget to display the data held by your tree nodes.
130 | class MyTreeTile extends StatelessWidget {
131 | const MyTreeTile({
132 | super.key,
133 | required this.entry,
134 | required this.onTap,
135 | });
136 |
137 | final TreeEntry entry;
138 | final VoidCallback onTap;
139 |
140 | @override
141 | Widget build(BuildContext context) {
142 | return InkWell(
143 | onTap: onTap,
144 |
145 | child: TreeIndentation(
146 | entry: entry,
147 | guide: const IndentGuide.connectingLines(indent: 48),
148 | child: Padding(
149 | padding: const EdgeInsets.fromLTRB(4, 8, 8, 8),
150 | child: Row(
151 | children: [
152 | // Add a widget to indicate the expansion state of this node.
153 | // See also: ExpandIcon.
154 | Expanded(
155 | child: ListTile(
156 | leading: CircleAvatar(),
157 | title: Text(entry.node.title),
158 | onTap: entry.hasChildren ? onTap : null ,
159 | ),
160 | ),
161 |
162 |
163 | ],
164 | ),
165 | ),
166 | ),
167 | );
168 | }
169 | }
--------------------------------------------------------------------------------
/lib/widgets/flutter_slidebale_widget.dart:
--------------------------------------------------------------------------------
1 |
2 | import 'package:carousel_slider/carousel_slider.dart';
3 | import 'package:flutter/cupertino.dart';
4 | import 'package:flutter/material.dart';
5 | import 'package:flutter_swipe_action_cell/flutter_swipe_action_cell.dart';
6 |
7 | final List imgList = [
8 | 'https://images.unsplash.com/photo-1520342868574-5fa3804e551c?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=6ff92caffcdd63681a35134a6770ed3b&auto=format&fit=crop&w=1951&q=80',
9 | 'https://images.unsplash.com/photo-1522205408450-add114ad53fe?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=368f45b0888aeb0b7b08e3a1084d3ede&auto=format&fit=crop&w=1950&q=80',
10 | ];
11 |
12 |
13 | class ImageSliderDemo extends StatefulWidget {
14 | const ImageSliderDemo({Key? key}) : super(key: key);
15 |
16 | @override
17 | State createState() => _ImageSliderDemoState();
18 | }
19 |
20 | class _ImageSliderDemoState extends State {
21 |
22 | Widget build(BuildContext context) {
23 | return Scaffold(
24 | appBar: AppBar(title: Text('Noon-looping carousel demo')),
25 | body: ListView.builder(
26 | itemCount: 10,
27 | itemBuilder: (con, index){
28 | return Padding(
29 | padding: const EdgeInsets.only(bottom: 20),
30 | child: Container(
31 | child: CarouselSlider(
32 | options: CarouselOptions(
33 | aspectRatio: 4.0,
34 | pageSnapping: true,
35 | viewportFraction: 1,
36 | enlargeCenterPage: true,
37 | reverse: false,
38 | enableInfiniteScroll: false,
39 | initialPage: 0,
40 | autoPlay: false,
41 | ),
42 | items: [
43 | Text('asdfs')
44 | ],
45 | )),
46 | );
47 | }
48 | ),
49 | );
50 | }
51 | final List imageSliders = imgList
52 | .map((item) => Container(
53 | child: Container(
54 | margin: EdgeInsets.all(5.0),
55 | child: ClipRRect(
56 | borderRadius: BorderRadius.all(Radius.circular(5.0)),
57 | child: Stack(
58 | children: [
59 | Image.network(item, fit: BoxFit.cover, width: 1000.0),
60 | Positioned(
61 | bottom: 0.0,
62 | left: 0.0,
63 | right: 0.0,
64 | child: Container(
65 | decoration: BoxDecoration(
66 | gradient: LinearGradient(
67 | colors: [
68 | Color.fromARGB(200, 0, 0, 0),
69 | Color.fromARGB(0, 0, 0, 0)
70 | ],
71 | begin: Alignment.bottomCenter,
72 | end: Alignment.topCenter,
73 | ),
74 | ),
75 | padding: EdgeInsets.symmetric(
76 | vertical: 10.0, horizontal: 20.0),
77 | child: Text(
78 | 'No. ${imgList.indexOf(item)} image',
79 | style: TextStyle(
80 | color: Colors.white,
81 | fontSize: 20.0,
82 | fontWeight: FontWeight.bold,
83 | ),
84 | ),
85 | ),
86 | ),
87 | ],
88 | )),
89 | ),
90 | ))
91 | .toList() ;
92 | }
93 |
94 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/lib/widgets/future_builder_widget.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 |
4 | class FutureBuilderWidget extends StatefulWidget {
5 | const FutureBuilderWidget({Key? key}) : super(key: key);
6 |
7 | @override
8 | State createState() => _FutureBuilderWidgetState();
9 | }
10 |
11 | class _FutureBuilderWidgetState extends State {
12 |
13 |
14 | Future generateNumbers() async {
15 |
16 | await Future.delayed( const Duration(seconds: 1));
17 | return DateTime.now();
18 | }
19 |
20 |
21 | @override
22 | Widget build(BuildContext context) {
23 |
24 | return Scaffold(
25 | appBar: AppBar(
26 | automaticallyImplyLeading: false,
27 | title: const Text('Flutter StreamBuilder Demo'),
28 | ),
29 | body: Column(
30 | mainAxisAlignment: MainAxisAlignment.spaceBetween,
31 | crossAxisAlignment: CrossAxisAlignment.stretch,
32 | children: [
33 | FutureBuilder(
34 | future: generateNumbers(),
35 | builder: (BuildContext context, snapshot,) {
36 | if (snapshot.connectionState == ConnectionState.waiting) {
37 | return const CircularProgressIndicator();
38 | } else if (snapshot.connectionState == ConnectionState.active
39 | || snapshot.connectionState == ConnectionState.done) {
40 | if (snapshot.hasError) {
41 | return const Text('Error');
42 | } else if (snapshot.hasData) {
43 | return Text(
44 | snapshot.data.toString(),
45 | style: const TextStyle(color: Colors.teal, fontSize: 36)
46 | );
47 | } else {
48 | return const Text('Empty data');
49 | }
50 | } else {
51 | return Text('State: ${snapshot.connectionState}');
52 | }
53 |
54 | },
55 | ),
56 |
57 | ],
58 | ),
59 | );
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/lib/widgets/height_picker.dart:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | import 'package:awesome_number_picker/awesome_number_picker.dart';
5 | import 'package:flutter/material.dart';
6 |
7 | class HeightPicker extends StatefulWidget {
8 | const HeightPicker({Key? key}) : super(key: key);
9 |
10 | @override
11 | State createState() => _HeightPickerState();
12 | }
13 |
14 | class _HeightPickerState extends State {
15 |
16 | int integerValue = 0;
17 | double decimalValue = 0;
18 |
19 | @override
20 | Widget build(BuildContext context) {
21 | return Scaffold(
22 | appBar: AppBar(title: const Text("Awesome Number Picker")),
23 | body: Column(
24 | mainAxisAlignment: MainAxisAlignment.center,
25 | crossAxisAlignment: CrossAxisAlignment.center,
26 | children: [
27 | InkWell(
28 | onTap: (){
29 | _showMyDialog();
30 | },
31 | child: Row(
32 | mainAxisAlignment: MainAxisAlignment.spaceAround,
33 | crossAxisAlignment: CrossAxisAlignment.center,
34 | children: [
35 | const Text("Integer Value"),
36 | Text(integerValue.toString()),
37 | ],
38 | ),
39 | ),
40 | Row(
41 | mainAxisAlignment: MainAxisAlignment.spaceAround,
42 | crossAxisAlignment: CrossAxisAlignment.center,
43 | children: [
44 | const Text("Decimal Value"),
45 | Text(decimalValue.toStringAsFixed(3)),
46 | ],
47 | ),
48 | SizedBox(
49 | height: 150,
50 | child: DecimalNumberPicker(
51 | initialValue: 25.75,
52 | minValue: 0,
53 | maxValue: 100,
54 | decimalPrecision: 3,
55 | otherItemsDecoration: BoxDecoration(
56 | boxShadow: [
57 | BoxShadow(
58 | color: Colors.grey.withOpacity(.5),
59 | blurRadius: 20.0, // soften the shadow
60 | spreadRadius: 0.0, //extend the shadow
61 | )
62 | ],
63 | ),
64 | pickedItemDecoration: BoxDecoration(
65 | boxShadow: [
66 | BoxShadow(
67 | color: Colors.blue.withOpacity(.5),
68 | blurRadius: 20.0, // soften the shadow
69 | spreadRadius: 0.0, //extend the shadow
70 | )
71 | ],
72 | ),
73 | onChanged: (i) => setState(() {
74 | decimalValue = i;
75 | }),
76 | ),
77 | ),
78 | ],
79 | ),
80 | );
81 | }
82 |
83 | Future _showMyDialog() async {
84 | return showDialog(
85 | context: context,
86 | barrierDismissible: false, // user must tap button!
87 | builder: (BuildContext context) {
88 | return AlertDialog(
89 | title: const Text('AlertDialog Title'),
90 | content: SingleChildScrollView(
91 | child: ListBody(
92 | children: [
93 | SizedBox(
94 | height: 80,
95 | child: IntegerNumberPicker(
96 | initialValue: integerValue,
97 | axis: Axis.vertical,
98 | pickedItemDecoration: BoxDecoration(
99 | color: Colors.transparent
100 | ),
101 | otherItemsDecoration:BoxDecoration(
102 | color: Colors.transparent
103 | ),
104 | minValue: 0,
105 | maxValue: 10,
106 | onChanged: (i) => setState(() {
107 | integerValue = i;
108 | }),
109 | ),
110 | ),
111 | ],
112 | ),
113 | ),
114 | actions: [
115 | TextButton(
116 | child: const Text('Approve'),
117 | onPressed: () {
118 | Navigator.of(context).pop();
119 | },
120 | ),
121 | ],
122 | );
123 | },
124 | );
125 | }
126 | }
127 |
--------------------------------------------------------------------------------
/lib/widgets/image_compressor_widget.dart:
--------------------------------------------------------------------------------
1 |
2 |
3 | import 'dart:io';
4 | import 'package:flutter/foundation.dart';
5 | import 'package:path_provider/path_provider.dart' as path_provider;
6 | import 'package:flutter/material.dart';
7 | import 'package:flutter_image_compress/flutter_image_compress.dart';
8 | import 'package:image_picker/image_picker.dart';
9 |
10 | class ImageCompressorWidget extends StatefulWidget {
11 | const ImageCompressorWidget({Key? key}) : super(key: key);
12 |
13 | @override
14 | State createState() => _ImageCompressorWidgetState();
15 | }
16 |
17 | class _ImageCompressorWidgetState extends State {
18 |
19 | File? newImage ;
20 |
21 | XFile? image ;
22 |
23 | final picker = ImagePicker();
24 |
25 | // method to pick single image while replacing the photo
26 | Future imagePickerFromGallery ()async{
27 |
28 | image = (await picker.pickImage(source: ImageSource.gallery))!;
29 |
30 | final bytes = await image!.readAsBytes();
31 | final kb = bytes.length / 1024;
32 | final mb = kb / 1024;
33 |
34 | if (kDebugMode) {
35 | print('original image size:'+mb.toString());
36 | }
37 |
38 | final dir = await path_provider.getTemporaryDirectory();
39 | final targetPath = '${dir.absolute.path}/${DateTime.now().millisecondsSinceEpoch}.jpg';
40 |
41 | // converting original image to compress it
42 | final result = await FlutterImageCompress.compressAndGetFile(
43 | image!.path,
44 | targetPath,
45 | minHeight: 1080, //you can play with this to reduce siz
46 | minWidth: 1080,
47 | quality: 90, // keep this high to get the original quality of image
48 | );
49 |
50 | final data = await result!.readAsBytes() ;
51 | final newKb = data.length / 1024;
52 | final newMb = newKb / 1024;
53 |
54 | if (kDebugMode) {
55 | print('compress image size:'+newMb.toString());
56 | }
57 |
58 | newImage = File(result.path) ;
59 |
60 | setState(() {});
61 |
62 | }
63 |
64 | @override
65 | Widget build(BuildContext context) {
66 | return Scaffold(
67 | floatingActionButton: FloatingActionButton(
68 | onPressed: (){
69 | imagePickerFromGallery();
70 | },
71 | ),
72 | body: SafeArea(
73 | child: Column(
74 | children: [
75 | if(image != null )
76 | SizedBox(
77 | child: Image.file(
78 | File(newImage !.path),
79 | fit: BoxFit.fitHeight,
80 | ),
81 | ),
82 |
83 | ],
84 | ),
85 | ),
86 | );
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/lib/widgets/image_widget.dart:
--------------------------------------------------------------------------------
1 |
2 |
3 | import 'package:flutter/material.dart';
4 |
5 | class ImageWidget extends StatelessWidget {
6 | const ImageWidget({Key? key}) : super(key: key);
7 |
8 | @override
9 | Widget build(BuildContext context) {
10 | return Scaffold(
11 | body: Center(
12 | child: ImageBuilderWidget(image: 'https://images.pexels.com/photos/13585848/pexels-photo-13585848.jpeg?cs=srgb&dl=pexels-bruno-silva-13585848.jpg&fm=jpg',),
13 | ),
14 | );
15 | }
16 | }
17 |
18 |
19 | class ImageBuilderWidget extends StatelessWidget {
20 |
21 | final String image ;
22 | final double height, width ;
23 | const ImageBuilderWidget({Key? key,required this.image , this.height = 200 , this.width = 200 }) : super(key: key);
24 |
25 | @override
26 | Widget build(BuildContext context) {
27 | return ClipRRect(
28 | borderRadius: BorderRadius.circular(10),
29 | child: Container(
30 | height: height,
31 | width: width,
32 | decoration: BoxDecoration(
33 | borderRadius: BorderRadius.circular(10),
34 | border: Border.all(
35 | )
36 | ),
37 | child: ClipRRect(
38 | child: Image(
39 | fit: BoxFit.cover,
40 | height: height,
41 | width: width,
42 | repeat: ImageRepeat.repeatY,
43 | image: NetworkImage(image),
44 | errorBuilder: (BuildContext context, Object exception,
45 | StackTrace? stackTrace) {
46 | return Container(
47 | height: height,
48 | width: width,
49 | child: const Icon(
50 | Icons.error,
51 | color: Colors.red,
52 | ));
53 | },
54 | loadingBuilder: (BuildContext context, Widget child,
55 | ImageChunkEvent? loadingProgress) {
56 | if (loadingProgress == null) return child ;
57 | return SizedBox(
58 | height: height,
59 | width: width,
60 | child: Center(
61 | child: CircularProgressIndicator(
62 | value: loadingProgress.expectedTotalBytes != null
63 | ? loadingProgress.cumulativeBytesLoaded /
64 | loadingProgress.expectedTotalBytes!
65 | : null,
66 | ),
67 | ),
68 | );
69 | },
70 | ),
71 | ),
72 | ),
73 | );
74 | }
75 | }
--------------------------------------------------------------------------------
/lib/widgets/ineractive_viewer_widget.dart:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | import 'package:flutter/material.dart';
6 |
7 | class InteractiveViewerWidget extends StatelessWidget {
8 | const InteractiveViewerWidget({Key? key}) : super(key: key);
9 |
10 | @override
11 | Widget build(BuildContext context) {
12 | return Scaffold(
13 | appBar: AppBar(
14 | title: const Text('Interactive Viewer widget'),
15 | ),
16 | body: Center(
17 | child: InteractiveViewer(
18 | minScale: 1,
19 | maxScale: 10,
20 | child: Image.network(
21 | 'https://scontent.fisb5-1.fna.fbcdn.net/v/t39.30808-6/379453287_5109356982629026_6158747720213286071_n.jpg?_nc_cat=101&ccb=1-7&_nc_sid=a2f6c7&_nc_ohc=dgPUW1hwvnsAX_GvrO6&_nc_ht=scontent.fisb5-1.fna&oh=00_AfApvO2e_V2O6e4DsqdCS7oh6E9qkK1xf8ZpE4ax3OFnwQ&oe=6521ED3C'
22 | ),
23 | ),
24 | ),
25 | );
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/lib/widgets/internet_connection.dart:
--------------------------------------------------------------------------------
1 | import 'dart:math';
2 |
3 | import 'package:connectivity_plus/connectivity_plus.dart';
4 | import 'package:flutter/material.dart';
5 |
6 |
7 | class CheckInternetConnectionWidget extends StatelessWidget {
8 | final AsyncSnapshot snapshot;
9 | final Widget widget ;
10 | const CheckInternetConnectionWidget({
11 | Key? key,
12 | required this.snapshot,
13 | required this.widget
14 | }) : super(key: key);
15 |
16 | @override
17 | Widget build(BuildContext context) {
18 | switch (snapshot.connectionState) {
19 | case ConnectionState.active:
20 | final state = snapshot.data!;
21 | switch (state) {
22 | case ConnectivityResult.none:
23 | return Center(child: const Text('Not connected'));
24 | default:
25 | return widget;
26 | }
27 | break;
28 | default:
29 | return const Text('');
30 | }
31 | }
32 | }
33 |
34 |
35 | class InternetConnectivityScreen extends StatelessWidget {
36 | InternetConnectivityScreen({Key? key}) : super(key: key);
37 |
38 | List colors = [Colors.redAccent, Colors.purple , Colors.pinkAccent, Colors.black, Colors.teal, Colors.green, Colors.grey];
39 | Random random = Random();
40 |
41 | @override
42 | Widget build(BuildContext context) {
43 | Connectivity connectivity = Connectivity() ;
44 | return Scaffold(
45 | appBar: AppBar(
46 | centerTitle: true,
47 | title: Text('Internet Connectivity'),
48 | ),
49 | // body: SafeArea(
50 | // child: StreamBuilder(
51 | // stream: connectivity.onConnectivityChanged,
52 | // builder: (_, snapshot){
53 | // return Padding(
54 | // padding: const EdgeInsets.symmetric(horizontal: 10),
55 | // child: CheckInternetConnectionWidget(
56 | // snapshot: snapshot,
57 | // widget: Column(
58 | // children: [
59 | // Expanded(
60 | // child: ListView.builder(
61 | // itemCount: 120,
62 | // itemBuilder: (context, index){
63 | // return Padding(
64 | // padding: const EdgeInsets.only(bottom: 8),
65 | // child: Container(
66 | // color: colors[random.nextInt(7)],
67 | // height: 100,
68 | // child: Center(child: Text(index.toString()))),
69 | // );
70 | // }),
71 | // )
72 | // ],
73 | // ),
74 | // ),
75 | // ) ;
76 | // },
77 | // ),
78 | // ),
79 | );
80 | }
81 | }
--------------------------------------------------------------------------------
/lib/widgets/re_orderable_list_view_builder_widget.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 |
4 | class ReorderableListViewWidget extends StatefulWidget {
5 | const ReorderableListViewWidget({Key? key}) : super(key: key);
6 |
7 | @override
8 | State createState() => _ReorderableListViewWidgetState();
9 | }
10 |
11 | class _ReorderableListViewWidgetState extends State {
12 |
13 | final List _products = ['Apple' , 'Mango' ,"Orange" , "Banana" , "Strabery" ,'Cherry'];
14 |
15 | @override
16 | Widget build(BuildContext context) {
17 | return Scaffold(
18 | appBar: AppBar(
19 | title: const Text('Subscribe'),
20 | ),
21 | body: ReorderableListView.builder(
22 | itemCount: _products.length,
23 | itemBuilder: (context, index) {
24 | return Card(
25 | key: ValueKey(_products[index]),
26 | color: Colors.teal.shade100,
27 | elevation: 1,
28 | margin: const EdgeInsets.all(10),
29 | child: ListTile(
30 | contentPadding: const EdgeInsets.all(25),
31 | title: Text(
32 | _products[index],
33 | style: const TextStyle(fontSize: 18),
34 | ),
35 | trailing: const Icon(Icons.drag_handle),
36 | onTap: () {},
37 | ),
38 |
39 |
40 | );
41 | },
42 | // The reorder function
43 | onReorder: (oldIndex, newIndex) {
44 | setState(() {
45 | if (newIndex > oldIndex) {
46 | newIndex = newIndex - 1;
47 | }
48 | final element = _products.removeAt(oldIndex);
49 | print(_products.length);
50 | print(element);
51 | _products.insert(newIndex, element);
52 | print(_products.length);
53 |
54 | });
55 | }),
56 | );
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/lib/widgets/streams_builder_screen.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'dart:async';
3 |
4 | class StreamsBuilderScreen extends StatefulWidget {
5 | const StreamsBuilderScreen({Key? key}) : super(key: key);
6 |
7 | @override
8 | State createState() => _StreamsBuilderScreenState();
9 | }
10 |
11 | class _StreamsBuilderScreenState extends State {
12 |
13 | final emailController = TextEditingController();
14 | List list = [] ;
15 |
16 | StreamSocket streamSocket = StreamSocket();
17 |
18 | late StreamSubscription streamSubscription;
19 | DateTime currentTime = DateTime.now();
20 |
21 |
22 | Stream generateNumbers() async* {
23 |
24 | while(true) {
25 | await Future.delayed( const Duration(seconds: 1));
26 | yield DateTime.now();
27 | }
28 | }
29 |
30 |
31 | @override
32 | Widget build(BuildContext context) {
33 |
34 | return Scaffold(
35 | appBar: AppBar(
36 | automaticallyImplyLeading: false,
37 | title: const Text('Flutter StreamBuilder Demo'),
38 | ),
39 | body: Column(
40 | mainAxisAlignment: MainAxisAlignment.spaceBetween,
41 | crossAxisAlignment: CrossAxisAlignment.stretch,
42 | children: [
43 | StreamBuilder(
44 | stream: generateNumbers(),
45 | builder: (BuildContext context, AsyncSnapshot snapshot,) {
46 | if (snapshot.connectionState == ConnectionState.waiting) {
47 | return CircularProgressIndicator();
48 | } else if (snapshot.connectionState == ConnectionState.active
49 | || snapshot.connectionState == ConnectionState.done) {
50 | if (snapshot.hasError) {
51 | return const Text('Error');
52 | } else if (snapshot.hasData) {
53 | return Text(
54 | snapshot.data.toString(),
55 | style: const TextStyle(color: Colors.teal, fontSize: 36)
56 | );
57 | } else {
58 | return const Text('Empty data');
59 | }
60 | } else {
61 | return Text('State: ${snapshot.connectionState}');
62 | }
63 |
64 | },
65 | ),
66 | StreamBuilder(
67 | stream: streamSocket.getResponse,
68 | initialData: [
69 | 'No data'
70 | ],
71 | builder: (BuildContext context, AsyncSnapshot> snapshot) {
72 | if(snapshot.connectionState == ConnectionState.waiting){
73 | return Center(child: const CircularProgressIndicator());
74 | }else if(snapshot.hasError){
75 | return Text('error'+snapshot.error.toString());
76 | }else if(snapshot.connectionState == ConnectionState.active){
77 | return Expanded(
78 | child: ListView.builder(
79 | itemCount: snapshot.data!.length,
80 | itemBuilder: (context, index){
81 | return Text( snapshot.data![index].toString());
82 | }
83 | ),
84 | );
85 | }else {
86 | return Text('some thing went wrong');
87 | }
88 | },
89 | ),
90 | Row(
91 | children: [
92 | Expanded(child: TextFormField(
93 | controller: emailController,
94 | decoration: InputDecoration(
95 | hintText: 'Enter message'
96 | ),
97 | )),
98 | TextButton(onPressed: (){
99 |
100 | list.add(emailController.text.toString());
101 | streamSocket.addResponse(list);
102 | emailController.clear();
103 | }, child: Text('Send'))
104 | ],
105 | )
106 |
107 | ],
108 | ),
109 | );
110 | }
111 |
112 |
113 | }
114 |
115 | class StreamSocket {
116 |
117 | final _socketResponse = StreamController>.broadcast();
118 |
119 | void Function(List) get addResponse => _socketResponse.sink.add;
120 | Stream> get getResponse => _socketResponse.stream.asBroadcastStream();
121 |
122 |
123 | }
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: asif
2 | description: A new Flutter project.
3 |
4 | # The following line prevents the package from being accidentally published to
5 | # pub.dev using `flutter pub publish`. This is preferred for private packages.
6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev
7 |
8 | # The following defines the version and build number for your application.
9 | # A version number is three numbers separated by dots, like 1.2.43
10 | # followed by an optional build number separated by a +.
11 | # Both the version and the builder number may be overridden in flutter
12 | # build by specifying --build-name and --build-number, respectively.
13 | # In Android, build-name is used as versionName while build-number used as versionCode.
14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning
15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
16 | # Read more about iOS versioning at
17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
18 | version: 1.0.0+1
19 |
20 | environment:
21 | sdk: ">=2.17.6 <3.0.0"
22 |
23 | # Dependencies specify other packages that your package needs in order to work.
24 | # To automatically upgrade your package dependencies to the latest versions
25 | # consider running `flutter pub upgrade --major-versions`. Alternatively,
26 | # dependencies can be manually updated by changing the version numbers below to
27 | # the latest version available on pub.dev. To see which dependencies have newer
28 | # versions available, run `flutter pub outdated`.
29 | dependencies:
30 | flutter:
31 | sdk: flutter
32 |
33 |
34 | # The following adds the Cupertino Icons font to your application.
35 | # Use with the CupertinoIcons class for iOS style icons.
36 | cupertino_icons: ^1.0.2
37 | country_picker: ^2.0.16
38 | shared_preferences: ^2.0.15
39 | flutter_secure_storage: ^9.2.2
40 | flutter_fancy_tree_view: ^1.1.1
41 | connectivity_plus: ^6.0.5
42 | images_picker:
43 | tuple: ^2.0.1
44 | http:
45 |
46 | sticky_grouped_list: ^3.1.0
47 | comment_tree: ^0.3.0
48 | reorderable_grid_view: ^2.2.5
49 | intl: any
50 |
51 | flutter_quill: ^10.8.0
52 | awesome_number_picker: ^0.0.4
53 |
54 | flutter_swipe_action_cell:
55 | carousel_slider:
56 | syncfusion_flutter_sliders:
57 | provider: ^6.0.5
58 | geolocator: ^13.0.1
59 | image_cropper: ^8.0.2
60 | image_picker: ^1.1.2
61 | permission_handler: ^11.3.1
62 | flutter_image_compress: ^2.0.3
63 | path_provider:
64 | freezed_annotation: ^2.2.0
65 | json_annotation: ^4.8.1
66 | flutter_localizations:
67 | sdk: flutter
68 | flutter_localization: ^0.2.0
69 |
70 |
71 |
72 | dev_dependencies:
73 | flutter_test:
74 | sdk: flutter
75 |
76 | # The "flutter_lints" package below contains a set of recommended lints to
77 | # encourage good coding practices. The lint set provided by the package is
78 | # activated in the `analysis_options.yaml` file located at the root of your
79 | # package. See that file for information about deactivating specific lint
80 | # rules and activating additional ones.
81 | flutter_lints: ^5.0.0
82 | freezed: ^2.3.5
83 | build_runner: ^2.4.5
84 | json_serializable: ^6.7.0
85 | equatable:
86 |
87 | # For information on the generic Dart part of this file, see the
88 | # following page: https://dart.dev/tools/pub/pubspec
89 |
90 | # The following section is specific to Flutter packages.
91 | flutter:
92 | generate: true
93 | # The following line ensures that the Material Icons font is
94 | # included with your application, so that you can use the icons in
95 | # the material Icons class.
96 | uses-material-design: true
97 |
98 |
99 | # To add assets to your application, add an assets section, like this:
100 | # assets:
101 | # - images/a_dot_burr.jpeg
102 | # - images/a_dot_ham.jpeg
103 |
104 | # An image asset can refer to one or more resolution-specific "variants", see
105 | # https://flutter.dev/assets-and-images/#resolution-aware
106 |
107 | # For details regarding adding assets from package dependencies, see
108 | # https://flutter.dev/assets-and-images/#from-packages
109 |
110 | # To add custom fonts to your application, add a fonts section here,
111 | # in this "flutter" section. Each entry in this list should have a
112 | # "family" key with the font family name, and a "fonts" key with a
113 | # list giving the asset and other descriptors for the font. For
114 | # example:
115 | # fonts:
116 | # - family: Schyler
117 | # fonts:
118 | # - asset: fonts/Schyler-Regular.ttf
119 | # - asset: fonts/Schyler-Italic.ttf
120 | # style: italic
121 | # - family: Trajan Pro
122 | # fonts:
123 | # - asset: fonts/TrajanPro.ttf
124 | # - asset: fonts/TrajanPro_Bold.ttf
125 | # weight: 700
126 | #
127 | # For details regarding fonts from package dependencies,
128 | # see https://flutter.dev/custom-fonts/#from-packages
129 | assets:
130 | - assets/images/
131 | fonts:
132 | - family: Nunito
133 | fonts:
134 | - asset: assets/fonts/Nunito-Regular.ttf
135 | - asset: assets/fonts/Nunito-ExtraBold.ttf
136 | style: italic
--------------------------------------------------------------------------------
/test/counter_test.dart:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | import 'package:flutter_test/flutter_test.dart';
6 |
7 | void main(){
8 |
9 |
10 |
11 | }
--------------------------------------------------------------------------------
/test/widget_test.dart:
--------------------------------------------------------------------------------
1 | // This is a basic Flutter widget test.
2 | //
3 | // To perform an interaction with a widget in your test, use the WidgetTester
4 | // utility in the flutter_test package. For example, you can send tap and scroll
5 | // gestures. You can also use WidgetTester to find child widgets in the widget
6 | // tree, read text, and verify that the values of widget properties are correct.
7 |
8 | import 'package:flutter/material.dart';
9 | import 'package:flutter_test/flutter_test.dart';
10 |
11 | import 'package:asif/main.dart';
12 |
13 | void main() {
14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async {
15 | // Build our app and trigger a frame.
16 | await tester.pumpWidget(const MyApp(locale: '',));
17 |
18 | // Verify that our counter starts at 0.
19 | expect(find.text('0'), findsOneWidget);
20 | expect(find.text('1'), findsNothing);
21 |
22 | // Tap the '+' icon and trigger a frame.
23 | await tester.tap(find.byIcon(Icons.add));
24 | await tester.pump();
25 |
26 | // Verify that our counter has incremented.
27 | expect(find.text('0'), findsNothing);
28 | expect(find.text('1'), findsOneWidget);
29 | });
30 | }
31 |
--------------------------------------------------------------------------------
/web/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/web/favicon.png
--------------------------------------------------------------------------------
/web/icons/Icon-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/web/icons/Icon-192.png
--------------------------------------------------------------------------------
/web/icons/Icon-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/web/icons/Icon-512.png
--------------------------------------------------------------------------------
/web/icons/Icon-maskable-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/web/icons/Icon-maskable-192.png
--------------------------------------------------------------------------------
/web/icons/Icon-maskable-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/axiftaj/Flutter-Widget-Of-The-Week/43f2cde331911e1e4db53693ac4f86c6948b42f4/web/icons/Icon-maskable-512.png
--------------------------------------------------------------------------------
/web/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | asif
33 |
34 |
35 |
39 |
40 |
41 |
42 |
43 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/web/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "asif",
3 | "short_name": "asif",
4 | "start_url": ".",
5 | "display": "standalone",
6 | "background_color": "#0175C2",
7 | "theme_color": "#0175C2",
8 | "description": "A new Flutter project.",
9 | "orientation": "portrait-primary",
10 | "prefer_related_applications": false,
11 | "icons": [
12 | {
13 | "src": "icons/Icon-192.png",
14 | "sizes": "192x192",
15 | "type": "image/png"
16 | },
17 | {
18 | "src": "icons/Icon-512.png",
19 | "sizes": "512x512",
20 | "type": "image/png"
21 | },
22 | {
23 | "src": "icons/Icon-maskable-192.png",
24 | "sizes": "192x192",
25 | "type": "image/png",
26 | "purpose": "maskable"
27 | },
28 | {
29 | "src": "icons/Icon-maskable-512.png",
30 | "sizes": "512x512",
31 | "type": "image/png",
32 | "purpose": "maskable"
33 | }
34 | ]
35 | }
36 |
--------------------------------------------------------------------------------