├── lib ├── dialogs │ └── dialogs.dart ├── toast │ ├── types.dart │ ├── length.dart │ ├── anim_duration.dart │ ├── text_styles.dart │ ├── colors.dart │ └── widgets │ │ ├── normal.dart │ │ ├── info.dart │ │ ├── error.dart │ │ ├── warning.dart │ │ └── success.dart ├── utils │ ├── colors.dart │ └── styles.dart ├── widgets │ ├── notification.dart │ └── network_state.dart └── ots.dart ├── assets ├── cancel.png ├── success.png └── warning.png ├── screenshots ├── 1.png ├── 10.png ├── 11.png ├── 12.png ├── 2.png ├── 3.png ├── 4.png ├── 5.png ├── 6.png ├── 7.png ├── 8.png ├── 9.png ├── loader.gif ├── internet.gif ├── error_toast.png ├── info_toast.png ├── notification.gif ├── default_toast.png ├── success_toast.png └── warning_toast.png ├── example ├── ios │ ├── Runner │ │ ├── Runner-Bridging-Header.h │ │ ├── Assets.xcassets │ │ │ ├── LaunchImage.imageset │ │ │ │ ├── LaunchImage.png │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ ├── README.md │ │ │ │ └── Contents.json │ │ │ └── AppIcon.appiconset │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ │ └── Contents.json │ │ ├── AppDelegate.swift │ │ ├── Base.lproj │ │ │ ├── Main.storyboard │ │ │ └── LaunchScreen.storyboard │ │ └── Info.plist │ ├── Flutter │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── AppFrameworkInfo.plist │ ├── Runner.xcodeproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ │ └── IDEWorkspaceChecks.plist │ │ ├── xcshareddata │ │ │ └── xcschemes │ │ │ │ └── Runner.xcscheme │ │ └── project.pbxproj │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── WorkspaceSettings.xcsettings │ │ │ └── IDEWorkspaceChecks.plist │ ├── .gitignore │ ├── Podfile.lock │ └── Podfile ├── web │ ├── favicon.png │ ├── icons │ │ ├── Icon-192.png │ │ └── Icon-512.png │ ├── manifest.json │ └── index.html ├── android │ ├── gradle.properties │ ├── app │ │ ├── src │ │ │ ├── main │ │ │ │ ├── res │ │ │ │ │ ├── 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 │ │ │ │ │ ├── drawable │ │ │ │ │ │ └── launch_background.xml │ │ │ │ │ ├── drawable-v21 │ │ │ │ │ │ └── launch_background.xml │ │ │ │ │ ├── values │ │ │ │ │ │ └── styles.xml │ │ │ │ │ └── values-night │ │ │ │ │ │ └── styles.xml │ │ │ │ ├── kotlin │ │ │ │ │ └── com │ │ │ │ │ │ └── example │ │ │ │ │ │ ├── example │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ │ │ └── examplee │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ └── AndroidManifest.xml │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ └── profile │ │ │ │ └── AndroidManifest.xml │ │ └── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ ├── .gitignore │ ├── settings.gradle │ └── build.gradle ├── lib │ ├── dialogs │ │ ├── colors.dart │ │ ├── test.dart │ │ └── dialogs.dart │ └── main.dart ├── .metadata ├── README.md ├── .gitignore ├── test │ └── widget_test.dart ├── pubspec.yaml └── pubspec.lock ├── .vscode └── settings.json ├── .metadata ├── CHANGELOG.md ├── .github └── workflows │ └── main.yml ├── test └── ots_test.dart ├── pubspec.yaml ├── .gitignore ├── .all-contributorsrc ├── pubspec.lock ├── README.md └── LICENSE /lib/dialogs/dialogs.dart: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /assets/cancel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/assets/cancel.png -------------------------------------------------------------------------------- /assets/success.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/assets/success.png -------------------------------------------------------------------------------- /assets/warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/assets/warning.png -------------------------------------------------------------------------------- /lib/toast/types.dart: -------------------------------------------------------------------------------- 1 | enum ToastType { normal, info, success, error, warning } 2 | -------------------------------------------------------------------------------- /screenshots/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/screenshots/1.png -------------------------------------------------------------------------------- /screenshots/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/screenshots/10.png -------------------------------------------------------------------------------- /screenshots/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/screenshots/11.png -------------------------------------------------------------------------------- /screenshots/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/screenshots/12.png -------------------------------------------------------------------------------- /screenshots/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/screenshots/2.png -------------------------------------------------------------------------------- /screenshots/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/screenshots/3.png -------------------------------------------------------------------------------- /screenshots/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/screenshots/4.png -------------------------------------------------------------------------------- /screenshots/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/screenshots/5.png -------------------------------------------------------------------------------- /screenshots/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/screenshots/6.png -------------------------------------------------------------------------------- /screenshots/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/screenshots/7.png -------------------------------------------------------------------------------- /screenshots/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/screenshots/8.png -------------------------------------------------------------------------------- /screenshots/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/screenshots/9.png -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /example/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/example/web/favicon.png -------------------------------------------------------------------------------- /screenshots/loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/screenshots/loader.gif -------------------------------------------------------------------------------- /screenshots/internet.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/screenshots/internet.gif -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "dart.flutterSdkPath": "~/Documents/flutter_sdks/flutter_3.24.3" 3 | } -------------------------------------------------------------------------------- /screenshots/error_toast.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/screenshots/error_toast.png -------------------------------------------------------------------------------- /screenshots/info_toast.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/screenshots/info_toast.png -------------------------------------------------------------------------------- /screenshots/notification.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/screenshots/notification.gif -------------------------------------------------------------------------------- /example/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/example/web/icons/Icon-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/example/web/icons/Icon-512.png -------------------------------------------------------------------------------- /screenshots/default_toast.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/screenshots/default_toast.png -------------------------------------------------------------------------------- /screenshots/success_toast.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/screenshots/success_toast.png -------------------------------------------------------------------------------- /screenshots/warning_toast.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/screenshots/warning_toast.png -------------------------------------------------------------------------------- /lib/toast/length.dart: -------------------------------------------------------------------------------- 1 | class ToastLength { 2 | static const short = 1500; 3 | static const long = 3000; 4 | } 5 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /lib/toast/anim_duration.dart: -------------------------------------------------------------------------------- 1 | class ToastAnimDuration { 2 | static const defaultAnimDuration = Duration(milliseconds: 200); 3 | } 4 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fayaz07/ots/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/com/example/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/com/example/examplee/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.examplee 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /lib/utils/colors.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | 3 | class LibColors { 4 | static final iosDialogColor = CupertinoDynamicColor.withBrightness( 5 | color: Color(0xCCF2F2F2), 6 | darkColor: Color(0xBF1E1E1E), 7 | ); 8 | } 9 | -------------------------------------------------------------------------------- /lib/toast/text_styles.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:ots/toast/colors.dart'; 3 | 4 | class ToastTextStyle { 5 | static const TextStyle defaultTextStyle = 6 | TextStyle(color: ToastColors.defaultToastTextColor); 7 | } 8 | -------------------------------------------------------------------------------- /example/lib/dialogs/colors.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | 3 | class Colors { 4 | static final iosDialogColor = CupertinoDynamicColor.withBrightness( 5 | color: Color(0xCCF2F2F2), 6 | darkColor: Color(0xBF1E1E1E), 7 | ); 8 | 9 | 10 | } 11 | -------------------------------------------------------------------------------- /example/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-6.7-all.zip 7 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: f7a6a7906be96d2288f5d63a5a54c515a6e987fe 8 | channel: stable 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: adc687823a831bbebe28bdccfac1a628ca621513 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/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. -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [1.0.0] 2 | - Enhancements, bug fixes, added docs, screenshots. 3 | 4 | ## [0.0.2+1] 5 | - Migrated from the deprecated connectivity plugin to connectivity_plus. 6 | 7 | ## [0.0.2] . 8 | 9 | * Updated connectivity package version to ^3.0.3. 10 | * Added toasts. 11 | 12 | ## [0.0.1+1] . 13 | 14 | * Updated connectivity package version to ^0.4.9+2. 15 | 16 | ## [0.0.1] . 17 | 18 | * Initial release. 19 | -------------------------------------------------------------------------------- /lib/toast/colors.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class ToastColors { 4 | static const defaultToastBGColor = Color(0xff666666); 5 | static const defaultToastTextColor = Colors.white; 6 | static const infoToastBGColor = Color(0xff1CAEFA); 7 | static const errorToastBGColor = Color(0xffFB2F49); 8 | static const warningToastBGColor = Color(0xffFFAB00); 9 | static const successToastBGColor = Color(0xff3ECA66); 10 | } 11 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /lib/utils/styles.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class TextStyles { 4 | static final titleStyle = TextStyle( 5 | color: Colors.white, 6 | fontWeight: FontWeight.w600, 7 | fontSize: 16.0, 8 | letterSpacing: 0.5); 9 | 10 | static final bodyStyle = 11 | TextStyle(color: Colors.white, fontSize: 14.0, letterSpacing: 0.5); 12 | 13 | static final networkStatusStyle = 14 | TextStyle(color: Colors.white, fontSize: 16.0, letterSpacing: 0.15); 15 | } 16 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # examplee 2 | 3 | A new Flutter project. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Validate PR 2 | on: 3 | pull_request: 4 | branches: 5 | - master 6 | paths: 7 | - .github/workflows/** 8 | - lib/** 9 | - test/** 10 | - assets/** 11 | - pubspec.* 12 | jobs: 13 | setup: 14 | runs-on: ubuntu-latest 15 | container: cirrusci/flutter 16 | steps: 17 | - uses: actions/checkout@v2 18 | - name: Versions 19 | run: | 20 | dart --version 21 | flutter --version 22 | - name: Dependencies 23 | run: flutter pub get 24 | - name: Lint 25 | run: flutter analyze 26 | - name: Test 27 | run: flutter test 28 | -------------------------------------------------------------------------------- /example/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "examplee", 3 | "short_name": "examplee", 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 | } 24 | -------------------------------------------------------------------------------- /example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/app.flx 22 | Flutter/app.zip 23 | Flutter/flutter_assets/ 24 | Flutter/flutter_export_environment.sh 25 | ServiceDefinitions.json 26 | Runner/GeneratedPluginRegistrant.* 27 | 28 | # Exceptions to above rules. 29 | !default.mode1v3 30 | !default.mode2v3 31 | !default.pbxuser 32 | !default.perspectivev3 33 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.50' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:4.1.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 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 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /example/ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - connectivity_plus (0.0.1): 3 | - Flutter 4 | - Reachability 5 | - Flutter (1.0.0) 6 | - Reachability (3.2) 7 | 8 | DEPENDENCIES: 9 | - connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`) 10 | - Flutter (from `Flutter`) 11 | 12 | SPEC REPOS: 13 | trunk: 14 | - Reachability 15 | 16 | EXTERNAL SOURCES: 17 | connectivity_plus: 18 | :path: ".symlinks/plugins/connectivity_plus/ios" 19 | Flutter: 20 | :path: Flutter 21 | 22 | SPEC CHECKSUMS: 23 | connectivity_plus: 5f0eb61093bec56935f21a1699dd2758bc895587 24 | Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c 25 | Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 26 | 27 | PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c 28 | 29 | COCOAPODS: 1.10.0 30 | -------------------------------------------------------------------------------- /example/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 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Android Studio will place build artifacts here 44 | /android/app/debug 45 | /android/app/profile 46 | /android/app/release 47 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /test/ots_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_test/flutter_test.dart'; 3 | 4 | import 'package:ots/ots.dart'; 5 | 6 | void main() { 7 | testWidgets( 8 | 'hideLoader does not throw when no overlay is shown', 9 | (tester) async { 10 | await tester.pumpWidget( 11 | OTS( 12 | child: MaterialApp( 13 | home: Scaffold(), 14 | ), 15 | ), 16 | ); 17 | await showLoader(); 18 | await hideLoader(); 19 | try { 20 | await hideLoader(); 21 | } catch (e) { 22 | fail('threw on second call to [hideLoader]'); 23 | } 24 | }, 25 | ); 26 | 27 | testWidgets( 28 | 'hideNotification does not throw when no overlay is shown', 29 | (tester) async { 30 | await tester.pumpWidget( 31 | OTS( 32 | child: MaterialApp( 33 | home: Scaffold(), 34 | ), 35 | ), 36 | ); 37 | await showNotification(message: 'foo'); 38 | await hideNotification(); 39 | try { 40 | await hideNotification(); 41 | } catch (e) { 42 | fail('threw on second call to [hideNotification]'); 43 | } 44 | }, 45 | ); 46 | } 47 | -------------------------------------------------------------------------------- /example/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 that Flutter provides. 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:examplee/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(MyApp()); 17 | 18 | // // Verify that our counter starts at 0. 19 | // expect(find.text('0'), findsOneWidget); 20 | // expect(find.text('1'), findsNothing); 21 | 22 | // // Tap the '+' icon and trigger a frame. 23 | // await tester.tap(find.byIcon(Icons.add)); 24 | // await tester.pump(); 25 | 26 | // // Verify that our counter has incremented. 27 | // expect(find.text('0'), findsNothing); 28 | // expect(find.text('1'), findsOneWidget); 29 | // }); 30 | // } 31 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.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 | -------------------------------------------------------------------------------- /example/lib/dialogs/test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import 'dialogs.dart'; 4 | 5 | void main() => runApp(MaterialApp(home: DialogTest())); 6 | 7 | class DialogTest extends StatefulWidget { 8 | @override 9 | _DialogTestState createState() => _DialogTestState(); 10 | } 11 | 12 | class _DialogTestState extends State { 13 | Widget dialog = SizedBox(); 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | return Scaffold( 18 | body: Stack( 19 | children: [ 20 | Positioned( 21 | top: 50.0, 22 | left: 50.0, 23 | child: InkWell( 24 | child: Text('show about dialog'), 25 | onTap: () { 26 | showDialog(); 27 | }, 28 | ), 29 | ), 30 | Center( 31 | child: dialog, 32 | ) 33 | ], 34 | ), 35 | ); 36 | } 37 | 38 | showDialog() { 39 | setState(() { 40 | dialog = AnimatedAboutDialog( 41 | title: Text('AlertDialog Title'), 42 | content: SingleChildScrollView( 43 | child: ListBody( 44 | children: [ 45 | Text('This is a demo alert dialog.'), 46 | Text('Would you like to approve of this message?'), 47 | ], 48 | ), 49 | ), 50 | actions: [ 51 | TextButton( 52 | child: Text('Approve'), 53 | onPressed: () { 54 | Navigator.of(context).pop(); 55 | }, 56 | ), 57 | ], 58 | ); 59 | }); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /example/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | examplee 30 | 31 | 32 | 33 | 36 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | examplee 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: ots 2 | description: A package for showing loading indicators, notifications, dialogs, internet connectivity updates, Over the Screen easily. 3 | version: 1.0.0 4 | # author: Fayaz 5 | homepage: https://github.com/fayaz07/ots 6 | 7 | environment: 8 | sdk: '>=3.0.0' 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | 14 | connectivity_plus: ^6.0.5 15 | 16 | dev_dependencies: 17 | flutter_test: 18 | sdk: flutter 19 | 20 | # For information on the generic Dart part of this file, see the 21 | # following page: https://dart.dev/tools/pub/pubspec 22 | 23 | # The following section is specific to Flutter. 24 | flutter: 25 | 26 | # To add assets to your package, add an assets section, like this: 27 | assets: 28 | - assets/ 29 | # - images/a_dot_burr.jpeg 30 | # - images/a_dot_ham.jpeg 31 | # 32 | # For details regarding assets in packages, see 33 | # https://flutter.dev/assets-and-images/#from-packages 34 | # 35 | # An image asset can refer to one or more resolution-specific "variants", see 36 | # https://flutter.dev/assets-and-images/#resolution-aware. 37 | 38 | # To add custom fonts to your package, add a fonts section here, 39 | # in this "flutter" section. Each entry in this list should have a 40 | # "family" key with the font family name, and a "fonts" key with a 41 | # list giving the asset and other descriptors for the font. For 42 | # example: 43 | # fonts: 44 | # - family: Schyler 45 | # fonts: 46 | # - asset: fonts/Schyler-Regular.ttf 47 | # - asset: fonts/Schyler-Italic.ttf 48 | # style: italic 49 | # - family: Trajan Pro 50 | # fonts: 51 | # - asset: fonts/TrajanPro.ttf 52 | # - asset: fonts/TrajanPro_Bold.ttf 53 | # weight: 700 54 | # 55 | # For details regarding fonts in packages, see 56 | # https://flutter.dev/custom-fonts/#from-packages 57 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | build/ 32 | 33 | # Android related 34 | **/android/**/gradle-wrapper.jar 35 | **/android/.gradle 36 | **/android/captures/ 37 | **/android/gradlew 38 | **/android/gradlew.bat 39 | **/android/local.properties 40 | **/android/**/GeneratedPluginRegistrant.java 41 | 42 | # iOS/XCode related 43 | **/ios/**/*.mode1v3 44 | **/ios/**/*.mode2v3 45 | **/ios/**/*.moved-aside 46 | **/ios/**/*.pbxuser 47 | **/ios/**/*.perspectivev3 48 | **/ios/**/*sync/ 49 | **/ios/**/.sconsign.dblite 50 | **/ios/**/.tags* 51 | **/ios/**/.vagrant/ 52 | **/ios/**/DerivedData/ 53 | **/ios/**/Icon? 54 | **/ios/**/Pods/ 55 | **/ios/**/.symlinks/ 56 | **/ios/**/profile 57 | **/ios/**/xcuserdata 58 | **/ios/.generated/ 59 | **/ios/Flutter/App.framework 60 | **/ios/Flutter/Flutter.framework 61 | **/ios/Flutter/Flutter.podspec 62 | **/ios/Flutter/Generated.xcconfig 63 | **/ios/Flutter/app.flx 64 | **/ios/Flutter/app.zip 65 | **/ios/Flutter/flutter_assets/ 66 | **/ios/Flutter/flutter_export_environment.sh 67 | **/ios/ServiceDefinitions.json 68 | **/ios/Runner/GeneratedPluginRegistrant.* 69 | 70 | # Exceptions to above rules. 71 | !**/ios/**/default.mode1v3 72 | !**/ios/**/default.mode2v3 73 | !**/ios/**/default.pbxuser 74 | !**/ios/**/default.perspectivev3 75 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 76 | 77 | !.idea/ 78 | 79 | .idea -------------------------------------------------------------------------------- /example/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 30 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | defaultConfig { 36 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 37 | applicationId "com.example.examplee" 38 | minSdkVersion 16 39 | targetSdkVersion 30 40 | versionCode flutterVersionCode.toInteger() 41 | versionName flutterVersionName 42 | } 43 | 44 | buildTypes { 45 | release { 46 | // TODO: Add your own signing config for the release build. 47 | // Signing with the debug keys for now, so `flutter run --release` works. 48 | signingConfig signingConfigs.debug 49 | } 50 | } 51 | } 52 | 53 | flutter { 54 | source '../..' 55 | } 56 | 57 | dependencies { 58 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 59 | } 60 | -------------------------------------------------------------------------------- /.all-contributorsrc: -------------------------------------------------------------------------------- 1 | { 2 | "files": [ 3 | "README.md" 4 | ], 5 | "imageSize": 100, 6 | "commit": false, 7 | "contributors": [ 8 | { 9 | "login": "fayaz07", 10 | "name": "Mohammad Fayaz", 11 | "avatar_url": "https://avatars0.githubusercontent.com/u/35001172?v=4", 12 | "profile": "http://fayaz07.me", 13 | "contributions": [ 14 | "code", 15 | "content", 16 | "doc", 17 | "example", 18 | "ideas", 19 | "maintenance" 20 | ] 21 | }, 22 | { 23 | "login": "alexandradeas", 24 | "name": "Alex Deas", 25 | "avatar_url": "https://avatars0.githubusercontent.com/u/12813479?v=4", 26 | "profile": "https://github.com/alexandradeas", 27 | "contributions": [ 28 | "code" 29 | ] 30 | }, 31 | { 32 | "login": "pranathireddyk", 33 | "name": "Pranathi Reddy", 34 | "avatar_url": "https://avatars.githubusercontent.com/u/34978536?v=4", 35 | "profile": "https://github.com/pranathireddyk", 36 | "contributions": [ 37 | "code" 38 | ] 39 | }, 40 | { 41 | "login": "asterd", 42 | "name": "Aster", 43 | "avatar_url": "https://avatars.githubusercontent.com/u/734776?v=4", 44 | "profile": "https://github.com/asterd", 45 | "contributions": [ 46 | "code" 47 | ] 48 | }, 49 | { 50 | "login": "lscbot", 51 | "name": "lscbot", 52 | "avatar_url": "https://avatars.githubusercontent.com/u/88408208?v=4", 53 | "profile": "https://lscbot.com", 54 | "contributions": [ 55 | "code" 56 | ] 57 | }, 58 | { 59 | "login": "toniremi", 60 | "name": "Antoni Remeseiro Alfonso", 61 | "avatar_url": "https://avatars.githubusercontent.com/u/1259874?v=4", 62 | "profile": "https://github.com/toniremi", 63 | "contributions": [ 64 | "code" 65 | ] 66 | } 67 | ], 68 | "contributorsPerLine": 7, 69 | "projectName": "ots", 70 | "projectOwner": "fayaz07", 71 | "repoType": "github", 72 | "repoHost": "https://github.com", 73 | "skipCi": true 74 | } 75 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 13 | 17 | 21 | 26 | 30 | 31 | 32 | 33 | 34 | 35 | 37 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /lib/toast/widgets/normal.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:ots/toast/anim_duration.dart'; 3 | import 'package:ots/toast/colors.dart'; 4 | import 'package:ots/toast/length.dart'; 5 | import 'package:ots/toast/text_styles.dart'; 6 | 7 | class DefaultToast extends StatefulWidget { 8 | final Color? backgroundColor; 9 | final TextStyle? textStyle; 10 | final String message; 11 | final int duration; 12 | final VoidCallback? onToasted; 13 | 14 | const DefaultToast( 15 | {Key? key, 16 | this.backgroundColor = ToastColors.defaultToastBGColor, 17 | this.textStyle = ToastTextStyle.defaultTextStyle, 18 | this.message = " ", 19 | this.duration = ToastLength.short, 20 | this.onToasted}) 21 | : super(key: key); 22 | 23 | @override 24 | _DefaultToastState createState() => _DefaultToastState(); 25 | } 26 | 27 | class _DefaultToastState extends State 28 | with SingleTickerProviderStateMixin { 29 | late Animation _fadeAnimation; 30 | late AnimationController _fadeController; 31 | 32 | @override 33 | void initState() { 34 | super.initState(); 35 | _fadeController = AnimationController( 36 | duration: ToastAnimDuration.defaultAnimDuration, vsync: this); 37 | _fadeAnimation = Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( 38 | curve: Curves.easeInCirc, 39 | reverseCurve: Curves.easeOutCirc, 40 | parent: _fadeController)); 41 | 42 | _initAnimation(); 43 | } 44 | 45 | void _initAnimation() async { 46 | _fadeController.forward(); 47 | await Future.delayed(Duration(milliseconds: widget.duration)); 48 | _fadeController.reverse(); 49 | if (widget.onToasted != null) widget.onToasted!(); 50 | } 51 | 52 | @override 53 | void dispose() { 54 | _fadeController.dispose(); 55 | super.dispose(); 56 | } 57 | 58 | @override 59 | Widget build(BuildContext context) { 60 | return FadeTransition( 61 | opacity: _fadeAnimation, 62 | child: Material( 63 | shape: 64 | RoundedRectangleBorder(borderRadius: BorderRadius.circular(32.0)), 65 | color: widget.backgroundColor, 66 | shadowColor: Colors.grey, 67 | child: Padding( 68 | padding: const EdgeInsets.symmetric(horizontal: 32.0, vertical: 12.0), 69 | child: Text( 70 | widget.message, 71 | textAlign: TextAlign.center, 72 | style: widget.textStyle, 73 | ), 74 | ), 75 | ), 76 | ); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /lib/toast/widgets/info.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:ots/toast/anim_duration.dart'; 3 | import 'package:ots/toast/colors.dart'; 4 | import 'package:ots/toast/length.dart'; 5 | import 'package:ots/toast/text_styles.dart'; 6 | 7 | class InfoToast extends StatefulWidget { 8 | final Color? backgroundColor; 9 | final TextStyle? textStyle; 10 | final String message; 11 | final int duration; 12 | final VoidCallback? onToasted; 13 | 14 | const InfoToast( 15 | {Key? key, 16 | this.backgroundColor = ToastColors.infoToastBGColor, 17 | this.textStyle = ToastTextStyle.defaultTextStyle, 18 | this.message = " ", 19 | this.duration = ToastLength.short, 20 | this.onToasted}) 21 | : super(key: key); 22 | 23 | @override 24 | _InfoToastState createState() => _InfoToastState(); 25 | } 26 | 27 | class _InfoToastState extends State 28 | with SingleTickerProviderStateMixin { 29 | late Animation _fadeAnimation; 30 | late AnimationController _fadeController; 31 | 32 | @override 33 | void initState() { 34 | super.initState(); 35 | _fadeController = AnimationController( 36 | duration: ToastAnimDuration.defaultAnimDuration, vsync: this); 37 | _fadeAnimation = Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( 38 | curve: Curves.easeInCirc, 39 | reverseCurve: Curves.easeOutCirc, 40 | parent: _fadeController)); 41 | 42 | _initAnimation(); 43 | } 44 | 45 | void _initAnimation() async { 46 | _fadeController.forward(); 47 | await Future.delayed(Duration(milliseconds: widget.duration)); 48 | _fadeController.reverse(); 49 | if (widget.onToasted != null) widget.onToasted!(); 50 | } 51 | 52 | @override 53 | void dispose() { 54 | _fadeController.dispose(); 55 | super.dispose(); 56 | } 57 | 58 | @override 59 | Widget build(BuildContext context) { 60 | return FadeTransition( 61 | opacity: _fadeAnimation, 62 | child: Material( 63 | shape: 64 | RoundedRectangleBorder(borderRadius: BorderRadius.circular(32.0)), 65 | color: widget.backgroundColor, 66 | shadowColor: Colors.grey, 67 | child: Padding( 68 | padding: const EdgeInsets.symmetric(horizontal: 32.0, vertical: 12.0), 69 | child: Row( 70 | mainAxisSize: MainAxisSize.min, 71 | children: [ 72 | Icon( 73 | Icons.info, 74 | color: Colors.white, 75 | ), 76 | SizedBox(width: 8.0), 77 | Flexible( 78 | child: Text( 79 | widget.message, 80 | textAlign: TextAlign.center, 81 | style: widget.textStyle, 82 | ), 83 | ), 84 | ], 85 | ), 86 | ), 87 | ), 88 | ); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /lib/toast/widgets/error.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:ots/toast/anim_duration.dart'; 3 | import 'package:ots/toast/colors.dart'; 4 | import 'package:ots/toast/length.dart'; 5 | import 'package:ots/toast/text_styles.dart'; 6 | 7 | class ErrorToast extends StatefulWidget { 8 | final Color? backgroundColor; 9 | final TextStyle? textStyle; 10 | final String message; 11 | final int duration; 12 | final VoidCallback? onToasted; 13 | 14 | const ErrorToast( 15 | {Key? key, 16 | this.backgroundColor = ToastColors.errorToastBGColor, 17 | this.textStyle = ToastTextStyle.defaultTextStyle, 18 | this.message = " ", 19 | this.duration = ToastLength.short, 20 | this.onToasted}) 21 | : super(key: key); 22 | 23 | @override 24 | _ErrorToastState createState() => _ErrorToastState(); 25 | } 26 | 27 | class _ErrorToastState extends State 28 | with SingleTickerProviderStateMixin { 29 | late Animation _fadeAnimation; 30 | late AnimationController _fadeController; 31 | 32 | @override 33 | void initState() { 34 | super.initState(); 35 | _fadeController = AnimationController( 36 | duration: ToastAnimDuration.defaultAnimDuration, vsync: this); 37 | _fadeAnimation = Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( 38 | curve: Curves.easeInCirc, 39 | reverseCurve: Curves.easeOutCirc, 40 | parent: _fadeController)); 41 | 42 | _initAnimation(); 43 | } 44 | 45 | void _initAnimation() async { 46 | _fadeController.forward(); 47 | await Future.delayed(Duration(milliseconds: widget.duration)); 48 | _fadeController.reverse(); 49 | if (widget.onToasted != null) widget.onToasted!(); 50 | } 51 | 52 | @override 53 | void dispose() { 54 | _fadeController.dispose(); 55 | super.dispose(); 56 | } 57 | 58 | @override 59 | Widget build(BuildContext context) { 60 | return FadeTransition( 61 | opacity: _fadeAnimation, 62 | child: Material( 63 | shape: 64 | RoundedRectangleBorder(borderRadius: BorderRadius.circular(32.0)), 65 | color: widget.backgroundColor, 66 | shadowColor: Colors.grey, 67 | child: Padding( 68 | padding: const EdgeInsets.symmetric(horizontal: 32.0, vertical: 12.0), 69 | child: Row( 70 | mainAxisSize: MainAxisSize.min, 71 | children: [ 72 | Icon( 73 | Icons.error, 74 | color: Colors.white, 75 | ), 76 | SizedBox(width: 8.0), 77 | Flexible( 78 | child: Text( 79 | widget.message, 80 | textAlign: TextAlign.center, 81 | style: widget.textStyle, 82 | ), 83 | ), 84 | ], 85 | ), 86 | ), 87 | ), 88 | ); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /lib/toast/widgets/warning.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:ots/toast/anim_duration.dart'; 3 | import 'package:ots/toast/colors.dart'; 4 | import 'package:ots/toast/length.dart'; 5 | import 'package:ots/toast/text_styles.dart'; 6 | 7 | class WarningToast extends StatefulWidget { 8 | final Color? backgroundColor; 9 | final TextStyle? textStyle; 10 | final String message; 11 | final int duration; 12 | final VoidCallback? onToasted; 13 | 14 | const WarningToast( 15 | {Key? key, 16 | this.backgroundColor = ToastColors.warningToastBGColor, 17 | this.textStyle = ToastTextStyle.defaultTextStyle, 18 | this.message = " ", 19 | this.duration = ToastLength.short, 20 | this.onToasted}) 21 | : super(key: key); 22 | 23 | @override 24 | _WarningToastState createState() => _WarningToastState(); 25 | } 26 | 27 | class _WarningToastState extends State 28 | with SingleTickerProviderStateMixin { 29 | late Animation _fadeAnimation; 30 | late AnimationController _fadeController; 31 | 32 | @override 33 | void initState() { 34 | super.initState(); 35 | _fadeController = AnimationController( 36 | duration: ToastAnimDuration.defaultAnimDuration, vsync: this); 37 | _fadeAnimation = Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( 38 | curve: Curves.easeInCirc, 39 | reverseCurve: Curves.easeOutCirc, 40 | parent: _fadeController)); 41 | 42 | _initAnimation(); 43 | } 44 | 45 | void _initAnimation() async { 46 | _fadeController.forward(); 47 | await Future.delayed(Duration(milliseconds: widget.duration)); 48 | _fadeController.reverse(); 49 | if (widget.onToasted != null) widget.onToasted!(); 50 | } 51 | 52 | @override 53 | void dispose() { 54 | _fadeController.dispose(); 55 | super.dispose(); 56 | } 57 | 58 | @override 59 | Widget build(BuildContext context) { 60 | return FadeTransition( 61 | opacity: _fadeAnimation, 62 | child: Material( 63 | shape: 64 | RoundedRectangleBorder(borderRadius: BorderRadius.circular(32.0)), 65 | color: widget.backgroundColor, 66 | shadowColor: Colors.grey, 67 | child: Padding( 68 | padding: const EdgeInsets.symmetric(horizontal: 32.0, vertical: 12.0), 69 | child: Row( 70 | mainAxisSize: MainAxisSize.min, 71 | children: [ 72 | Icon( 73 | Icons.warning, 74 | color: Colors.white, 75 | ), 76 | SizedBox(width: 8.0), 77 | Flexible( 78 | child: Text( 79 | widget.message, 80 | textAlign: TextAlign.center, 81 | style: widget.textStyle, 82 | ), 83 | ), 84 | ], 85 | ), 86 | ), 87 | ), 88 | ); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /lib/toast/widgets/success.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:ots/toast/anim_duration.dart'; 3 | import 'package:ots/toast/colors.dart'; 4 | import 'package:ots/toast/length.dart'; 5 | import 'package:ots/toast/text_styles.dart'; 6 | 7 | class SuccessToast extends StatefulWidget { 8 | final Color? backgroundColor; 9 | final TextStyle? textStyle; 10 | final String message; 11 | final int duration; 12 | final VoidCallback? onToasted; 13 | 14 | const SuccessToast( 15 | {Key? key, 16 | this.backgroundColor = ToastColors.successToastBGColor, 17 | this.textStyle = ToastTextStyle.defaultTextStyle, 18 | this.message = " ", 19 | this.duration = ToastLength.short, 20 | this.onToasted}) 21 | : super(key: key); 22 | 23 | @override 24 | _SuccessToastState createState() => _SuccessToastState(); 25 | } 26 | 27 | class _SuccessToastState extends State 28 | with SingleTickerProviderStateMixin { 29 | late Animation _fadeAnimation; 30 | late AnimationController _fadeController; 31 | 32 | @override 33 | void initState() { 34 | super.initState(); 35 | _fadeController = AnimationController( 36 | duration: ToastAnimDuration.defaultAnimDuration, vsync: this); 37 | _fadeAnimation = Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( 38 | curve: Curves.easeInCirc, 39 | reverseCurve: Curves.easeOutCirc, 40 | parent: _fadeController)); 41 | 42 | _initAnimation(); 43 | } 44 | 45 | void _initAnimation() async { 46 | _fadeController.forward(); 47 | await Future.delayed(Duration(milliseconds: widget.duration)); 48 | _fadeController.reverse(); 49 | if (widget.onToasted != null) widget.onToasted!(); 50 | } 51 | 52 | @override 53 | void dispose() { 54 | _fadeController.dispose(); 55 | super.dispose(); 56 | } 57 | 58 | @override 59 | Widget build(BuildContext context) { 60 | return FadeTransition( 61 | opacity: _fadeAnimation, 62 | child: Material( 63 | shape: 64 | RoundedRectangleBorder(borderRadius: BorderRadius.circular(32.0)), 65 | color: widget.backgroundColor, 66 | shadowColor: Colors.grey, 67 | child: Padding( 68 | padding: const EdgeInsets.symmetric(horizontal: 32.0, vertical: 12.0), 69 | child: Row( 70 | mainAxisSize: MainAxisSize.min, 71 | children: [ 72 | Icon( 73 | Icons.check_circle, 74 | color: Colors.white, 75 | ), 76 | SizedBox(width: 8.0), 77 | Flexible( 78 | child: Text( 79 | widget.message, 80 | textAlign: TextAlign.center, 81 | style: widget.textStyle, 82 | ), 83 | ), 84 | ], 85 | ), 86 | ), 87 | ), 88 | ); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | description: A new Flutter project. 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `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: ">=3.0.0" 22 | 23 | dependencies: 24 | flutter: 25 | sdk: flutter 26 | 27 | 28 | # The following adds the Cupertino Icons font to your application. 29 | # Use with the CupertinoIcons class for iOS style icons. 30 | cupertino_icons: ^1.0.2 31 | ots: 32 | path: ../ 33 | 34 | dev_dependencies: 35 | flutter_test: 36 | sdk: flutter 37 | 38 | # For information on the generic Dart part of this file, see the 39 | # following page: https://dart.dev/tools/pub/pubspec 40 | 41 | # The following section is specific to Flutter. 42 | flutter: 43 | 44 | # The following line ensures that the Material Icons font is 45 | # included with your application, so that you can use the icons in 46 | # the material Icons class. 47 | uses-material-design: true 48 | 49 | # To add assets to your application, add an assets section, like this: 50 | # assets: 51 | # - images/a_dot_burr.jpeg 52 | # - images/a_dot_ham.jpeg 53 | 54 | # An image asset can refer to one or more resolution-specific "variants", see 55 | # https://flutter.dev/assets-and-images/#resolution-aware. 56 | 57 | # For details regarding adding assets from package dependencies, see 58 | # https://flutter.dev/assets-and-images/#from-packages 59 | 60 | # To add custom fonts to your application, add a fonts section here, 61 | # in this "flutter" section. Each entry in this list should have a 62 | # "family" key with the font family name, and a "fonts" key with a 63 | # list giving the asset and other descriptors for the font. For 64 | # example: 65 | # fonts: 66 | # - family: Schyler 67 | # fonts: 68 | # - asset: fonts/Schyler-Regular.ttf 69 | # - asset: fonts/Schyler-Italic.ttf 70 | # style: italic 71 | # - family: Trajan Pro 72 | # fonts: 73 | # - asset: fonts/TrajanPro.ttf 74 | # - asset: fonts/TrajanPro_Bold.ttf 75 | # weight: 700 76 | # 77 | # For details regarding fonts from package dependencies, 78 | # see https://flutter.dev/custom-fonts/#from-packages 79 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/lib/dialogs/dialogs.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:flutter/cupertino.dart'; 4 | import 'package:flutter/material.dart'; 5 | 6 | const Duration _dialogDuration = Duration(milliseconds: 100); 7 | const Curve _animCurve = Curves.linear; 8 | 9 | class AnimatedAboutDialog extends StatefulWidget { 10 | final Widget? title, content; 11 | final List? actions; 12 | final ScrollController? actionScrollController, scrollController; 13 | final Curve? insetAnimationCurve; 14 | final Duration? insetAnimationDuration; 15 | final VoidCallback? dismiss; 16 | 17 | const AnimatedAboutDialog({ 18 | super.key, 19 | this.title, 20 | this.content, 21 | this.actions, 22 | this.actionScrollController, 23 | this.scrollController, 24 | this.insetAnimationCurve, 25 | this.insetAnimationDuration, 26 | this.dismiss, 27 | }); 28 | 29 | @override 30 | _AnimatedAboutDialogState createState() => _AnimatedAboutDialogState(); 31 | } 32 | 33 | class _AnimatedAboutDialogState extends State 34 | with SingleTickerProviderStateMixin { 35 | late Animation _scale; 36 | late AnimationController _controller; 37 | 38 | @override 39 | void initState() { 40 | _controller = AnimationController( 41 | vsync: this, 42 | duration: _dialogDuration, 43 | animationBehavior: AnimationBehavior.normal, 44 | ); 45 | _scale = Tween(begin: 0.3, end: 1.0).animate( 46 | CurvedAnimation( 47 | parent: _controller, 48 | curve: _animCurve, 49 | reverseCurve: _animCurve, 50 | ), 51 | ); 52 | super.initState(); 53 | _controller.forward(); 54 | 55 | // widget.dismiss. 56 | } 57 | 58 | @override 59 | Widget build(BuildContext context) { 60 | return ScaleTransition( 61 | scale: _scale, 62 | alignment: Alignment.center, 63 | child: _getChild(), 64 | ); 65 | } 66 | 67 | Widget _getChild() { 68 | switch (Platform.operatingSystem) { 69 | case "ios": 70 | return CupertinoAlertDialog( 71 | key: UniqueKey(), 72 | title: widget.title, 73 | content: widget.content, 74 | actions: widget.actions ?? [], 75 | actionScrollController: widget.actionScrollController, 76 | insetAnimationCurve: widget.insetAnimationCurve ?? _animCurve, 77 | insetAnimationDuration: widget.insetAnimationDuration ?? _dialogDuration, 78 | scrollController: widget.scrollController, 79 | ); 80 | // case "linux": 81 | // 82 | // /// todo: linux about dialog implementation 83 | // case "macos": 84 | // 85 | // /// todo: macos about dialog implementation 86 | // case "windows": 87 | // 88 | // /// todo: windows about dialog implementation 89 | // case "fuchsia": 90 | // 91 | // /// todo: fuchsia about dialog implementation 92 | case "android": 93 | default: 94 | return AlertDialog( 95 | key: UniqueKey(), 96 | title: widget.title, 97 | content: widget.content, 98 | actions: widget.actions, 99 | ); 100 | } 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /lib/widgets/notification.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:ots/utils/styles.dart'; 3 | 4 | NotificationWidgetState? _instance; 5 | 6 | class NotificationWidget extends StatefulWidget { 7 | final int? duration; 8 | final int? animDuration; 9 | final bool? autoDismissible; 10 | final VoidCallback? disposeOverlay; 11 | final String? title; 12 | final String? message; 13 | final TextStyle? messageStyle; 14 | final TextStyle? titleStyle; 15 | final Color? backgroundColor; 16 | 17 | const NotificationWidget( 18 | {Key? key, 19 | this.duration = 2000, 20 | this.autoDismissible = true, 21 | this.disposeOverlay, 22 | this.message, 23 | this.messageStyle, 24 | this.titleStyle, 25 | this.backgroundColor = Colors.black, 26 | this.title = "Notification", 27 | this.animDuration = 400}) 28 | : super(key: key); 29 | 30 | NotificationWidgetState get() { 31 | if (_instance == null) { 32 | _instance = NotificationWidgetState(); 33 | } 34 | return _instance!; 35 | } 36 | 37 | void close() { 38 | get().close(); 39 | } 40 | 41 | @override 42 | NotificationWidgetState createState() => get(); 43 | } 44 | 45 | class NotificationWidgetState extends State 46 | with SingleTickerProviderStateMixin { 47 | late Animation _animation; 48 | late AnimationController _animationController; 49 | 50 | void close() async { 51 | try { 52 | if (mounted) { 53 | await _animationController.reverse(); 54 | _callDispose(); 55 | } 56 | } catch (err) { 57 | debugPrint('''NotificationWidget dispose error'''); 58 | throw err; 59 | } 60 | } 61 | 62 | @override 63 | void initState() { 64 | _animationController = AnimationController( 65 | vsync: this, 66 | duration: Duration(milliseconds: widget.animDuration ?? 400)); 67 | _animation = Tween(begin: -0.3, end: 0.075).animate( 68 | CurvedAnimation( 69 | curve: Curves.linear, 70 | parent: _animationController, 71 | ), 72 | ); 73 | 74 | _animationController.forward(); 75 | _reverse(); 76 | super.initState(); 77 | } 78 | 79 | _reverse() async { 80 | if (widget.autoDismissible!) { 81 | try { 82 | await Future.delayed(Duration(milliseconds: widget.duration ?? 2000)); 83 | if (mounted) { 84 | await _animationController.reverse(); 85 | _callDispose(); 86 | } 87 | } catch (err) { 88 | debugPrint('''NotificationWidget dispose error'''); 89 | throw err; 90 | } 91 | } 92 | } 93 | 94 | _callDispose() { 95 | if (widget.disposeOverlay != null) widget.disposeOverlay!(); 96 | } 97 | 98 | @override 99 | void dispose() { 100 | _animationController.dispose(); 101 | super.dispose(); 102 | _instance = null; 103 | } 104 | 105 | @override 106 | Widget build(BuildContext context) { 107 | final height = MediaQuery.of(context).size.height; 108 | return Dismissible( 109 | key: Key('dismissible_child_notification_overlay'), 110 | onDismissed: (DismissDirection direction) => _callDispose(), 111 | direction: DismissDirection.horizontal, 112 | confirmDismiss: (d) => Future.value(true), 113 | child: AnimatedBuilder( 114 | animation: _animation, 115 | builder: (context, child) => Transform( 116 | transform: 117 | Matrix4.translationValues(0.0, _animation.value * height, 0.0), 118 | child: Material( 119 | elevation: 4.0, 120 | shape: RoundedRectangleBorder( 121 | borderRadius: BorderRadius.circular(8.0)), 122 | color: widget.backgroundColor, 123 | child: Padding( 124 | padding: const EdgeInsets.all(16.0), 125 | child: Column( 126 | mainAxisSize: MainAxisSize.min, 127 | crossAxisAlignment: CrossAxisAlignment.start, 128 | children: [ 129 | Text( 130 | widget.title!, 131 | style: widget.titleStyle ?? TextStyles.titleStyle, 132 | ), 133 | SizedBox(height: 8.0), 134 | Text( 135 | widget.message!, 136 | style: widget.messageStyle ?? TextStyles.bodyStyle, 137 | ), 138 | ], 139 | ), 140 | ), 141 | ), 142 | ), 143 | ), 144 | ); 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /lib/widgets/network_state.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:ots/utils/styles.dart'; 3 | 4 | class NetworkWidget extends StatefulWidget { 5 | final VoidCallback? disposeOverlay; 6 | final NetworkState? state; 7 | final NetworkStateMessenger? messenger; 8 | final bool persistNotification; 9 | 10 | const NetworkWidget({ 11 | Key? key, 12 | this.disposeOverlay, 13 | this.state, 14 | this.messenger = const NetworkStateDefaultMessage(), 15 | this.persistNotification = false 16 | }) : super(key: key); 17 | 18 | @override 19 | _NetworkWidgetState createState() => _NetworkWidgetState(); 20 | } 21 | 22 | class _NetworkWidgetState extends State with SingleTickerProviderStateMixin { 23 | late Animation _animation; 24 | late AnimationController _animationController; 25 | 26 | @override 27 | void initState() { 28 | _animationController = 29 | AnimationController(vsync: this, duration: Duration(milliseconds: 200)); 30 | _animation = Tween(begin: -0.1, end: 0.0).animate( 31 | CurvedAnimation( 32 | curve: Curves.linear, 33 | parent: _animationController, 34 | ), 35 | ); 36 | 37 | _animationController.forward(); 38 | _reverse(); 39 | super.initState(); 40 | } 41 | 42 | _reverse() async { 43 | if (widget.state == NetworkState.Disconnected && widget.persistNotification) { 44 | debugPrint('Persisting NoInternet NetworkStatusWidget'); 45 | } else { 46 | try { 47 | await Future.delayed(Duration(milliseconds: 2000)); 48 | if (mounted) { 49 | await _animationController.reverse(); 50 | _callDispose(); 51 | } 52 | } catch (err) { 53 | debugPrint('''NetworkStatusWidget dispose error'''); 54 | throw err; 55 | } 56 | } 57 | } 58 | 59 | _callDispose() { 60 | if (widget.disposeOverlay != null) widget.disposeOverlay!(); 61 | } 62 | 63 | @override 64 | void dispose() { 65 | _animationController.dispose(); 66 | super.dispose(); 67 | } 68 | 69 | @override 70 | Widget build(BuildContext context) { 71 | final height = MediaQuery.of(context).size.height; 72 | return AnimatedBuilder( 73 | animation: _animation, 74 | builder: (context, child) => Transform( 75 | transform: Matrix4.translationValues(0.0, -_animation.value * height, 0.0), 76 | child: Material( 77 | color: widget.messenger!.color(widget.state), // widget.state.color, 78 | child: Center( 79 | child: Text( 80 | widget.messenger!.message(widget.state), // widget.state.message, 81 | style: TextStyles.networkStatusStyle, 82 | ), 83 | ), 84 | ), 85 | ), 86 | ); 87 | } 88 | } 89 | 90 | enum NetworkState { Connected, Disconnected, Weak } 91 | 92 | abstract class NetworkStateMessenger { 93 | const NetworkStateMessenger(); 94 | 95 | String message(NetworkState? networkState); 96 | Color color(NetworkState? networkState); 97 | } 98 | 99 | class NetworkStateDefaultMessage extends NetworkStateMessenger { 100 | const NetworkStateDefaultMessage(); 101 | 102 | String message(NetworkState? networkState) { 103 | switch (networkState) { 104 | case NetworkState.Connected: 105 | return "Connected to internet"; 106 | case NetworkState.Disconnected: 107 | return "No internet connection"; 108 | case NetworkState.Weak: 109 | return "Internet may not be available"; 110 | default: 111 | return "Unknown internet status"; 112 | } 113 | } 114 | 115 | Color color(NetworkState? networkState) { 116 | switch (networkState) { 117 | case NetworkState.Connected: 118 | return Colors.green; 119 | case NetworkState.Disconnected: 120 | return Colors.red; 121 | case NetworkState.Weak: 122 | return Colors.orange; 123 | default: 124 | return Colors.orange; 125 | } 126 | } 127 | } 128 | 129 | // extension NetworkStateMessage on NetworkState? { 130 | // String get message { 131 | // switch (this) { 132 | // case NetworkState.Connected: 133 | // return "Connected to internet"; 134 | // case NetworkState.Disconnected: 135 | // return "No internet connection"; 136 | // case NetworkState.Weak: 137 | // return "Internet may not be available"; 138 | // default: 139 | // return "Unknown internet status"; 140 | // } 141 | // } 142 | // 143 | // Color get color { 144 | // switch (this) { 145 | // case NetworkState.Connected: 146 | // return Colors.green; 147 | // case NetworkState.Disconnected: 148 | // return Colors.red; 149 | // case NetworkState.Weak: 150 | // return Colors.orange; 151 | // default: 152 | // return Colors.orange; 153 | // } 154 | // } 155 | // } -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:ots/ots.dart'; 4 | import 'package:ots/widgets/notification.dart'; 5 | 6 | void main() => runApp( 7 | MyApp(), 8 | ); 9 | 10 | class MyApp extends StatelessWidget { 11 | @override 12 | Widget build(BuildContext context) { 13 | return OTS( 14 | showNetworkUpdates: true, 15 | persistNoInternetNotification: false, 16 | bottomInternetNotificationPadding: 16.0, 17 | /// pass your custom loader here 18 | // loader: CircularProgressIndicator( 19 | // valueColor: AlwaysStoppedAnimation(Colors.red), 20 | // ), 21 | // child: MaterialApp( 22 | // title: 'OTS Test', 23 | // home: Home(), 24 | // ), 25 | child: CupertinoApp( 26 | title: 'OTS Test', 27 | home: Home(), 28 | ), 29 | ); 30 | } 31 | } 32 | 33 | final textStyle = TextStyle(color: Colors.white); 34 | final headerStyle = TextStyle(color: Colors.black, fontSize: 18.0); 35 | 36 | class Home extends StatefulWidget { 37 | @override 38 | _HomeState createState() => _HomeState(); 39 | } 40 | 41 | class _HomeState extends State { 42 | 43 | NotificationWidgetState? instance; 44 | 45 | Widget notifications(){ 46 | return Wrap( 47 | direction: Axis.horizontal, 48 | runSpacing: 8.0, 49 | spacing: 8.0, 50 | children: [ 51 | Row( 52 | children: [ 53 | Expanded(child: Text("Notifications demo", style: headerStyle,)), 54 | ], 55 | ), 56 | ElevatedButton( 57 | child: Text('Success', style: textStyle), 58 | style: ButtonStyle( 59 | backgroundColor: WidgetStateProperty.all(Colors.green) 60 | ), 61 | onPressed: () { 62 | showNotification( 63 | message: 'Hello, this is success notification', 64 | title: 'Success', 65 | backgroundColor: Colors.green, 66 | autoDismissible: true, 67 | notificationDuration: 2500, 68 | ); 69 | }, 70 | ), 71 | ElevatedButton( 72 | child: Text('Error', style: textStyle), 73 | style: ButtonStyle( 74 | backgroundColor: WidgetStateProperty.all(Colors.red) 75 | ), 76 | onPressed: () { 77 | showNotification( 78 | message: 'Hello, this is error notification', 79 | title: 'Error', 80 | backgroundColor: Colors.red, 81 | autoDismissible: true, 82 | notificationDuration: 2500, 83 | ); 84 | }, 85 | ), 86 | ElevatedButton( 87 | child: Text('Warning', style: textStyle), 88 | style: ButtonStyle( 89 | backgroundColor: WidgetStateProperty.all(Colors.orange) 90 | ), 91 | onPressed: () { 92 | showNotification( 93 | message: 'Hello, this is warning notification', 94 | title: 'Warning', 95 | backgroundColor: Colors.orange, 96 | autoDismissible: true, 97 | notificationDuration: 2500, 98 | ); 99 | }, 100 | ), 101 | ElevatedButton( 102 | child: Text('Info', style: textStyle), 103 | style: ButtonStyle( 104 | backgroundColor: WidgetStateProperty.all(Colors.blue) 105 | ), 106 | onPressed: () { 107 | showNotification( 108 | message: 'Hello, this is info notification', 109 | title: 'Info', 110 | backgroundColor: Colors.blue, 111 | autoDismissible: true, 112 | notificationDuration: 2500, 113 | ); 114 | }, 115 | ), 116 | ElevatedButton( 117 | child: Text('Custom handler', style: textStyle), 118 | onPressed: () async { 119 | instance = await showNotification( 120 | message: 'Hello, this will persist until you call close function', 121 | title: 'Persisting', 122 | backgroundColor: Colors.blue, 123 | autoDismissible: false, 124 | ); 125 | await Future.delayed(Duration(seconds: 3)); 126 | print("Closing notification now"); 127 | instance?.close(); 128 | }, 129 | ), 130 | ], 131 | ); 132 | } 133 | 134 | Widget loader(){ 135 | return Wrap( 136 | direction: Axis.horizontal, 137 | runSpacing: 8.0, 138 | spacing: 8.0, 139 | children: [ 140 | Row( 141 | children: [ 142 | Expanded(child: Text("Loader", style: headerStyle,)), 143 | ], 144 | ), 145 | 146 | ElevatedButton( 147 | child: Text('Show Loader', style: textStyle), 148 | onPressed: () async { 149 | showLoader( 150 | isModal: true, 151 | ); 152 | 153 | await Future.delayed(Duration(seconds: 3)); 154 | hideLoader(); 155 | }, 156 | ), 157 | 158 | ElevatedButton( 159 | child: Text('Show modal Loader', style: textStyle), 160 | onPressed: () async { 161 | showLoader( 162 | isModal: true, 163 | modalColor: Colors.green.withOpacity(0.4), 164 | modalDismissible: false 165 | ); 166 | 167 | await Future.delayed(Duration(seconds: 3)); 168 | hideLoader(); 169 | }, 170 | ), 171 | 172 | ], 173 | ); 174 | } 175 | 176 | Widget toast(){ 177 | return Wrap( 178 | direction: Axis.horizontal, 179 | runSpacing: 8.0, 180 | spacing: 8.0, 181 | children: [ 182 | Row( 183 | children: [ 184 | Expanded(child: Text("Toast", style: headerStyle)), 185 | ], 186 | ), 187 | 188 | ElevatedButton( 189 | child: Text('Info', style: textStyle), 190 | style: ButtonStyle( 191 | backgroundColor: WidgetStateProperty.all(Colors.blue) 192 | ), 193 | onPressed: () async { 194 | bakeToast("This is informational!", type: ToastType.info); 195 | }, 196 | ), 197 | 198 | ElevatedButton( 199 | child: Text('Normal', style: textStyle), 200 | style: ButtonStyle( 201 | backgroundColor: WidgetStateProperty.all(Colors.lightBlue) 202 | ), 203 | onPressed: () async { 204 | bakeToast("Downloading, please wait!", type: ToastType.normal); 205 | }, 206 | ), 207 | 208 | ElevatedButton( 209 | child: Text('Error', style: textStyle), 210 | style: ButtonStyle( 211 | backgroundColor: WidgetStateProperty.all(Colors.red) 212 | ), 213 | onPressed: () async { 214 | bakeToast("Password is incorrect!", type: ToastType.error); 215 | }, 216 | ), 217 | 218 | ElevatedButton( 219 | child: Text('Warning', style: textStyle), 220 | style: ButtonStyle( 221 | backgroundColor: WidgetStateProperty.all(Colors.orange) 222 | ), 223 | onPressed: () async { 224 | bakeToast("Password is weak!", type: ToastType.warning); 225 | }, 226 | ), 227 | 228 | ElevatedButton( 229 | child: Text('Success', style: textStyle), 230 | style: ButtonStyle( 231 | backgroundColor: WidgetStateProperty.all(Colors.green) 232 | ), 233 | onPressed: () async { 234 | bakeToast("Registration successful!", type: ToastType.success); 235 | }, 236 | ), 237 | 238 | ], 239 | ); 240 | } 241 | 242 | @override 243 | Widget build(BuildContext context) { 244 | return Scaffold( 245 | backgroundColor: Colors.blue.shade100, 246 | body: Padding( 247 | padding: const EdgeInsets.symmetric(vertical: 32.0, horizontal: 8.0), 248 | child: Align( 249 | alignment: Alignment.bottomCenter, 250 | child: Column( 251 | mainAxisAlignment: MainAxisAlignment.end, 252 | children: [ 253 | notifications(), 254 | Divider(height: 32.0), 255 | loader(), 256 | Divider(height: 32.0), 257 | toast(), 258 | ], 259 | ), 260 | ), 261 | ), 262 | ); 263 | } 264 | } 265 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | args: 5 | dependency: transitive 6 | description: 7 | name: args 8 | sha256: "3d82ff8620ec576fd38f6cec0df45a7c088b8704eb1c63d4c336392e5efca6ca" 9 | url: "https://pub.dev" 10 | source: hosted 11 | version: "2.2.0" 12 | async: 13 | dependency: transitive 14 | description: 15 | name: async 16 | sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" 17 | url: "https://pub.dev" 18 | source: hosted 19 | version: "2.11.0" 20 | boolean_selector: 21 | dependency: transitive 22 | description: 23 | name: boolean_selector 24 | sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" 25 | url: "https://pub.dev" 26 | source: hosted 27 | version: "2.1.1" 28 | characters: 29 | dependency: transitive 30 | description: 31 | name: characters 32 | sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" 33 | url: "https://pub.dev" 34 | source: hosted 35 | version: "1.3.0" 36 | clock: 37 | dependency: transitive 38 | description: 39 | name: clock 40 | sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf 41 | url: "https://pub.dev" 42 | source: hosted 43 | version: "1.1.1" 44 | collection: 45 | dependency: transitive 46 | description: 47 | name: collection 48 | sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a 49 | url: "https://pub.dev" 50 | source: hosted 51 | version: "1.18.0" 52 | connectivity_plus: 53 | dependency: "direct main" 54 | description: 55 | name: connectivity_plus 56 | sha256: "2056db5241f96cdc0126bd94459fc4cdc13876753768fc7a31c425e50a7177d0" 57 | url: "https://pub.dev" 58 | source: hosted 59 | version: "6.0.5" 60 | connectivity_plus_platform_interface: 61 | dependency: transitive 62 | description: 63 | name: connectivity_plus_platform_interface 64 | sha256: "42657c1715d48b167930d5f34d00222ac100475f73d10162ddf43e714932f204" 65 | url: "https://pub.dev" 66 | source: hosted 67 | version: "2.0.1" 68 | dbus: 69 | dependency: transitive 70 | description: 71 | name: dbus 72 | sha256: "365c771ac3b0e58845f39ec6deebc76e3276aa9922b0cc60840712094d9047ac" 73 | url: "https://pub.dev" 74 | source: hosted 75 | version: "0.7.10" 76 | fake_async: 77 | dependency: transitive 78 | description: 79 | name: fake_async 80 | sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" 81 | url: "https://pub.dev" 82 | source: hosted 83 | version: "1.3.1" 84 | ffi: 85 | dependency: transitive 86 | description: 87 | name: ffi 88 | sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6" 89 | url: "https://pub.dev" 90 | source: hosted 91 | version: "2.1.3" 92 | flutter: 93 | dependency: "direct main" 94 | description: flutter 95 | source: sdk 96 | version: "0.0.0" 97 | flutter_test: 98 | dependency: "direct dev" 99 | description: flutter 100 | source: sdk 101 | version: "0.0.0" 102 | flutter_web_plugins: 103 | dependency: transitive 104 | description: flutter 105 | source: sdk 106 | version: "0.0.0" 107 | leak_tracker: 108 | dependency: transitive 109 | description: 110 | name: leak_tracker 111 | sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" 112 | url: "https://pub.dev" 113 | source: hosted 114 | version: "10.0.5" 115 | leak_tracker_flutter_testing: 116 | dependency: transitive 117 | description: 118 | name: leak_tracker_flutter_testing 119 | sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" 120 | url: "https://pub.dev" 121 | source: hosted 122 | version: "3.0.5" 123 | leak_tracker_testing: 124 | dependency: transitive 125 | description: 126 | name: leak_tracker_testing 127 | sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" 128 | url: "https://pub.dev" 129 | source: hosted 130 | version: "3.0.1" 131 | matcher: 132 | dependency: transitive 133 | description: 134 | name: matcher 135 | sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb 136 | url: "https://pub.dev" 137 | source: hosted 138 | version: "0.12.16+1" 139 | material_color_utilities: 140 | dependency: transitive 141 | description: 142 | name: material_color_utilities 143 | sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec 144 | url: "https://pub.dev" 145 | source: hosted 146 | version: "0.11.1" 147 | meta: 148 | dependency: transitive 149 | description: 150 | name: meta 151 | sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 152 | url: "https://pub.dev" 153 | source: hosted 154 | version: "1.15.0" 155 | nm: 156 | dependency: transitive 157 | description: 158 | name: nm 159 | sha256: "2c9aae4127bdc8993206464fcc063611e0e36e72018696cd9631023a31b24254" 160 | url: "https://pub.dev" 161 | source: hosted 162 | version: "0.5.0" 163 | path: 164 | dependency: transitive 165 | description: 166 | name: path 167 | sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" 168 | url: "https://pub.dev" 169 | source: hosted 170 | version: "1.9.0" 171 | petitparser: 172 | dependency: transitive 173 | description: 174 | name: petitparser 175 | sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 176 | url: "https://pub.dev" 177 | source: hosted 178 | version: "6.0.2" 179 | plugin_platform_interface: 180 | dependency: transitive 181 | description: 182 | name: plugin_platform_interface 183 | sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" 184 | url: "https://pub.dev" 185 | source: hosted 186 | version: "2.1.8" 187 | sky_engine: 188 | dependency: transitive 189 | description: flutter 190 | source: sdk 191 | version: "0.0.99" 192 | source_span: 193 | dependency: transitive 194 | description: 195 | name: source_span 196 | sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" 197 | url: "https://pub.dev" 198 | source: hosted 199 | version: "1.10.0" 200 | stack_trace: 201 | dependency: transitive 202 | description: 203 | name: stack_trace 204 | sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" 205 | url: "https://pub.dev" 206 | source: hosted 207 | version: "1.11.1" 208 | stream_channel: 209 | dependency: transitive 210 | description: 211 | name: stream_channel 212 | sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 213 | url: "https://pub.dev" 214 | source: hosted 215 | version: "2.1.2" 216 | string_scanner: 217 | dependency: transitive 218 | description: 219 | name: string_scanner 220 | sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" 221 | url: "https://pub.dev" 222 | source: hosted 223 | version: "1.2.0" 224 | term_glyph: 225 | dependency: transitive 226 | description: 227 | name: term_glyph 228 | sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 229 | url: "https://pub.dev" 230 | source: hosted 231 | version: "1.2.1" 232 | test_api: 233 | dependency: transitive 234 | description: 235 | name: test_api 236 | sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" 237 | url: "https://pub.dev" 238 | source: hosted 239 | version: "0.7.2" 240 | vector_math: 241 | dependency: transitive 242 | description: 243 | name: vector_math 244 | sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" 245 | url: "https://pub.dev" 246 | source: hosted 247 | version: "2.1.4" 248 | vm_service: 249 | dependency: transitive 250 | description: 251 | name: vm_service 252 | sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" 253 | url: "https://pub.dev" 254 | source: hosted 255 | version: "14.2.5" 256 | web: 257 | dependency: transitive 258 | description: 259 | name: web 260 | sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb 261 | url: "https://pub.dev" 262 | source: hosted 263 | version: "1.1.0" 264 | xml: 265 | dependency: transitive 266 | description: 267 | name: xml 268 | sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 269 | url: "https://pub.dev" 270 | source: hosted 271 | version: "6.5.0" 272 | sdks: 273 | dart: ">=3.4.0 <4.0.0" 274 | flutter: ">=3.18.0-18.0.pre.54" 275 | -------------------------------------------------------------------------------- /example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | args: 5 | dependency: transitive 6 | description: 7 | name: args 8 | sha256: "3d82ff8620ec576fd38f6cec0df45a7c088b8704eb1c63d4c336392e5efca6ca" 9 | url: "https://pub.dev" 10 | source: hosted 11 | version: "2.2.0" 12 | async: 13 | dependency: transitive 14 | description: 15 | name: async 16 | sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" 17 | url: "https://pub.dev" 18 | source: hosted 19 | version: "2.11.0" 20 | boolean_selector: 21 | dependency: transitive 22 | description: 23 | name: boolean_selector 24 | sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" 25 | url: "https://pub.dev" 26 | source: hosted 27 | version: "2.1.1" 28 | characters: 29 | dependency: transitive 30 | description: 31 | name: characters 32 | sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" 33 | url: "https://pub.dev" 34 | source: hosted 35 | version: "1.3.0" 36 | clock: 37 | dependency: transitive 38 | description: 39 | name: clock 40 | sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf 41 | url: "https://pub.dev" 42 | source: hosted 43 | version: "1.1.1" 44 | collection: 45 | dependency: transitive 46 | description: 47 | name: collection 48 | sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a 49 | url: "https://pub.dev" 50 | source: hosted 51 | version: "1.18.0" 52 | connectivity_plus: 53 | dependency: transitive 54 | description: 55 | name: connectivity_plus 56 | sha256: "2056db5241f96cdc0126bd94459fc4cdc13876753768fc7a31c425e50a7177d0" 57 | url: "https://pub.dev" 58 | source: hosted 59 | version: "6.0.5" 60 | connectivity_plus_platform_interface: 61 | dependency: transitive 62 | description: 63 | name: connectivity_plus_platform_interface 64 | sha256: "42657c1715d48b167930d5f34d00222ac100475f73d10162ddf43e714932f204" 65 | url: "https://pub.dev" 66 | source: hosted 67 | version: "2.0.1" 68 | cupertino_icons: 69 | dependency: "direct main" 70 | description: 71 | name: cupertino_icons 72 | sha256: caac504f942f41dfadcf45229ce8c47065b93919a12739f20d6173a883c5ec73 73 | url: "https://pub.dev" 74 | source: hosted 75 | version: "1.0.2" 76 | dbus: 77 | dependency: transitive 78 | description: 79 | name: dbus 80 | sha256: "365c771ac3b0e58845f39ec6deebc76e3276aa9922b0cc60840712094d9047ac" 81 | url: "https://pub.dev" 82 | source: hosted 83 | version: "0.7.10" 84 | fake_async: 85 | dependency: transitive 86 | description: 87 | name: fake_async 88 | sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" 89 | url: "https://pub.dev" 90 | source: hosted 91 | version: "1.3.1" 92 | ffi: 93 | dependency: transitive 94 | description: 95 | name: ffi 96 | sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6" 97 | url: "https://pub.dev" 98 | source: hosted 99 | version: "2.1.3" 100 | flutter: 101 | dependency: "direct main" 102 | description: flutter 103 | source: sdk 104 | version: "0.0.0" 105 | flutter_test: 106 | dependency: "direct dev" 107 | description: flutter 108 | source: sdk 109 | version: "0.0.0" 110 | flutter_web_plugins: 111 | dependency: transitive 112 | description: flutter 113 | source: sdk 114 | version: "0.0.0" 115 | leak_tracker: 116 | dependency: transitive 117 | description: 118 | name: leak_tracker 119 | sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" 120 | url: "https://pub.dev" 121 | source: hosted 122 | version: "10.0.5" 123 | leak_tracker_flutter_testing: 124 | dependency: transitive 125 | description: 126 | name: leak_tracker_flutter_testing 127 | sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" 128 | url: "https://pub.dev" 129 | source: hosted 130 | version: "3.0.5" 131 | leak_tracker_testing: 132 | dependency: transitive 133 | description: 134 | name: leak_tracker_testing 135 | sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" 136 | url: "https://pub.dev" 137 | source: hosted 138 | version: "3.0.1" 139 | matcher: 140 | dependency: transitive 141 | description: 142 | name: matcher 143 | sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb 144 | url: "https://pub.dev" 145 | source: hosted 146 | version: "0.12.16+1" 147 | material_color_utilities: 148 | dependency: transitive 149 | description: 150 | name: material_color_utilities 151 | sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec 152 | url: "https://pub.dev" 153 | source: hosted 154 | version: "0.11.1" 155 | meta: 156 | dependency: transitive 157 | description: 158 | name: meta 159 | sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 160 | url: "https://pub.dev" 161 | source: hosted 162 | version: "1.15.0" 163 | nm: 164 | dependency: transitive 165 | description: 166 | name: nm 167 | sha256: "2c9aae4127bdc8993206464fcc063611e0e36e72018696cd9631023a31b24254" 168 | url: "https://pub.dev" 169 | source: hosted 170 | version: "0.5.0" 171 | ots: 172 | dependency: "direct main" 173 | description: 174 | path: ".." 175 | relative: true 176 | source: path 177 | version: "1.0.0" 178 | path: 179 | dependency: transitive 180 | description: 181 | name: path 182 | sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" 183 | url: "https://pub.dev" 184 | source: hosted 185 | version: "1.9.0" 186 | petitparser: 187 | dependency: transitive 188 | description: 189 | name: petitparser 190 | sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 191 | url: "https://pub.dev" 192 | source: hosted 193 | version: "6.0.2" 194 | plugin_platform_interface: 195 | dependency: transitive 196 | description: 197 | name: plugin_platform_interface 198 | sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" 199 | url: "https://pub.dev" 200 | source: hosted 201 | version: "2.1.8" 202 | sky_engine: 203 | dependency: transitive 204 | description: flutter 205 | source: sdk 206 | version: "0.0.99" 207 | source_span: 208 | dependency: transitive 209 | description: 210 | name: source_span 211 | sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" 212 | url: "https://pub.dev" 213 | source: hosted 214 | version: "1.10.0" 215 | stack_trace: 216 | dependency: transitive 217 | description: 218 | name: stack_trace 219 | sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" 220 | url: "https://pub.dev" 221 | source: hosted 222 | version: "1.11.1" 223 | stream_channel: 224 | dependency: transitive 225 | description: 226 | name: stream_channel 227 | sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 228 | url: "https://pub.dev" 229 | source: hosted 230 | version: "2.1.2" 231 | string_scanner: 232 | dependency: transitive 233 | description: 234 | name: string_scanner 235 | sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" 236 | url: "https://pub.dev" 237 | source: hosted 238 | version: "1.2.0" 239 | term_glyph: 240 | dependency: transitive 241 | description: 242 | name: term_glyph 243 | sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 244 | url: "https://pub.dev" 245 | source: hosted 246 | version: "1.2.1" 247 | test_api: 248 | dependency: transitive 249 | description: 250 | name: test_api 251 | sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" 252 | url: "https://pub.dev" 253 | source: hosted 254 | version: "0.7.2" 255 | vector_math: 256 | dependency: transitive 257 | description: 258 | name: vector_math 259 | sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" 260 | url: "https://pub.dev" 261 | source: hosted 262 | version: "2.1.4" 263 | vm_service: 264 | dependency: transitive 265 | description: 266 | name: vm_service 267 | sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" 268 | url: "https://pub.dev" 269 | source: hosted 270 | version: "14.2.5" 271 | web: 272 | dependency: transitive 273 | description: 274 | name: web 275 | sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb 276 | url: "https://pub.dev" 277 | source: hosted 278 | version: "1.1.0" 279 | xml: 280 | dependency: transitive 281 | description: 282 | name: xml 283 | sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 284 | url: "https://pub.dev" 285 | source: hosted 286 | version: "6.5.0" 287 | sdks: 288 | dart: ">=3.4.0 <4.0.0" 289 | flutter: ">=3.18.0-18.0.pre.54" 290 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # over-the-screen 2 | 3 | 4 | [![All Contributors](https://img.shields.io/badge/all_contributors-6-orange.svg?style=flat-square)](#contributors-) 5 | 6 | 7 | [![LinkedIn](https://img.shields.io/badge/LinkedIn-fayaz07-0e76a8)](https://www.linkedin.com/in/fayaz07)   [![Fork](https://img.shields.io/github/forks/fayaz07/ots?style=social)](https://github.com/fayaz07/ots/fork)   [![Star](https://img.shields.io/github/stars/fayaz07/ots?style=social)](https://github.com/fayaz07/ots/star)   [![Watches](https://img.shields.io/github/watchers/fayaz07/ots?style=social)](https://github.com/fayaz07/ots/) 8 | 9 | [![Get the library](https://img.shields.io/badge/pub-v1.0.0-blue)](https://pub.dev/packages/ots)   [![Example](https://img.shields.io/badge/example-code-success)](https://pub.dev/packages/ots#-example-tab-) 10 | 11 | Buy Me A Coffee 12 | 13 | An widget that can show loaders, notifications, internet connectivity changes as `Overlay`. 14 | 15 | ### Screenshots 16 | 17 | 18 | 19 | ### Demo 20 | 21 | Internet connectivity changes Loader Notification 22 | 23 | default_toast error_toast info_toast success_toast warning_toast 24 | 25 | ### Installation 26 | 27 | ```yaml 28 | dependencies: 29 | flutter: 30 | sdk: flutter 31 | ... 32 | 33 | ots: 34 | git: 35 | url: git://github.com/fayaz07/ots.git 36 | ``` 37 | 38 | ### How to use 39 | 40 | ```dart 41 | void main() => runApp( 42 | MyApp(), 43 | ); 44 | 45 | class MyApp extends StatelessWidget { 46 | @override 47 | Widget build(BuildContext context) { 48 | return OTS( 49 | showNetworkUpdates: true, 50 | persistNoInternetNotification: false, 51 | 52 | /// pass your custom loader here 53 | loader: CircularProgressIndicator( 54 | valueColor: AlwaysStoppedAnimation(Colors.red), 55 | ), 56 | 57 | child: MaterialApp( 58 | title: 'OTS Test', 59 | home: Home(), 60 | ), 61 | ); 62 | } 63 | } 64 | ``` 65 | 66 | By default, loader is set to [CircularProgressIndicator](https://api.flutter.dev/flutter/material/CircularProgressIndicator-class.html) for Android and [CupertinoActivityIndicator](https://api.flutter.dev/flutter/cupertino/CupertinoActivityIndicator-class.html) for iOS. 67 | 68 | #### Showing and hiding a loader 69 | 70 | ```dart 71 | showLoader( 72 | isModal: true, 73 | ); 74 | /// Your network operation 75 | hideLoader(); 76 | ``` 77 | 78 | > Note: `isModal` stops user from interacting with the screen 79 | 80 | #### Showing and hiding a notification 81 | 82 | ```dart 83 | showNotification( 84 | title: 'Test', 85 | message: 'Hello, this is notification', 86 | backgroundColor: Colors.green, 87 | autoDismissible: true, 88 | notificationDuration: 2500, 89 | ); 90 | 91 | // use only if `autoDismissible: false` 92 | hideNotification(); 93 | ``` 94 | 95 | #### Showing toasts 96 | 97 | ##### Default toast 98 | 99 | ``` 100 | bakeToast("Hey toast!"); 101 | ``` 102 | 103 | ##### Info toast 104 | 105 | ``` 106 | bakeToast("Hey info!", type: ToastType.info); 107 | ``` 108 | 109 | ##### Success toast 110 | 111 | ``` 112 | bakeToast("Hey success!", type: ToastType.success); 113 | ``` 114 | 115 | ##### Error toast 116 | 117 | ``` 118 | bakeToast("Hey error!", type: ToastType.error); 119 | ``` 120 | 121 | ##### Warning toast 122 | 123 | ``` 124 | bakeToast("Hey warning!", type: ToastType.warning); 125 | ``` 126 | 127 | > Note: Notifications are automatically dismissed after the specified duration if `autoDismissible` is set to true. 128 | 129 | 130 | #### Customize network updates messages and colors 131 | 132 | You can customize text and color of network update messages to support multi-language applications. 133 | To do that, you must create a new class that extends `NetworkStateMessenger` 134 | 135 | ``` 136 | class CustomNetworkStateMessage extends NetworkStateMessenger { 137 | @override 138 | String message(NetworkState? networkState) { 139 | switch (networkState) { 140 | case NetworkState.Connected: 141 | return '#YOUR_CONNECTED_CUSTOM_MESSAGE#'; 142 | case NetworkState.Disconnected: 143 | return '#YOUR_DISCONNECTED_CUSTOM_MESSAGE#'; 144 | case NetworkState.Weak: 145 | return '#YOUR_WEAK_CUSTOM_MESSAGE#'; 146 | case null: 147 | } 148 | return '#YOUR_UNKNOWN_CUSTOM_MESSAGE#'; 149 | } 150 | 151 | @override 152 | Color color(NetworkState? networkState) { 153 | switch (networkState) { 154 | case NetworkState.Connected: 155 | return Colors.lightGreen; 156 | case NetworkState.Disconnected: 157 | return Colors.red; 158 | case NetworkState.Weak: 159 | return Colors.yellow; 160 | case null: 161 | } 162 | return Colors.orange; 163 | } 164 | } 165 | ``` 166 | 167 | and then configure this custom messenger in the OTS constructor 168 | 169 | ``` 170 | return OTS( 171 | ... 172 | showNetworkUpdates: true, 173 | persistNoInternetNotification: true, 174 | networkStateMessenger: CustomNetworkStateMessage(), 175 | ... 176 | ) 177 | ``` 178 | 179 | ## Contributors ✨ 180 | 181 | Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 |

Mohammad Fayaz

💻 🖋 📖 💡 🤔 🚧

Alex Deas

💻

Pranathi Reddy

💻

Aster

💻

lscbot

💻

Antoni Remeseiro Alfonso

💻
196 | 197 | 198 | 199 | 200 | 201 | 202 | This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! 203 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2020 - Mohammad Fayaz 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /lib/ots.dart: -------------------------------------------------------------------------------- 1 | library ots; 2 | 3 | import 'dart:io' show InternetAddress, Platform, SocketException; 4 | 5 | import 'package:connectivity_plus/connectivity_plus.dart'; 6 | import 'package:flutter/cupertino.dart'; 7 | import 'package:flutter/material.dart'; 8 | import 'package:ots/toast/colors.dart'; 9 | import 'package:ots/toast/text_styles.dart'; 10 | import 'package:ots/toast/types.dart'; 11 | import 'package:ots/toast/widgets/error.dart'; 12 | import 'package:ots/toast/widgets/info.dart'; 13 | import 'package:ots/toast/widgets/normal.dart'; 14 | import 'package:ots/toast/widgets/success.dart'; 15 | import 'package:ots/toast/widgets/warning.dart'; 16 | import 'package:ots/widgets/network_state.dart'; 17 | 18 | import 'widgets/notification.dart'; 19 | 20 | export 'toast/types.dart'; 21 | 22 | /// This will be used as a key for getting the [context] of [OTS] widget 23 | /// which is used for inserting the [OverlayEntry] into an [Overlay] widget 24 | final _tKey = GlobalKey(debugLabel: 'overlay_parent'); 25 | final _modalBarrierDefaultColor = Colors.grey.withOpacity(0.15); 26 | 27 | /// Updates with the latest [OverlayEntry] child 28 | OverlayEntry? _notificationEntry; 29 | OverlayEntry? _loaderEntry; 30 | OverlayEntry? _networkStatusEntry; 31 | OverlayEntry? _toastEntry; 32 | 33 | /// is dark theme 34 | bool isDarkTheme = false; 35 | 36 | /// To keep track if the [Overlay] is shown 37 | bool _notificationShown = false; 38 | bool _loaderShown = false; 39 | bool _networkShown = false; 40 | bool _toastShown = false; 41 | bool _persistNoInternetToast = false; 42 | 43 | bool _showDebugLogs = true; 44 | bool _isFirstNetworkConnectionTrack = true; 45 | 46 | Widget? _loadingIndicator; 47 | 48 | class OTS extends StatelessWidget { 49 | final Widget? child; 50 | final Widget? loader; 51 | final bool showNetworkUpdates; 52 | final bool persistNoInternetNotification; 53 | final NetworkStateMessenger? networkStateMessenger; 54 | final bool darkTheme; 55 | final String? connectivityCheckAddress; 56 | final double bottomInternetNotificationPadding; 57 | 58 | const OTS({ 59 | Key? key, 60 | this.child, 61 | this.loader, 62 | this.showNetworkUpdates = false, 63 | this.persistNoInternetNotification = false, 64 | this.darkTheme = false, 65 | this.connectivityCheckAddress, 66 | this.networkStateMessenger, 67 | this.bottomInternetNotificationPadding = 0.0 68 | }) : super(key: key); 69 | 70 | @override 71 | Widget build(BuildContext context) { 72 | _loadingIndicator = loader; 73 | isDarkTheme = darkTheme; 74 | _persistNoInternetToast = persistNoInternetNotification; 75 | if (showNetworkUpdates) { 76 | _listenToNetworkChanges(bottomInternetNotificationPadding, 77 | messenger: networkStateMessenger, 78 | connectivityCheckAddress: connectivityCheckAddress); 79 | } 80 | return SizedBox( 81 | key: _tKey, 82 | child: child, 83 | ); 84 | } 85 | } 86 | 87 | OverlayState? get _overlayState { 88 | final context = _tKey.currentContext; 89 | if (context == null) return null; 90 | 91 | NavigatorState? navigator; 92 | void visitor(Element element) { 93 | if (navigator != null) return; 94 | 95 | if (element.widget is Navigator) { 96 | navigator = (element as StatefulElement).state as NavigatorState?; 97 | } else { 98 | element.visitChildElements(visitor); 99 | } 100 | } 101 | 102 | context.visitChildElements(visitor); 103 | 104 | assert(navigator != null, 105 | '''Cannot find OTS above the widget tree, unable to show overlay'''); 106 | return navigator!.overlay; 107 | } 108 | 109 | /// handling Internet Connectivity changes 110 | void _listenToNetworkChanges(bottomPadding, {String? connectivityCheckAddress, NetworkStateMessenger? messenger}) async { 111 | Connectivity().onConnectivityChanged.listen((event) { 112 | if (event.contains(ConnectivityResult.wifi)) { 113 | _checkInternetConnectionAndShowStatus(bottomPadding, 114 | connectivityCheckAddress: connectivityCheckAddress, 115 | messenger: messenger 116 | ); 117 | } else if (event.contains(ConnectivityResult.mobile)) { 118 | _checkInternetConnectionAndShowStatus(bottomPadding, 119 | connectivityCheckAddress: connectivityCheckAddress, 120 | messenger: messenger 121 | ); 122 | } else if (event.contains(ConnectivityResult.none)) { 123 | _showNetworkStateWidget(NetworkState.Disconnected, messenger, bottomPadding); 124 | } 125 | /* switch (event) { 126 | case ConnectivityResult.wifi: 127 | _checkInternetConnectionAndShowStatus(bottomPadding, 128 | connectivityCheckAddress: connectivityCheckAddress, 129 | messenger: messenger 130 | ); 131 | break; 132 | case ConnectivityResult.mobile: 133 | _checkInternetConnectionAndShowStatus(bottomPadding, 134 | connectivityCheckAddress: connectivityCheckAddress, 135 | messenger: messenger 136 | ); 137 | break; 138 | case ConnectivityResult.none: 139 | _showNetworkStateWidget(NetworkState.Disconnected, messenger, bottomPadding); 140 | break; 141 | } */ 142 | }); 143 | } 144 | 145 | _checkInternetConnectionAndShowStatus(double bottomPadding, 146 | {String? connectivityCheckAddress, NetworkStateMessenger? messenger}) async { 147 | try { 148 | final result = await InternetAddress.lookup(connectivityCheckAddress ?? 'google.com'); 149 | if (result.isNotEmpty && result[0].rawAddress.isNotEmpty) { 150 | _showNetworkStateWidget(NetworkState.Connected, messenger, bottomPadding); 151 | } 152 | } on SocketException catch (_) { 153 | _showNetworkStateWidget(NetworkState.Weak, messenger, bottomPadding); 154 | } 155 | } 156 | 157 | Future _showNetworkStateWidget(NetworkState state, NetworkStateMessenger? messenger, double bottomPadding) async { 158 | try { 159 | // prevent the showing of "connected message" when you access an 160 | // already connected network. 161 | if (_isFirstNetworkConnectionTrack) { 162 | _isFirstNetworkConnectionTrack = false; 163 | if (state == NetworkState.Connected) { 164 | return; 165 | } 166 | } 167 | 168 | // display the message 169 | final child = Positioned( 170 | bottom: bottomPadding, 171 | left: 0.0, 172 | right: 0.0, 173 | height: 30.0, 174 | child: NetworkWidget( 175 | disposeOverlay: _hideNetworkStateWidget, 176 | state: state, 177 | messenger: messenger ?? NetworkStateDefaultMessage(), 178 | persistNotification: _persistNoInternetToast, 179 | ), 180 | ); 181 | _printLog("Network change: " + (messenger ?? NetworkStateDefaultMessage()).message(state)); 182 | if (_OverlayType.NetworkStatus.isShowing()) { 183 | _printLog("An internet overlay is being currently shown, " 184 | "hiding it before showing new overlay"); 185 | await _hideNetworkStateWidget(); 186 | } 187 | 188 | await _showOverlay(child: child, type: _OverlayType.NetworkStatus); 189 | } catch (err) { 190 | _printError( 191 | '''Caught an exception while trying to show NetworkStatusWidget'''); 192 | throw err; 193 | } 194 | } 195 | 196 | Future _hideNetworkStateWidget() async { 197 | try { 198 | _printLog('''Hiding loader network status'''); 199 | await _hideOverlay(_OverlayType.NetworkStatus); 200 | } catch (err) { 201 | _printError( 202 | '''Caught an exception while trying to hide NetworkStatusWidget'''); 203 | throw err; 204 | } 205 | } 206 | 207 | /// To handle a loader for the application 208 | Future showLoader( 209 | {bool isModal = false, 210 | Color? modalColor, 211 | bool modalDismissible = true}) async { 212 | try { 213 | _printLog('''Showing loader as Overlay'''); 214 | final _child = Center( 215 | child: _loadingIndicator ?? 216 | (Platform.isAndroid 217 | ? CircularProgressIndicator() 218 | : CupertinoActivityIndicator()), 219 | ); 220 | await _showOverlay( 221 | child: isModal 222 | ? Stack( 223 | children: [ 224 | ModalBarrier( 225 | color: modalColor ?? _modalBarrierDefaultColor, 226 | dismissible: modalDismissible, 227 | ), 228 | _child 229 | ], 230 | ) 231 | : _child, 232 | type: _OverlayType.Loader, 233 | ); 234 | } catch (err) { 235 | debugPrint( 236 | '''Caught an exception while trying to show a Loader\n${err.toString()}'''); 237 | throw err; 238 | } 239 | } 240 | 241 | Future hideLoader() async { 242 | try { 243 | _printLog('''Hiding loader overlay'''); 244 | await _hideOverlay(_OverlayType.Loader); 245 | } catch (err) { 246 | _printError('''Caught an exception while trying to hide loader'''); 247 | throw err; 248 | } 249 | } 250 | 251 | /// This method can be used by the client to show a Notification as an overlay 252 | Future showNotification( 253 | {String? title, 254 | required String message, 255 | TextStyle? messageStyle, 256 | TextStyle? titleStyle, 257 | Color? backgroundColor, 258 | int? notificationDuration, 259 | int? animDuration, 260 | bool? autoDismissible}) async { 261 | /// Throws an error if message is null 262 | // assert(message != null, '''Notification message cannot be null'''); 263 | 264 | try { 265 | final instance = NotificationWidget( 266 | disposeOverlay: hideNotification, 267 | backgroundColor: backgroundColor, 268 | message: message, 269 | title: title, 270 | messageStyle: messageStyle, 271 | titleStyle: titleStyle, 272 | autoDismissible: autoDismissible, 273 | duration: notificationDuration, 274 | animDuration: animDuration, 275 | ); 276 | 277 | final child = Positioned( 278 | left: 8.0, 279 | right: 8.0, 280 | child: instance, 281 | ); 282 | 283 | _printLog('''Showing Notification overlay'''); 284 | 285 | await _showOverlay(child: child, type: _OverlayType.Notification); 286 | return instance.get(); 287 | } catch (err) { 288 | _printError('''Caught an exception while trying to show Notification'''); 289 | throw err; 290 | } 291 | } 292 | 293 | Future hideNotification() async { 294 | try { 295 | _printLog('''Hiding Notification overlay'''); 296 | await _hideOverlay(_OverlayType.Notification); 297 | } catch (err) { 298 | _printError('''Caught an exception while trying to hide Notification'''); 299 | throw err; 300 | } 301 | } 302 | 303 | ///----------------------------------Toasts------------------------------------ 304 | Future bakeToast(String message, 305 | {Color? backgroundColor, 306 | TextStyle? textStyle, 307 | ToastType type = ToastType.normal}) async { 308 | try { 309 | Widget? _toast; 310 | switch (type) { 311 | case ToastType.normal: 312 | _toast = DefaultToast( 313 | backgroundColor: backgroundColor ?? ToastColors.defaultToastBGColor, 314 | textStyle: textStyle ?? ToastTextStyle.defaultTextStyle, 315 | message: message, 316 | onToasted: _hideToast); 317 | break; 318 | case ToastType.info: 319 | _toast = InfoToast( 320 | backgroundColor: backgroundColor ?? ToastColors.infoToastBGColor, 321 | textStyle: textStyle ?? ToastTextStyle.defaultTextStyle, 322 | message: message, 323 | onToasted: _hideToast); 324 | break; 325 | case ToastType.success: 326 | _toast = SuccessToast( 327 | backgroundColor: backgroundColor ?? ToastColors.successToastBGColor, 328 | textStyle: textStyle ?? ToastTextStyle.defaultTextStyle, 329 | message: message, 330 | onToasted: _hideToast); 331 | break; 332 | case ToastType.error: 333 | _toast = ErrorToast( 334 | backgroundColor: backgroundColor ?? ToastColors.errorToastBGColor, 335 | textStyle: textStyle ?? ToastTextStyle.defaultTextStyle, 336 | message: message, 337 | onToasted: _hideToast); 338 | break; 339 | case ToastType.warning: 340 | _toast = WarningToast( 341 | backgroundColor: backgroundColor ?? ToastColors.warningToastBGColor, 342 | textStyle: textStyle ?? ToastTextStyle.defaultTextStyle, 343 | message: message, 344 | onToasted: _hideToast); 345 | break; 346 | } 347 | 348 | final child = Positioned( 349 | left: 8.0, 350 | right: 8.0, 351 | bottom: 72.0, 352 | child: Center( 353 | child: _toast, 354 | ), 355 | ); 356 | 357 | _printLog('''Showing Toast overlay'''); 358 | 359 | await _showOverlay(child: child, type: _OverlayType.Toast); 360 | } catch (err) { 361 | _printError('''Caught an exception while trying to show Toast'''); 362 | throw err; 363 | } 364 | } 365 | 366 | Future _hideToast() async { 367 | try { 368 | _printLog('''Hiding Toast overlay'''); 369 | await _hideOverlay(_OverlayType.Toast); 370 | } catch (err) { 371 | _printError('''Caught an exception while trying to hide Toast'''); 372 | throw err; 373 | } 374 | } 375 | 376 | ///--------------------------------End Toast----------------------------------- 377 | 378 | ///---------------------------------------------------------------------------- 379 | /// These methods deal with showing and hiding the overlay 380 | Future _showOverlay({required Widget child, _OverlayType? type}) async { 381 | try { 382 | final overlay = _overlayState; 383 | 384 | if (type.isShowing()) { 385 | _printLog('''An overlay of ${type.name()} is already showing'''); 386 | return Future.value(false); 387 | } 388 | 389 | // try { 390 | // if (_overlayShown) hideOverlay(); 391 | // } catch (err) { 392 | // print(err); 393 | // } 394 | 395 | final overlayEntry = OverlayEntry( 396 | builder: (context) => child, 397 | ); 398 | 399 | overlay!.insert(overlayEntry); 400 | type.setOverlayEntry(overlayEntry); 401 | type.setShowing(); 402 | } catch (err) { 403 | _printError( 404 | '''Caught an exception while trying to insert Overlay\n${err.toString()}'''); 405 | throw err; 406 | } 407 | } 408 | 409 | Future _hideOverlay(_OverlayType type) async { 410 | try { 411 | if (type.isShowing()) { 412 | type.getOverlayEntry()!.remove(); 413 | type.hide(); 414 | } else { 415 | _printLog('No overlay is shown'); 416 | } 417 | } catch (err) { 418 | _printError( 419 | '''Caught an exception while trying to remove Overlay\n${err.toString()}'''); 420 | throw err; 421 | } 422 | } 423 | 424 | void _printLog(String log) { 425 | if (_showDebugLogs) debugPrint(log); 426 | } 427 | 428 | void _printError(String log) { 429 | debugPrint(log); 430 | } 431 | 432 | /// ----------------------------- end overlay methods -------------------------- 433 | enum _OverlayType { 434 | Notification, 435 | Loader, 436 | NetworkStatus, 437 | Toast, 438 | } 439 | 440 | extension OverlayTypeExtension on _OverlayType? { 441 | String name() { 442 | switch (this) { 443 | case _OverlayType.Notification: 444 | return "Notification"; 445 | case _OverlayType.Loader: 446 | return "Loader"; 447 | case _OverlayType.NetworkStatus: 448 | return "NetworkStatus"; 449 | case _OverlayType.Toast: 450 | return "Toast"; 451 | default: 452 | return "Overlay"; 453 | } 454 | } 455 | 456 | bool isShowing() { 457 | switch (this) { 458 | case _OverlayType.Notification: 459 | return _notificationShown; 460 | case _OverlayType.Loader: 461 | return _loaderShown; 462 | case _OverlayType.NetworkStatus: 463 | return _networkShown; 464 | case _OverlayType.Toast: 465 | return _toastShown; 466 | default: 467 | return false; 468 | } 469 | } 470 | 471 | void setShowing() { 472 | switch (this) { 473 | case _OverlayType.Notification: 474 | _notificationShown = true; 475 | break; 476 | case _OverlayType.Loader: 477 | _loaderShown = true; 478 | break; 479 | case _OverlayType.NetworkStatus: 480 | _networkShown = true; 481 | break; 482 | case _OverlayType.Toast: 483 | _toastShown = true; 484 | break; 485 | default: 486 | break; 487 | } 488 | } 489 | 490 | void hide() { 491 | switch (this) { 492 | case _OverlayType.Notification: 493 | _notificationShown = false; 494 | break; 495 | case _OverlayType.Loader: 496 | _loaderShown = false; 497 | break; 498 | case _OverlayType.NetworkStatus: 499 | _networkShown = false; 500 | break; 501 | case _OverlayType.Toast: 502 | _toastShown = false; 503 | break; 504 | default: 505 | break; 506 | } 507 | } 508 | 509 | OverlayEntry? getOverlayEntry() { 510 | switch (this) { 511 | case _OverlayType.Notification: 512 | return _notificationEntry; 513 | case _OverlayType.Loader: 514 | return _loaderEntry; 515 | case _OverlayType.NetworkStatus: 516 | return _networkStatusEntry; 517 | case _OverlayType.Toast: 518 | return _toastEntry; 519 | default: 520 | return null; 521 | } 522 | } 523 | 524 | void setOverlayEntry(OverlayEntry entry) { 525 | switch (this) { 526 | case _OverlayType.Notification: 527 | _notificationEntry = entry; 528 | break; 529 | case _OverlayType.Loader: 530 | _loaderEntry = entry; 531 | break; 532 | case _OverlayType.NetworkStatus: 533 | _networkStatusEntry = entry; 534 | break; 535 | case _OverlayType.Toast: 536 | _toastEntry = entry; 537 | break; 538 | default: 539 | break; 540 | } 541 | } 542 | } 543 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 13 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 14 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 15 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 16 | B320E61EC78AEEC2DB24202F /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7CE1DAD5294F2223EA70F3D2 /* Pods_Runner.framework */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXCopyFilesBuildPhase section */ 20 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 21 | isa = PBXCopyFilesBuildPhase; 22 | buildActionMask = 2147483647; 23 | dstPath = ""; 24 | dstSubfolderSpec = 10; 25 | files = ( 26 | ); 27 | name = "Embed Frameworks"; 28 | runOnlyForDeploymentPostprocessing = 0; 29 | }; 30 | /* End PBXCopyFilesBuildPhase section */ 31 | 32 | /* Begin PBXFileReference section */ 33 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 34 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 35 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 36 | 3EF3D9A9C5E2AA243DDD11F6 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 37 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 38 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 39 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 40 | 7CE1DAD5294F2223EA70F3D2 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 8BE7744324F4FBCA7218F62E /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 42 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 43 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 44 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 45 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 46 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 47 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 48 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 49 | A034131B705A8C4132FFCE4D /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 50 | /* End PBXFileReference section */ 51 | 52 | /* Begin PBXFrameworksBuildPhase section */ 53 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 54 | isa = PBXFrameworksBuildPhase; 55 | buildActionMask = 2147483647; 56 | files = ( 57 | B320E61EC78AEEC2DB24202F /* Pods_Runner.framework in Frameworks */, 58 | ); 59 | runOnlyForDeploymentPostprocessing = 0; 60 | }; 61 | /* End PBXFrameworksBuildPhase section */ 62 | 63 | /* Begin PBXGroup section */ 64 | 1A39D01BF546F78BAB1B48A1 /* Pods */ = { 65 | isa = PBXGroup; 66 | children = ( 67 | A034131B705A8C4132FFCE4D /* Pods-Runner.debug.xcconfig */, 68 | 8BE7744324F4FBCA7218F62E /* Pods-Runner.release.xcconfig */, 69 | 3EF3D9A9C5E2AA243DDD11F6 /* Pods-Runner.profile.xcconfig */, 70 | ); 71 | name = Pods; 72 | path = Pods; 73 | sourceTree = ""; 74 | }; 75 | 7AE279A5A0741D2C6B4BC3FC /* Frameworks */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | 7CE1DAD5294F2223EA70F3D2 /* Pods_Runner.framework */, 79 | ); 80 | name = Frameworks; 81 | sourceTree = ""; 82 | }; 83 | 9740EEB11CF90186004384FC /* Flutter */ = { 84 | isa = PBXGroup; 85 | children = ( 86 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 87 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 88 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 89 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 90 | ); 91 | name = Flutter; 92 | sourceTree = ""; 93 | }; 94 | 97C146E51CF9000F007C117D = { 95 | isa = PBXGroup; 96 | children = ( 97 | 9740EEB11CF90186004384FC /* Flutter */, 98 | 97C146F01CF9000F007C117D /* Runner */, 99 | 97C146EF1CF9000F007C117D /* Products */, 100 | 1A39D01BF546F78BAB1B48A1 /* Pods */, 101 | 7AE279A5A0741D2C6B4BC3FC /* Frameworks */, 102 | ); 103 | sourceTree = ""; 104 | }; 105 | 97C146EF1CF9000F007C117D /* Products */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | 97C146EE1CF9000F007C117D /* Runner.app */, 109 | ); 110 | name = Products; 111 | sourceTree = ""; 112 | }; 113 | 97C146F01CF9000F007C117D /* Runner */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 117 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 118 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 119 | 97C147021CF9000F007C117D /* Info.plist */, 120 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 121 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 122 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 123 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 124 | ); 125 | path = Runner; 126 | sourceTree = ""; 127 | }; 128 | /* End PBXGroup section */ 129 | 130 | /* Begin PBXNativeTarget section */ 131 | 97C146ED1CF9000F007C117D /* Runner */ = { 132 | isa = PBXNativeTarget; 133 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 134 | buildPhases = ( 135 | 18E1184F5E3C6062167A3355 /* [CP] Check Pods Manifest.lock */, 136 | 9740EEB61CF901F6004384FC /* Run Script */, 137 | 97C146EA1CF9000F007C117D /* Sources */, 138 | 97C146EB1CF9000F007C117D /* Frameworks */, 139 | 97C146EC1CF9000F007C117D /* Resources */, 140 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 141 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 142 | 470CEE0094D936390D79C2AF /* [CP] Embed Pods Frameworks */, 143 | ); 144 | buildRules = ( 145 | ); 146 | dependencies = ( 147 | ); 148 | name = Runner; 149 | productName = Runner; 150 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 151 | productType = "com.apple.product-type.application"; 152 | }; 153 | /* End PBXNativeTarget section */ 154 | 155 | /* Begin PBXProject section */ 156 | 97C146E61CF9000F007C117D /* Project object */ = { 157 | isa = PBXProject; 158 | attributes = { 159 | LastUpgradeCheck = 1020; 160 | ORGANIZATIONNAME = ""; 161 | TargetAttributes = { 162 | 97C146ED1CF9000F007C117D = { 163 | CreatedOnToolsVersion = 7.3.1; 164 | LastSwiftMigration = 1100; 165 | }; 166 | }; 167 | }; 168 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 169 | compatibilityVersion = "Xcode 9.3"; 170 | developmentRegion = en; 171 | hasScannedForEncodings = 0; 172 | knownRegions = ( 173 | en, 174 | Base, 175 | ); 176 | mainGroup = 97C146E51CF9000F007C117D; 177 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 178 | projectDirPath = ""; 179 | projectRoot = ""; 180 | targets = ( 181 | 97C146ED1CF9000F007C117D /* Runner */, 182 | ); 183 | }; 184 | /* End PBXProject section */ 185 | 186 | /* Begin PBXResourcesBuildPhase section */ 187 | 97C146EC1CF9000F007C117D /* Resources */ = { 188 | isa = PBXResourcesBuildPhase; 189 | buildActionMask = 2147483647; 190 | files = ( 191 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 192 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 193 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 194 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | }; 198 | /* End PBXResourcesBuildPhase section */ 199 | 200 | /* Begin PBXShellScriptBuildPhase section */ 201 | 18E1184F5E3C6062167A3355 /* [CP] Check Pods Manifest.lock */ = { 202 | isa = PBXShellScriptBuildPhase; 203 | buildActionMask = 2147483647; 204 | files = ( 205 | ); 206 | inputFileListPaths = ( 207 | ); 208 | inputPaths = ( 209 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 210 | "${PODS_ROOT}/Manifest.lock", 211 | ); 212 | name = "[CP] Check Pods Manifest.lock"; 213 | outputFileListPaths = ( 214 | ); 215 | outputPaths = ( 216 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", 217 | ); 218 | runOnlyForDeploymentPostprocessing = 0; 219 | shellPath = /bin/sh; 220 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 221 | showEnvVarsInLog = 0; 222 | }; 223 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 224 | isa = PBXShellScriptBuildPhase; 225 | buildActionMask = 2147483647; 226 | files = ( 227 | ); 228 | inputPaths = ( 229 | ); 230 | name = "Thin Binary"; 231 | outputPaths = ( 232 | ); 233 | runOnlyForDeploymentPostprocessing = 0; 234 | shellPath = /bin/sh; 235 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 236 | }; 237 | 470CEE0094D936390D79C2AF /* [CP] Embed Pods Frameworks */ = { 238 | isa = PBXShellScriptBuildPhase; 239 | buildActionMask = 2147483647; 240 | files = ( 241 | ); 242 | inputFileListPaths = ( 243 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", 244 | ); 245 | name = "[CP] Embed Pods Frameworks"; 246 | outputFileListPaths = ( 247 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", 248 | ); 249 | runOnlyForDeploymentPostprocessing = 0; 250 | shellPath = /bin/sh; 251 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; 252 | showEnvVarsInLog = 0; 253 | }; 254 | 9740EEB61CF901F6004384FC /* Run Script */ = { 255 | isa = PBXShellScriptBuildPhase; 256 | buildActionMask = 2147483647; 257 | files = ( 258 | ); 259 | inputPaths = ( 260 | ); 261 | name = "Run Script"; 262 | outputPaths = ( 263 | ); 264 | runOnlyForDeploymentPostprocessing = 0; 265 | shellPath = /bin/sh; 266 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 267 | }; 268 | /* End PBXShellScriptBuildPhase section */ 269 | 270 | /* Begin PBXSourcesBuildPhase section */ 271 | 97C146EA1CF9000F007C117D /* Sources */ = { 272 | isa = PBXSourcesBuildPhase; 273 | buildActionMask = 2147483647; 274 | files = ( 275 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 276 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 277 | ); 278 | runOnlyForDeploymentPostprocessing = 0; 279 | }; 280 | /* End PBXSourcesBuildPhase section */ 281 | 282 | /* Begin PBXVariantGroup section */ 283 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 284 | isa = PBXVariantGroup; 285 | children = ( 286 | 97C146FB1CF9000F007C117D /* Base */, 287 | ); 288 | name = Main.storyboard; 289 | sourceTree = ""; 290 | }; 291 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 292 | isa = PBXVariantGroup; 293 | children = ( 294 | 97C147001CF9000F007C117D /* Base */, 295 | ); 296 | name = LaunchScreen.storyboard; 297 | sourceTree = ""; 298 | }; 299 | /* End PBXVariantGroup section */ 300 | 301 | /* Begin XCBuildConfiguration section */ 302 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 303 | isa = XCBuildConfiguration; 304 | buildSettings = { 305 | ALWAYS_SEARCH_USER_PATHS = NO; 306 | CLANG_ANALYZER_NONNULL = YES; 307 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 308 | CLANG_CXX_LIBRARY = "libc++"; 309 | CLANG_ENABLE_MODULES = YES; 310 | CLANG_ENABLE_OBJC_ARC = YES; 311 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 312 | CLANG_WARN_BOOL_CONVERSION = YES; 313 | CLANG_WARN_COMMA = YES; 314 | CLANG_WARN_CONSTANT_CONVERSION = YES; 315 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 316 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 317 | CLANG_WARN_EMPTY_BODY = YES; 318 | CLANG_WARN_ENUM_CONVERSION = YES; 319 | CLANG_WARN_INFINITE_RECURSION = YES; 320 | CLANG_WARN_INT_CONVERSION = YES; 321 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 322 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 323 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 324 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 325 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 326 | CLANG_WARN_STRICT_PROTOTYPES = YES; 327 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 328 | CLANG_WARN_UNREACHABLE_CODE = YES; 329 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 330 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 331 | COPY_PHASE_STRIP = NO; 332 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 333 | ENABLE_NS_ASSERTIONS = NO; 334 | ENABLE_STRICT_OBJC_MSGSEND = YES; 335 | GCC_C_LANGUAGE_STANDARD = gnu99; 336 | GCC_NO_COMMON_BLOCKS = YES; 337 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 338 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 339 | GCC_WARN_UNDECLARED_SELECTOR = YES; 340 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 341 | GCC_WARN_UNUSED_FUNCTION = YES; 342 | GCC_WARN_UNUSED_VARIABLE = YES; 343 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 344 | MTL_ENABLE_DEBUG_INFO = NO; 345 | SDKROOT = iphoneos; 346 | SUPPORTED_PLATFORMS = iphoneos; 347 | TARGETED_DEVICE_FAMILY = "1,2"; 348 | VALIDATE_PRODUCT = YES; 349 | }; 350 | name = Profile; 351 | }; 352 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 353 | isa = XCBuildConfiguration; 354 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 355 | buildSettings = { 356 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 357 | CLANG_ENABLE_MODULES = YES; 358 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 359 | ENABLE_BITCODE = NO; 360 | INFOPLIST_FILE = Runner/Info.plist; 361 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 362 | PRODUCT_BUNDLE_IDENTIFIER = com.example.examplee; 363 | PRODUCT_NAME = "$(TARGET_NAME)"; 364 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 365 | SWIFT_VERSION = 5.0; 366 | VERSIONING_SYSTEM = "apple-generic"; 367 | }; 368 | name = Profile; 369 | }; 370 | 97C147031CF9000F007C117D /* Debug */ = { 371 | isa = XCBuildConfiguration; 372 | buildSettings = { 373 | ALWAYS_SEARCH_USER_PATHS = NO; 374 | CLANG_ANALYZER_NONNULL = YES; 375 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 376 | CLANG_CXX_LIBRARY = "libc++"; 377 | CLANG_ENABLE_MODULES = YES; 378 | CLANG_ENABLE_OBJC_ARC = YES; 379 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 380 | CLANG_WARN_BOOL_CONVERSION = YES; 381 | CLANG_WARN_COMMA = YES; 382 | CLANG_WARN_CONSTANT_CONVERSION = YES; 383 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 384 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 385 | CLANG_WARN_EMPTY_BODY = YES; 386 | CLANG_WARN_ENUM_CONVERSION = YES; 387 | CLANG_WARN_INFINITE_RECURSION = YES; 388 | CLANG_WARN_INT_CONVERSION = YES; 389 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 390 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 391 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 392 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 393 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 394 | CLANG_WARN_STRICT_PROTOTYPES = YES; 395 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 396 | CLANG_WARN_UNREACHABLE_CODE = YES; 397 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 398 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 399 | COPY_PHASE_STRIP = NO; 400 | DEBUG_INFORMATION_FORMAT = dwarf; 401 | ENABLE_STRICT_OBJC_MSGSEND = YES; 402 | ENABLE_TESTABILITY = YES; 403 | GCC_C_LANGUAGE_STANDARD = gnu99; 404 | GCC_DYNAMIC_NO_PIC = NO; 405 | GCC_NO_COMMON_BLOCKS = YES; 406 | GCC_OPTIMIZATION_LEVEL = 0; 407 | GCC_PREPROCESSOR_DEFINITIONS = ( 408 | "DEBUG=1", 409 | "$(inherited)", 410 | ); 411 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 412 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 413 | GCC_WARN_UNDECLARED_SELECTOR = YES; 414 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 415 | GCC_WARN_UNUSED_FUNCTION = YES; 416 | GCC_WARN_UNUSED_VARIABLE = YES; 417 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 418 | MTL_ENABLE_DEBUG_INFO = YES; 419 | ONLY_ACTIVE_ARCH = YES; 420 | SDKROOT = iphoneos; 421 | TARGETED_DEVICE_FAMILY = "1,2"; 422 | }; 423 | name = Debug; 424 | }; 425 | 97C147041CF9000F007C117D /* Release */ = { 426 | isa = XCBuildConfiguration; 427 | buildSettings = { 428 | ALWAYS_SEARCH_USER_PATHS = NO; 429 | CLANG_ANALYZER_NONNULL = YES; 430 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 431 | CLANG_CXX_LIBRARY = "libc++"; 432 | CLANG_ENABLE_MODULES = YES; 433 | CLANG_ENABLE_OBJC_ARC = YES; 434 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 435 | CLANG_WARN_BOOL_CONVERSION = YES; 436 | CLANG_WARN_COMMA = YES; 437 | CLANG_WARN_CONSTANT_CONVERSION = YES; 438 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 439 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 440 | CLANG_WARN_EMPTY_BODY = YES; 441 | CLANG_WARN_ENUM_CONVERSION = YES; 442 | CLANG_WARN_INFINITE_RECURSION = YES; 443 | CLANG_WARN_INT_CONVERSION = YES; 444 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 445 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 446 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 447 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 448 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 449 | CLANG_WARN_STRICT_PROTOTYPES = YES; 450 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 451 | CLANG_WARN_UNREACHABLE_CODE = YES; 452 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 453 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 454 | COPY_PHASE_STRIP = NO; 455 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 456 | ENABLE_NS_ASSERTIONS = NO; 457 | ENABLE_STRICT_OBJC_MSGSEND = YES; 458 | GCC_C_LANGUAGE_STANDARD = gnu99; 459 | GCC_NO_COMMON_BLOCKS = YES; 460 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 461 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 462 | GCC_WARN_UNDECLARED_SELECTOR = YES; 463 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 464 | GCC_WARN_UNUSED_FUNCTION = YES; 465 | GCC_WARN_UNUSED_VARIABLE = YES; 466 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 467 | MTL_ENABLE_DEBUG_INFO = NO; 468 | SDKROOT = iphoneos; 469 | SUPPORTED_PLATFORMS = iphoneos; 470 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 471 | TARGETED_DEVICE_FAMILY = "1,2"; 472 | VALIDATE_PRODUCT = YES; 473 | }; 474 | name = Release; 475 | }; 476 | 97C147061CF9000F007C117D /* Debug */ = { 477 | isa = XCBuildConfiguration; 478 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 479 | buildSettings = { 480 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 481 | CLANG_ENABLE_MODULES = YES; 482 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 483 | ENABLE_BITCODE = NO; 484 | INFOPLIST_FILE = Runner/Info.plist; 485 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 486 | PRODUCT_BUNDLE_IDENTIFIER = com.example.examplee; 487 | PRODUCT_NAME = "$(TARGET_NAME)"; 488 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 489 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 490 | SWIFT_VERSION = 5.0; 491 | VERSIONING_SYSTEM = "apple-generic"; 492 | }; 493 | name = Debug; 494 | }; 495 | 97C147071CF9000F007C117D /* Release */ = { 496 | isa = XCBuildConfiguration; 497 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 498 | buildSettings = { 499 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 500 | CLANG_ENABLE_MODULES = YES; 501 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 502 | ENABLE_BITCODE = NO; 503 | INFOPLIST_FILE = Runner/Info.plist; 504 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 505 | PRODUCT_BUNDLE_IDENTIFIER = com.example.examplee; 506 | PRODUCT_NAME = "$(TARGET_NAME)"; 507 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 508 | SWIFT_VERSION = 5.0; 509 | VERSIONING_SYSTEM = "apple-generic"; 510 | }; 511 | name = Release; 512 | }; 513 | /* End XCBuildConfiguration section */ 514 | 515 | /* Begin XCConfigurationList section */ 516 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 517 | isa = XCConfigurationList; 518 | buildConfigurations = ( 519 | 97C147031CF9000F007C117D /* Debug */, 520 | 97C147041CF9000F007C117D /* Release */, 521 | 249021D3217E4FDB00AE95B9 /* Profile */, 522 | ); 523 | defaultConfigurationIsVisible = 0; 524 | defaultConfigurationName = Release; 525 | }; 526 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 527 | isa = XCConfigurationList; 528 | buildConfigurations = ( 529 | 97C147061CF9000F007C117D /* Debug */, 530 | 97C147071CF9000F007C117D /* Release */, 531 | 249021D4217E4FDB00AE95B9 /* Profile */, 532 | ); 533 | defaultConfigurationIsVisible = 0; 534 | defaultConfigurationName = Release; 535 | }; 536 | /* End XCConfigurationList section */ 537 | }; 538 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 539 | } 540 | --------------------------------------------------------------------------------