├── .gitignore
├── .metadata
├── CHANGELOG.md
├── LICENSE
├── README.md
├── README_CN.md
├── example
├── .gitignore
├── .metadata
├── README.md
├── android
│ ├── .gitignore
│ ├── app
│ │ ├── build.gradle
│ │ └── src
│ │ │ ├── debug
│ │ │ └── AndroidManifest.xml
│ │ │ ├── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── kotlin
│ │ │ │ └── com
│ │ │ │ │ └── example
│ │ │ │ │ ├── example
│ │ │ │ │ └── MainActivity.kt
│ │ │ │ │ └── updater_example
│ │ │ │ │ └── MainActivity.kt
│ │ │ └── res
│ │ │ │ ├── drawable
│ │ │ │ └── launch_background.xml
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ └── values
│ │ │ │ └── styles.xml
│ │ │ └── profile
│ │ │ └── AndroidManifest.xml
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ └── gradle-wrapper.properties
│ └── settings.gradle
├── build
│ ├── c075001b96339384a97db4862b8ab8db.cache.dill.track.dill
│ ├── da2da75b34b60d753ee6868cf1a196d7
│ │ ├── _composite.stamp
│ │ ├── gen_dart_plugin_registrant.stamp
│ │ └── gen_localizations.stamp
│ └── web
│ │ ├── .last_build_id
│ │ ├── assets
│ │ ├── AssetManifest.json
│ │ ├── FontManifest.json
│ │ ├── NOTICES
│ │ ├── fonts
│ │ │ └── MaterialIcons-Regular.otf
│ │ ├── images
│ │ │ ├── github.png
│ │ │ └── mytemplate.png
│ │ └── packages
│ │ │ ├── cupertino_icons
│ │ │ └── assets
│ │ │ │ └── CupertinoIcons.ttf
│ │ │ └── flutter_beautiful_popup
│ │ │ └── img
│ │ │ └── bg
│ │ │ ├── authentication.png
│ │ │ ├── camera.png
│ │ │ ├── coin.png
│ │ │ ├── fail.png
│ │ │ ├── geolocation.png
│ │ │ ├── gift.png
│ │ │ ├── notification.png
│ │ │ ├── red_packet.png
│ │ │ ├── rocket_blue.png
│ │ │ ├── rocket_green.png
│ │ │ ├── rocket_orange.png
│ │ │ ├── rocket_orange_2.png
│ │ │ ├── success.png
│ │ │ ├── term.png
│ │ │ └── thumb.png
│ │ ├── flutter_service_worker.js
│ │ ├── index.html
│ │ ├── main.dart.js
│ │ └── version.json
├── images
│ ├── github.png
│ ├── mytemplate.png
│ └── show.gif
├── ios
│ ├── .gitignore
│ ├── Flutter
│ │ ├── AppFrameworkInfo.plist
│ │ ├── Debug.xcconfig
│ │ └── Release.xcconfig
│ ├── Podfile
│ ├── Podfile.lock
│ ├── Runner.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ └── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Runner.xcscheme
│ ├── Runner.xcworkspace
│ │ └── contents.xcworkspacedata
│ └── Runner
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ ├── Contents.json
│ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ ├── Icon-App-20x20@1x.png
│ │ │ ├── Icon-App-20x20@2x.png
│ │ │ ├── Icon-App-20x20@3x.png
│ │ │ ├── Icon-App-29x29@1x.png
│ │ │ ├── Icon-App-29x29@2x.png
│ │ │ ├── Icon-App-29x29@3x.png
│ │ │ ├── Icon-App-40x40@1x.png
│ │ │ ├── Icon-App-40x40@2x.png
│ │ │ ├── Icon-App-40x40@3x.png
│ │ │ ├── Icon-App-60x60@2x.png
│ │ │ ├── Icon-App-60x60@3x.png
│ │ │ ├── Icon-App-76x76@1x.png
│ │ │ ├── Icon-App-76x76@2x.png
│ │ │ └── Icon-App-83.5x83.5@2x.png
│ │ └── LaunchImage.imageset
│ │ │ ├── Contents.json
│ │ │ ├── LaunchImage.png
│ │ │ ├── LaunchImage@2x.png
│ │ │ ├── LaunchImage@3x.png
│ │ │ └── README.md
│ │ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ └── Runner-Bridging-Header.h
├── lib
│ ├── MyTemplate.dart
│ └── main.dart
├── pubspec.lock
├── pubspec.yaml
├── test
│ └── widget_test.dart
└── web
│ └── index.html
├── img
├── bg
│ ├── authentication.png
│ ├── camera.png
│ ├── coin.png
│ ├── fail.png
│ ├── geolocation.png
│ ├── gift.png
│ ├── notification.png
│ ├── red_packet.png
│ ├── rocket_blue.png
│ ├── rocket_green.png
│ ├── rocket_orange.png
│ ├── rocket_orange_2.png
│ ├── success.png
│ ├── term.png
│ └── thumb.png
└── source
│ └── gift.ai
├── lib
├── main.dart
└── templates
│ ├── Authentication.dart
│ ├── BlueRocket.dart
│ ├── Camera.dart
│ ├── Coin.dart
│ ├── Common.dart
│ ├── Fail.dart
│ ├── Geolocation.dart
│ ├── Gift.dart
│ ├── GreenRocket.dart
│ ├── Notification.dart
│ ├── OrangeRocket.dart
│ ├── OrangeRocket2.dart
│ ├── RedPacket.dart
│ ├── Success.dart
│ ├── Term.dart
│ └── Thumb.dart
├── pubspec.lock
├── pubspec.yaml
└── test
└── beautiful_popup_test.dart
/.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 | # build
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/app
32 | build/flutter_assets
33 | build/kotlin
34 |
35 | # Android related
36 | **/android/**/gradle-wrapper.jar
37 | **/android/.gradle
38 | **/android/captures/
39 | **/android/gradlew
40 | **/android/gradlew.bat
41 | **/android/local.properties
42 | **/android/**/GeneratedPluginRegistrant.java
43 |
44 | # iOS/XCode related
45 | **/ios/**/*.mode1v3
46 | **/ios/**/*.mode2v3
47 | **/ios/**/*.moved-aside
48 | **/ios/**/*.pbxuser
49 | **/ios/**/*.perspectivev3
50 | **/ios/**/*sync/
51 | **/ios/**/.sconsign.dblite
52 | **/ios/**/.tags*
53 | **/ios/**/.vagrant/
54 | **/ios/**/DerivedData/
55 | **/ios/**/Icon?
56 | **/ios/**/Pods/
57 | **/ios/**/.symlinks/
58 | **/ios/**/profile
59 | **/ios/**/xcuserdata
60 | **/ios/.generated/
61 | **/ios/Flutter/App.framework
62 | **/ios/Flutter/Flutter.framework
63 | **/ios/Flutter/Flutter.podspec
64 | **/ios/Flutter/Generated.xcconfig
65 | **/ios/Flutter/app.flx
66 | **/ios/Flutter/app.zip
67 | **/ios/Flutter/flutter_assets/
68 | **/ios/Flutter/flutter_export_environment.sh
69 | **/ios/ServiceDefinitions.json
70 | **/ios/Runner/GeneratedPluginRegistrant.*
71 |
72 | # Exceptions to above rules.
73 | !**/ios/**/default.mode1v3
74 | !**/ios/**/default.mode2v3
75 | !**/ios/**/default.pbxuser
76 | !**/ios/**/default.perspectivev3
77 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
78 |
--------------------------------------------------------------------------------
/.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: f40dbf8ca07b0498eff3d6b861ecd21f2de7db6a
8 | channel: dev
9 |
10 | project_type: package
11 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## [1.7.0] - Compatible with SDK 2.5.0
2 |
3 |
4 | ## [1.6.0] - Migrated to null safety
5 |
6 | * Migrated to null safety
7 |
8 |
9 | ## [0.0.1] - TODO: Add release date.
10 |
11 | * TODO: Describe initial release.
12 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | BSD 3-Clause License
2 |
3 | Copyright (c) 2020, 1169886116
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions are met:
8 |
9 | 1. Redistributions of source code must retain the above copyright notice, this
10 | list of conditions and the following disclaimer.
11 |
12 | 2. Redistributions in binary form must reproduce the above copyright notice,
13 | this list of conditions and the following disclaimer in the documentation
14 | and/or other materials provided with the distribution.
15 |
16 | 3. Neither the name of the copyright holder nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # flutter_beautiful_popup [中文](https://github.com/jaweii/Flutter_beautiful_popup/blob/master/README_CN.md)
2 |
3 | A flutter package to help you beautify your app popup, can be used in all platform.[Live Demo](https://jaweii.github.io/Flutter_beautiful_popup/example/build/web/#/).
4 |
5 | ## Preview:
6 |
7 |
8 |
9 | ## Getting Started
10 |
11 | Add dependency to you `pubspec.yaml`:
12 |
13 | ```
14 | dependencies:
15 | flutter_beautiful_popup: ^1.7.0
16 | ```
17 |
18 | Import the dependency:
19 |
20 | ```
21 | import 'package:flutter_beautiful_popup/main.dart';
22 | ```
23 |
24 | And then you can display a popup with certain template like this:
25 |
26 | ```
27 | final popup = BeautifulPopup(
28 | context: context,
29 | template: TemplateGift,
30 | );
31 | popup.show(
32 | title: 'String or Widget',
33 | content: 'String or Widget',
34 | actions: [
35 | popup.button(
36 | label: 'Close',
37 | onPressed: Navigator.of(context).pop,
38 | ),
39 | ],
40 | // bool barrierDismissible = false,
41 | // Widget close,
42 | );
43 | ```
44 |
45 | If you wan to `recolor` the illustration of the template, you can call the `recolor` method, but this function takes a little time to caculate/offset the color cahnnel of the illustration:
46 |
47 | ```
48 | final newColor = Colors.red.withOpacity(0.5);
49 | await popup.recolor(newColor);
50 | ```
51 |
52 | All available templates you can find in [Live Demo](https://jaweii.github.io/Flutter_beautiful_popup/example/build/web/#/).
53 |
54 | ## Customize your own BeautifulPopupTemplate
55 |
56 | You can extend `BeautifulPopupTemplate` to customize your own template like this:
57 |
58 | ```
59 | import 'package:flutter/material.dart';
60 | import 'package:flutter_beautiful_popup/main.dart';
61 |
62 | class MyTemplate extends BeautifulPopupTemplate {
63 | final BeautifulPopup options;
64 | MyTemplate(this.options) : super(options);
65 |
66 | @override
67 | final illustrationKey = 'images/mytemplate.png';
68 | @override
69 | Color get primaryColor => options.primaryColor ?? Color(0xff000000); // The default primary color of the template is Colors.black.
70 | @override
71 | final maxWidth = 400; // In most situations, the value is the illustration size.
72 | @override
73 | final maxHeight = 600;
74 | @override
75 | final bodyMargin = 10;
76 |
77 | // You need to adjust the layout to fit into your illustration.
78 | @override
79 | get layout {
80 | return [
81 | Positioned(
82 | child: background,
83 | ),
84 | Positioned(
85 | top: percentH(10),
86 | child: title,
87 | ),
88 | Positioned(
89 | top: percentH(40),
90 | height: percentH(actions == null ? 32 : 42),
91 | left: percentW(10),
92 | right: percentW(10),
93 | child: content,
94 | ),
95 | Positioned(
96 | bottom: percentW(10),
97 | left: percentW(10),
98 | right: percentW(10),
99 | child: actions ?? Container(),
100 | ),
101 | ];
102 | }
103 | }
104 | ```
105 |
106 | To display a popup with your own template:
107 |
108 | ```
109 | final popup = BeautifulPopup.customize(
110 | context: context,
111 | build: (options) => MyTemplate(options),
112 | );
113 | popup.show(
114 | title: 'Example',
115 | content: Container(
116 | color: Colors.black12,
117 | child: Text(
118 | 'This popup shows you how to customize your own BeautifulPopupTemplate.'),
119 | ),
120 | actions: [
121 | popup.button(
122 | label: 'Code',
123 | onPressed: () {
124 | js.context.callMethod('open', [
125 | 'https://github.com/jaweii/Flutter_beautiful_popup/blob/master/example/lib/MyTemplate.dart'
126 | ]);
127 | },
128 | ),
129 | ],
130 | );
131 | ```
132 |
133 | ## Contributor
134 |
135 |
136 |
137 |
138 |
--------------------------------------------------------------------------------
/README_CN.md:
--------------------------------------------------------------------------------
1 | # flutter_beautiful_popup
2 |
3 | beautiful_popup, 承包你的应用弹窗。[Live Demo](https://jaweii.github.io/Flutter_beautiful_popup/example/build/web/#/)
4 |
5 | ## 效果图:
6 |
7 |
8 |
9 | ## 使用
10 |
11 | 添加依赖项到 `pubspec.yaml`:
12 |
13 | ```
14 | dependencies:
15 | flutter_beautiful_popup: ^1.7.0
16 | ```
17 |
18 | 引入依赖项:
19 |
20 | ```
21 | import 'package:flutter_beautiful_popup/main.dart';
22 | ```
23 |
24 | 然后你就可以用指定的模板,显示一个漂亮的弹窗:
25 |
26 | ```
27 | final popup = BeautifulPopup(
28 | context: context,
29 | template: TemplateGift,
30 | );
31 | popup.show(
32 | title: 'String or Widget',
33 | content: 'String or Widget',
34 | actions: [
35 | popup.button(
36 | label: 'Close',
37 | onPressed: Navigator.of(context).pop,
38 | ),
39 | ]
40 | );
41 | ```
42 |
43 | 插件有给插图重新上色的功能,只需要调用`recolor`方法就可以了。但是这个方法需要花一点时间(通常2秒左右)去计算和偏移颜色通道。
44 |
45 | ```
46 | final newColor = Colors.red.withOpacity(0.5);
47 | await popup.recolor(newColor);
48 | ```
49 |
50 | 所有的可用模板,轻参考[Demo](https://jaweii.github.io/Flutter_beautiful_popup/example/build/web/#/).
51 |
52 | ## 定制你自己的模板
53 |
54 | 你可以通过继承 `BeautifulPopupTemplate` 类来定制你自己的模板:
55 |
56 | ```
57 | import 'package:flutter/material.dart';
58 | import 'package:flutter_beautiful_popup/main.dart';
59 |
60 | class MyTemplate extends BeautifulPopupTemplate {
61 | final BeautifulPopup options;
62 | MyTemplate(this.options) : super(options);
63 |
64 | @override
65 | final illustrationKey = 'images/mytemplate.png';
66 | @override
67 | Color get primaryColor => options.primaryColor ?? Color(0xff000000); // The default primary color of the template is Colors.black.
68 | @override
69 | final maxWidth = 400; // In most situations, the value is the illustration size.
70 | @override
71 | final maxHeight = 600;
72 | @override
73 | final bodyMargin = 10;
74 |
75 | // You need to adjust the layout to fit into your illustration.
76 | @override
77 | get layout {
78 | return [
79 | Positioned(
80 | child: background,
81 | ),
82 | Positioned(
83 | top: percentH(10),
84 | child: title,
85 | ),
86 | Positioned(
87 | top: percentH(40),
88 | height: percentH(actions == null ? 32 : 42),
89 | left: percentW(10),
90 | right: percentW(10),
91 | child: content,
92 | ),
93 | Positioned(
94 | bottom: percentW(10),
95 | left: percentW(10),
96 | right: percentW(10),
97 | child: actions ?? Container(),
98 | ),
99 | ];
100 | }
101 | }
102 | ```
103 |
104 | 用你自己的模板显示弹窗:
105 |
106 | ```
107 | final popup = BeautifulPopup.customize(
108 | context: context,
109 | build: (options) => MyTemplate(options),
110 | );
111 | popup.show(
112 | title: 'Example',
113 | content: Container(
114 | color: Colors.black12,
115 | child: Text(
116 | 'This popup shows you how to customize your own BeautifulPopupTemplate.'),
117 | ),
118 | actions: [
119 | popup.button(
120 | label: 'Code',
121 | onPressed: () {
122 | js.context.callMethod('open', [
123 | 'https://github.com/jaweii/Flutter_beautiful_popup/blob/master/example/lib/MyTemplate.dart'
124 | ]);
125 | },
126 | ),
127 | ],
128 | );
129 | ```
130 |
131 | ## 贡献
132 |
133 | ## 协议
134 |
135 | [MIT](http://opensource.org/licenses/MIT)
136 |
137 |
--------------------------------------------------------------------------------
/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 | .dart_tool/
26 | .flutter-plugins
27 | .flutter-plugins-dependencies
28 | .packages
29 | .pub-cache/
30 | .pub/
31 | build/app
32 | build/flutter_assets
33 | build/kotlin
34 | # Web related
35 | lib/generated_plugin_registrant.dart
36 |
37 | # Exceptions to above rules.
38 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
39 |
--------------------------------------------------------------------------------
/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: f40dbf8ca07b0498eff3d6b861ecd21f2de7db6a
8 | channel: dev
9 |
10 | project_type: app
11 |
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | # updater_example
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 |
--------------------------------------------------------------------------------
/example/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
--------------------------------------------------------------------------------
/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 28
30 |
31 | sourceSets {
32 | main.java.srcDirs += 'src/main/kotlin'
33 | }
34 |
35 | lintOptions {
36 | disable 'InvalidPackage'
37 | }
38 |
39 | defaultConfig {
40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
41 | applicationId "com.example.updater_example"
42 | minSdkVersion 16
43 | targetSdkVersion 28
44 | versionCode flutterVersionCode.toInteger()
45 | versionName flutterVersionName
46 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
47 | }
48 |
49 | buildTypes {
50 | release {
51 | // TODO: Add your own signing config for the release build.
52 | // Signing with the debug keys for now, so `flutter run --release` works.
53 | signingConfig signingConfigs.debug
54 | }
55 | }
56 | }
57 |
58 | flutter {
59 | source '../..'
60 | }
61 |
62 | dependencies {
63 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
64 | testImplementation 'junit:junit:4.12'
65 | androidTestImplementation 'androidx.test:runner:1.1.1'
66 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
67 | }
68 |
--------------------------------------------------------------------------------
/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
13 |
17 |
20 |
23 |
24 |
25 |
26 |
27 |
28 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.example
2 |
3 | import androidx.annotation.NonNull;
4 | import io.flutter.embedding.android.FlutterActivity
5 | import io.flutter.embedding.engine.FlutterEngine
6 | import io.flutter.plugins.GeneratedPluginRegistrant
7 |
8 | class MainActivity: FlutterActivity() {
9 | }
10 |
--------------------------------------------------------------------------------
/example/android/app/src/main/kotlin/com/example/updater_example/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.updater_example
2 |
3 | import android.os.Bundle
4 | import io.flutter.embedding.android.FlutterActivity
5 | import io.flutter.plugins.GeneratedPluginRegistrant
6 |
7 | class MainActivity: FlutterActivity() {
8 | }
9 |
--------------------------------------------------------------------------------
/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/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/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/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/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/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/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/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/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/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
11 |
12 |
--------------------------------------------------------------------------------
/example/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/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:3.5.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/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.enableR8=true
3 | android.useAndroidX=true
4 | android.enableJetifier=true
5 |
--------------------------------------------------------------------------------
/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-5.6.2-all.zip
7 |
--------------------------------------------------------------------------------
/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
4 |
5 | def plugins = new Properties()
6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
7 | if (pluginsFile.exists()) {
8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
9 | }
10 |
11 | plugins.each { name, path ->
12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
13 | include ":$name"
14 | project(":$name").projectDir = pluginDirectory
15 | }
16 |
--------------------------------------------------------------------------------
/example/build/c075001b96339384a97db4862b8ab8db.cache.dill.track.dill:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/example/build/c075001b96339384a97db4862b8ab8db.cache.dill.track.dill
--------------------------------------------------------------------------------
/example/build/da2da75b34b60d753ee6868cf1a196d7/_composite.stamp:
--------------------------------------------------------------------------------
1 | {"inputs":[],"outputs":[]}
--------------------------------------------------------------------------------
/example/build/da2da75b34b60d753ee6868cf1a196d7/gen_dart_plugin_registrant.stamp:
--------------------------------------------------------------------------------
1 | {"inputs":[],"outputs":[]}
--------------------------------------------------------------------------------
/example/build/da2da75b34b60d753ee6868cf1a196d7/gen_localizations.stamp:
--------------------------------------------------------------------------------
1 | {"inputs":[],"outputs":[]}
--------------------------------------------------------------------------------
/example/build/web/.last_build_id:
--------------------------------------------------------------------------------
1 | 84eec494fbee080600a8e4af15280059
--------------------------------------------------------------------------------
/example/build/web/assets/AssetManifest.json:
--------------------------------------------------------------------------------
1 | {"images/github.png":["images/github.png"],"images/mytemplate.png":["images/mytemplate.png"],"packages/cupertino_icons/assets/CupertinoIcons.ttf":["packages/cupertino_icons/assets/CupertinoIcons.ttf"],"packages/flutter_beautiful_popup/img/bg/authentication.png":["packages/flutter_beautiful_popup/img/bg/authentication.png"],"packages/flutter_beautiful_popup/img/bg/camera.png":["packages/flutter_beautiful_popup/img/bg/camera.png"],"packages/flutter_beautiful_popup/img/bg/coin.png":["packages/flutter_beautiful_popup/img/bg/coin.png"],"packages/flutter_beautiful_popup/img/bg/fail.png":["packages/flutter_beautiful_popup/img/bg/fail.png"],"packages/flutter_beautiful_popup/img/bg/geolocation.png":["packages/flutter_beautiful_popup/img/bg/geolocation.png"],"packages/flutter_beautiful_popup/img/bg/gift.png":["packages/flutter_beautiful_popup/img/bg/gift.png"],"packages/flutter_beautiful_popup/img/bg/notification.png":["packages/flutter_beautiful_popup/img/bg/notification.png"],"packages/flutter_beautiful_popup/img/bg/red_packet.png":["packages/flutter_beautiful_popup/img/bg/red_packet.png"],"packages/flutter_beautiful_popup/img/bg/rocket_blue.png":["packages/flutter_beautiful_popup/img/bg/rocket_blue.png"],"packages/flutter_beautiful_popup/img/bg/rocket_green.png":["packages/flutter_beautiful_popup/img/bg/rocket_green.png"],"packages/flutter_beautiful_popup/img/bg/rocket_orange.png":["packages/flutter_beautiful_popup/img/bg/rocket_orange.png"],"packages/flutter_beautiful_popup/img/bg/rocket_orange_2.png":["packages/flutter_beautiful_popup/img/bg/rocket_orange_2.png"],"packages/flutter_beautiful_popup/img/bg/success.png":["packages/flutter_beautiful_popup/img/bg/success.png"],"packages/flutter_beautiful_popup/img/bg/term.png":["packages/flutter_beautiful_popup/img/bg/term.png"],"packages/flutter_beautiful_popup/img/bg/thumb.png":["packages/flutter_beautiful_popup/img/bg/thumb.png"]}
--------------------------------------------------------------------------------
/example/build/web/assets/FontManifest.json:
--------------------------------------------------------------------------------
1 | [{"family":"MaterialIcons","fonts":[{"asset":"fonts/MaterialIcons-Regular.otf"}]},{"family":"packages/cupertino_icons/CupertinoIcons","fonts":[{"asset":"packages/cupertino_icons/assets/CupertinoIcons.ttf"}]}]
--------------------------------------------------------------------------------
/example/build/web/assets/fonts/MaterialIcons-Regular.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/example/build/web/assets/fonts/MaterialIcons-Regular.otf
--------------------------------------------------------------------------------
/example/build/web/assets/images/github.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/example/build/web/assets/images/github.png
--------------------------------------------------------------------------------
/example/build/web/assets/images/mytemplate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/example/build/web/assets/images/mytemplate.png
--------------------------------------------------------------------------------
/example/build/web/assets/packages/cupertino_icons/assets/CupertinoIcons.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/example/build/web/assets/packages/cupertino_icons/assets/CupertinoIcons.ttf
--------------------------------------------------------------------------------
/example/build/web/assets/packages/flutter_beautiful_popup/img/bg/authentication.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/example/build/web/assets/packages/flutter_beautiful_popup/img/bg/authentication.png
--------------------------------------------------------------------------------
/example/build/web/assets/packages/flutter_beautiful_popup/img/bg/camera.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/example/build/web/assets/packages/flutter_beautiful_popup/img/bg/camera.png
--------------------------------------------------------------------------------
/example/build/web/assets/packages/flutter_beautiful_popup/img/bg/coin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/example/build/web/assets/packages/flutter_beautiful_popup/img/bg/coin.png
--------------------------------------------------------------------------------
/example/build/web/assets/packages/flutter_beautiful_popup/img/bg/fail.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/example/build/web/assets/packages/flutter_beautiful_popup/img/bg/fail.png
--------------------------------------------------------------------------------
/example/build/web/assets/packages/flutter_beautiful_popup/img/bg/geolocation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/example/build/web/assets/packages/flutter_beautiful_popup/img/bg/geolocation.png
--------------------------------------------------------------------------------
/example/build/web/assets/packages/flutter_beautiful_popup/img/bg/gift.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/example/build/web/assets/packages/flutter_beautiful_popup/img/bg/gift.png
--------------------------------------------------------------------------------
/example/build/web/assets/packages/flutter_beautiful_popup/img/bg/notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/example/build/web/assets/packages/flutter_beautiful_popup/img/bg/notification.png
--------------------------------------------------------------------------------
/example/build/web/assets/packages/flutter_beautiful_popup/img/bg/red_packet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/example/build/web/assets/packages/flutter_beautiful_popup/img/bg/red_packet.png
--------------------------------------------------------------------------------
/example/build/web/assets/packages/flutter_beautiful_popup/img/bg/rocket_blue.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/example/build/web/assets/packages/flutter_beautiful_popup/img/bg/rocket_blue.png
--------------------------------------------------------------------------------
/example/build/web/assets/packages/flutter_beautiful_popup/img/bg/rocket_green.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/example/build/web/assets/packages/flutter_beautiful_popup/img/bg/rocket_green.png
--------------------------------------------------------------------------------
/example/build/web/assets/packages/flutter_beautiful_popup/img/bg/rocket_orange.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/example/build/web/assets/packages/flutter_beautiful_popup/img/bg/rocket_orange.png
--------------------------------------------------------------------------------
/example/build/web/assets/packages/flutter_beautiful_popup/img/bg/rocket_orange_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/example/build/web/assets/packages/flutter_beautiful_popup/img/bg/rocket_orange_2.png
--------------------------------------------------------------------------------
/example/build/web/assets/packages/flutter_beautiful_popup/img/bg/success.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/example/build/web/assets/packages/flutter_beautiful_popup/img/bg/success.png
--------------------------------------------------------------------------------
/example/build/web/assets/packages/flutter_beautiful_popup/img/bg/term.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/example/build/web/assets/packages/flutter_beautiful_popup/img/bg/term.png
--------------------------------------------------------------------------------
/example/build/web/assets/packages/flutter_beautiful_popup/img/bg/thumb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/example/build/web/assets/packages/flutter_beautiful_popup/img/bg/thumb.png
--------------------------------------------------------------------------------
/example/build/web/flutter_service_worker.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 | const MANIFEST = 'flutter-app-manifest';
3 | const TEMP = 'flutter-temp-cache';
4 | const CACHE_NAME = 'flutter-app-cache';
5 | const RESOURCES = {
6 | "version.json": "4b6db237b3514a88107a422469adfb0f",
7 | "index.html": "9696a2da5cbd5a0c4994e7194ddf7d08",
8 | "/": "9696a2da5cbd5a0c4994e7194ddf7d08",
9 | "main.dart.js": "533f759ba0c9783f8ca47fcc40ef7f16",
10 | "assets/images/github.png": "493e7b4f750309901787bba34722c0eb",
11 | "assets/images/mytemplate.png": "31bf7c816364acc78d7a549fb1ab3449",
12 | "assets/AssetManifest.json": "aece31b679d6ce288bc7922a1362327a",
13 | "assets/NOTICES": "d6e9cd33985c75e3a5b6b9c3070fb1c3",
14 | "assets/FontManifest.json": "dc3d03800ccca4601324923c0b1d6d57",
15 | "assets/packages/cupertino_icons/assets/CupertinoIcons.ttf": "115e937bb829a890521f72d2e664b632",
16 | "assets/packages/flutter_beautiful_popup/img/bg/authentication.png": "f35a4b18ce208c1a061b5b8e37f5c831",
17 | "assets/packages/flutter_beautiful_popup/img/bg/term.png": "b926bcb493dd4f2149ddc1e6332aa978",
18 | "assets/packages/flutter_beautiful_popup/img/bg/geolocation.png": "60467d11beb395f49687f6767093eeca",
19 | "assets/packages/flutter_beautiful_popup/img/bg/rocket_orange_2.png": "18b4c81e68a42ae97f7ade84cd6a893a",
20 | "assets/packages/flutter_beautiful_popup/img/bg/red_packet.png": "3b9fb0d40d45c496eb6fdac6095c442e",
21 | "assets/packages/flutter_beautiful_popup/img/bg/rocket_blue.png": "d25afc3a9c26c2cbdd3f7d11e09958be",
22 | "assets/packages/flutter_beautiful_popup/img/bg/gift.png": "9a75d6e641acc3d583c8a175d188a101",
23 | "assets/packages/flutter_beautiful_popup/img/bg/success.png": "a7bf30ab41d44b9c52512b3cb5d813f3",
24 | "assets/packages/flutter_beautiful_popup/img/bg/rocket_green.png": "a6a384e73842482c3ab7424f78358cec",
25 | "assets/packages/flutter_beautiful_popup/img/bg/rocket_orange.png": "19fd0b66488935b9ec95b58a604c4f4e",
26 | "assets/packages/flutter_beautiful_popup/img/bg/camera.png": "91b3327967e4e02747721a5f0d2fee9f",
27 | "assets/packages/flutter_beautiful_popup/img/bg/coin.png": "cabd80db0d1f5aff7e881cb4267e2468",
28 | "assets/packages/flutter_beautiful_popup/img/bg/notification.png": "b59cdd09d90f87673ddab1e97ec3e1cf",
29 | "assets/packages/flutter_beautiful_popup/img/bg/fail.png": "8cc3ffefbf01c756932d25b62e6031ba",
30 | "assets/packages/flutter_beautiful_popup/img/bg/thumb.png": "5b4693a8b6ff65d3dc619415e2bee11e",
31 | "assets/fonts/MaterialIcons-Regular.otf": "4e6447691c9509f7acdbf8a931a85ca1"
32 | };
33 |
34 | // The application shell files that are downloaded before a service worker can
35 | // start.
36 | const CORE = [
37 | "/",
38 | "main.dart.js",
39 | "index.html",
40 | "assets/NOTICES",
41 | "assets/AssetManifest.json",
42 | "assets/FontManifest.json"];
43 | // During install, the TEMP cache is populated with the application shell files.
44 | self.addEventListener("install", (event) => {
45 | self.skipWaiting();
46 | return event.waitUntil(
47 | caches.open(TEMP).then((cache) => {
48 | return cache.addAll(
49 | CORE.map((value) => new Request(value, {'cache': 'reload'})));
50 | })
51 | );
52 | });
53 |
54 | // During activate, the cache is populated with the temp files downloaded in
55 | // install. If this service worker is upgrading from one with a saved
56 | // MANIFEST, then use this to retain unchanged resource files.
57 | self.addEventListener("activate", function(event) {
58 | return event.waitUntil(async function() {
59 | try {
60 | var contentCache = await caches.open(CACHE_NAME);
61 | var tempCache = await caches.open(TEMP);
62 | var manifestCache = await caches.open(MANIFEST);
63 | var manifest = await manifestCache.match('manifest');
64 | // When there is no prior manifest, clear the entire cache.
65 | if (!manifest) {
66 | await caches.delete(CACHE_NAME);
67 | contentCache = await caches.open(CACHE_NAME);
68 | for (var request of await tempCache.keys()) {
69 | var response = await tempCache.match(request);
70 | await contentCache.put(request, response);
71 | }
72 | await caches.delete(TEMP);
73 | // Save the manifest to make future upgrades efficient.
74 | await manifestCache.put('manifest', new Response(JSON.stringify(RESOURCES)));
75 | return;
76 | }
77 | var oldManifest = await manifest.json();
78 | var origin = self.location.origin;
79 | for (var request of await contentCache.keys()) {
80 | var key = request.url.substring(origin.length + 1);
81 | if (key == "") {
82 | key = "/";
83 | }
84 | // If a resource from the old manifest is not in the new cache, or if
85 | // the MD5 sum has changed, delete it. Otherwise the resource is left
86 | // in the cache and can be reused by the new service worker.
87 | if (!RESOURCES[key] || RESOURCES[key] != oldManifest[key]) {
88 | await contentCache.delete(request);
89 | }
90 | }
91 | // Populate the cache with the app shell TEMP files, potentially overwriting
92 | // cache files preserved above.
93 | for (var request of await tempCache.keys()) {
94 | var response = await tempCache.match(request);
95 | await contentCache.put(request, response);
96 | }
97 | await caches.delete(TEMP);
98 | // Save the manifest to make future upgrades efficient.
99 | await manifestCache.put('manifest', new Response(JSON.stringify(RESOURCES)));
100 | return;
101 | } catch (err) {
102 | // On an unhandled exception the state of the cache cannot be guaranteed.
103 | console.error('Failed to upgrade service worker: ' + err);
104 | await caches.delete(CACHE_NAME);
105 | await caches.delete(TEMP);
106 | await caches.delete(MANIFEST);
107 | }
108 | }());
109 | });
110 |
111 | // The fetch handler redirects requests for RESOURCE files to the service
112 | // worker cache.
113 | self.addEventListener("fetch", (event) => {
114 | if (event.request.method !== 'GET') {
115 | return;
116 | }
117 | var origin = self.location.origin;
118 | var key = event.request.url.substring(origin.length + 1);
119 | // Redirect URLs to the index.html
120 | if (key.indexOf('?v=') != -1) {
121 | key = key.split('?v=')[0];
122 | }
123 | if (event.request.url == origin || event.request.url.startsWith(origin + '/#') || key == '') {
124 | key = '/';
125 | }
126 | // If the URL is not the RESOURCE list then return to signal that the
127 | // browser should take over.
128 | if (!RESOURCES[key]) {
129 | return;
130 | }
131 | // If the URL is the index.html, perform an online-first request.
132 | if (key == '/') {
133 | return onlineFirst(event);
134 | }
135 | event.respondWith(caches.open(CACHE_NAME)
136 | .then((cache) => {
137 | return cache.match(event.request).then((response) => {
138 | // Either respond with the cached resource, or perform a fetch and
139 | // lazily populate the cache.
140 | return response || fetch(event.request).then((response) => {
141 | cache.put(event.request, response.clone());
142 | return response;
143 | });
144 | })
145 | })
146 | );
147 | });
148 |
149 | self.addEventListener('message', (event) => {
150 | // SkipWaiting can be used to immediately activate a waiting service worker.
151 | // This will also require a page refresh triggered by the main worker.
152 | if (event.data === 'skipWaiting') {
153 | self.skipWaiting();
154 | return;
155 | }
156 | if (event.data === 'downloadOffline') {
157 | downloadOffline();
158 | return;
159 | }
160 | });
161 |
162 | // Download offline will check the RESOURCES for all files not in the cache
163 | // and populate them.
164 | async function downloadOffline() {
165 | var resources = [];
166 | var contentCache = await caches.open(CACHE_NAME);
167 | var currentContent = {};
168 | for (var request of await contentCache.keys()) {
169 | var key = request.url.substring(origin.length + 1);
170 | if (key == "") {
171 | key = "/";
172 | }
173 | currentContent[key] = true;
174 | }
175 | for (var resourceKey of Object.keys(RESOURCES)) {
176 | if (!currentContent[resourceKey]) {
177 | resources.push(resourceKey);
178 | }
179 | }
180 | return contentCache.addAll(resources);
181 | }
182 |
183 | // Attempt to download the resource online before falling back to
184 | // the offline cache.
185 | function onlineFirst(event) {
186 | return event.respondWith(
187 | fetch(event.request).then((response) => {
188 | return caches.open(CACHE_NAME).then((cache) => {
189 | cache.put(event.request, response.clone());
190 | return response;
191 | });
192 | }).catch((error) => {
193 | return caches.open(CACHE_NAME).then((cache) => {
194 | return cache.match(event.request).then((response) => {
195 | if (response != null) {
196 | return response;
197 | }
198 | throw error;
199 | });
200 | });
201 | })
202 | );
203 | }
204 |
--------------------------------------------------------------------------------
/example/build/web/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | updater_example
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/build/web/version.json:
--------------------------------------------------------------------------------
1 | {"app_name":"example","version":"1.0.0","build_number":"1"}
--------------------------------------------------------------------------------
/example/images/github.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/example/images/github.png
--------------------------------------------------------------------------------
/example/images/mytemplate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/example/images/mytemplate.png
--------------------------------------------------------------------------------
/example/images/show.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/example/images/show.gif
--------------------------------------------------------------------------------
/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/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
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/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/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/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - Flutter (1.0.0)
3 | - url_launcher (0.0.1):
4 | - Flutter
5 |
6 | DEPENDENCIES:
7 | - Flutter (from `Flutter`)
8 | - url_launcher (from `.symlinks/plugins/url_launcher/ios`)
9 |
10 | EXTERNAL SOURCES:
11 | Flutter:
12 | :path: Flutter
13 | url_launcher:
14 | :path: ".symlinks/plugins/url_launcher/ios"
15 |
16 | SPEC CHECKSUMS:
17 | Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
18 | url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef
19 |
20 | PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c
21 |
22 | COCOAPODS: 1.10.1
23 |
--------------------------------------------------------------------------------
/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 | B7357B3860BF6B00C093A644 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 22EA29E2F527331E6A8F64BD /* 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 | 1DBA5CC946FD2AB848D2273E /* 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 = ""; };
36 | 22EA29E2F527331E6A8F64BD /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
37 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
38 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; };
39 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
40 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
41 | 89A7679D5F4A8881C9298231 /* 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 | D931CA6DFDB246E53D01E5E8 /* 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 | B7357B3860BF6B00C093A644 /* Pods_Runner.framework in Frameworks */,
58 | );
59 | runOnlyForDeploymentPostprocessing = 0;
60 | };
61 | /* End PBXFrameworksBuildPhase section */
62 |
63 | /* Begin PBXGroup section */
64 | 9740EEB11CF90186004384FC /* Flutter */ = {
65 | isa = PBXGroup;
66 | children = (
67 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
68 | 9740EEB21CF90195004384FC /* Debug.xcconfig */,
69 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
70 | 9740EEB31CF90195004384FC /* Generated.xcconfig */,
71 | );
72 | name = Flutter;
73 | sourceTree = "";
74 | };
75 | 97C146E51CF9000F007C117D = {
76 | isa = PBXGroup;
77 | children = (
78 | 9740EEB11CF90186004384FC /* Flutter */,
79 | 97C146F01CF9000F007C117D /* Runner */,
80 | 97C146EF1CF9000F007C117D /* Products */,
81 | D9D90C4373F473D4B30FEC98 /* Pods */,
82 | DB5EA24D1A99F641BC34CDC9 /* Frameworks */,
83 | );
84 | sourceTree = "";
85 | };
86 | 97C146EF1CF9000F007C117D /* Products */ = {
87 | isa = PBXGroup;
88 | children = (
89 | 97C146EE1CF9000F007C117D /* Runner.app */,
90 | );
91 | name = Products;
92 | sourceTree = "";
93 | };
94 | 97C146F01CF9000F007C117D /* Runner */ = {
95 | isa = PBXGroup;
96 | children = (
97 | 97C146FA1CF9000F007C117D /* Main.storyboard */,
98 | 97C146FD1CF9000F007C117D /* Assets.xcassets */,
99 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
100 | 97C147021CF9000F007C117D /* Info.plist */,
101 | 97C146F11CF9000F007C117D /* Supporting Files */,
102 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
103 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
104 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
105 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
106 | );
107 | path = Runner;
108 | sourceTree = "";
109 | };
110 | 97C146F11CF9000F007C117D /* Supporting Files */ = {
111 | isa = PBXGroup;
112 | children = (
113 | );
114 | name = "Supporting Files";
115 | sourceTree = "";
116 | };
117 | D9D90C4373F473D4B30FEC98 /* Pods */ = {
118 | isa = PBXGroup;
119 | children = (
120 | D931CA6DFDB246E53D01E5E8 /* Pods-Runner.debug.xcconfig */,
121 | 89A7679D5F4A8881C9298231 /* Pods-Runner.release.xcconfig */,
122 | 1DBA5CC946FD2AB848D2273E /* Pods-Runner.profile.xcconfig */,
123 | );
124 | name = Pods;
125 | path = Pods;
126 | sourceTree = "";
127 | };
128 | DB5EA24D1A99F641BC34CDC9 /* Frameworks */ = {
129 | isa = PBXGroup;
130 | children = (
131 | 22EA29E2F527331E6A8F64BD /* Pods_Runner.framework */,
132 | );
133 | name = Frameworks;
134 | sourceTree = "";
135 | };
136 | /* End PBXGroup section */
137 |
138 | /* Begin PBXNativeTarget section */
139 | 97C146ED1CF9000F007C117D /* Runner */ = {
140 | isa = PBXNativeTarget;
141 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
142 | buildPhases = (
143 | 0CDA6F61DF65B9D8CE1D117A /* [CP] Check Pods Manifest.lock */,
144 | 9740EEB61CF901F6004384FC /* Run Script */,
145 | 97C146EA1CF9000F007C117D /* Sources */,
146 | 97C146EB1CF9000F007C117D /* Frameworks */,
147 | 97C146EC1CF9000F007C117D /* Resources */,
148 | 9705A1C41CF9048500538489 /* Embed Frameworks */,
149 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
150 | A2A1658621119CF32C290AB2 /* [CP] Embed Pods Frameworks */,
151 | );
152 | buildRules = (
153 | );
154 | dependencies = (
155 | );
156 | name = Runner;
157 | productName = Runner;
158 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
159 | productType = "com.apple.product-type.application";
160 | };
161 | /* End PBXNativeTarget section */
162 |
163 | /* Begin PBXProject section */
164 | 97C146E61CF9000F007C117D /* Project object */ = {
165 | isa = PBXProject;
166 | attributes = {
167 | LastUpgradeCheck = 1020;
168 | ORGANIZATIONNAME = "The Chromium Authors";
169 | TargetAttributes = {
170 | 97C146ED1CF9000F007C117D = {
171 | CreatedOnToolsVersion = 7.3.1;
172 | LastSwiftMigration = 1100;
173 | };
174 | };
175 | };
176 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
177 | compatibilityVersion = "Xcode 3.2";
178 | developmentRegion = en;
179 | hasScannedForEncodings = 0;
180 | knownRegions = (
181 | en,
182 | Base,
183 | );
184 | mainGroup = 97C146E51CF9000F007C117D;
185 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
186 | projectDirPath = "";
187 | projectRoot = "";
188 | targets = (
189 | 97C146ED1CF9000F007C117D /* Runner */,
190 | );
191 | };
192 | /* End PBXProject section */
193 |
194 | /* Begin PBXResourcesBuildPhase section */
195 | 97C146EC1CF9000F007C117D /* Resources */ = {
196 | isa = PBXResourcesBuildPhase;
197 | buildActionMask = 2147483647;
198 | files = (
199 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
200 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
201 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
202 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
203 | );
204 | runOnlyForDeploymentPostprocessing = 0;
205 | };
206 | /* End PBXResourcesBuildPhase section */
207 |
208 | /* Begin PBXShellScriptBuildPhase section */
209 | 0CDA6F61DF65B9D8CE1D117A /* [CP] Check Pods Manifest.lock */ = {
210 | isa = PBXShellScriptBuildPhase;
211 | buildActionMask = 2147483647;
212 | files = (
213 | );
214 | inputFileListPaths = (
215 | );
216 | inputPaths = (
217 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
218 | "${PODS_ROOT}/Manifest.lock",
219 | );
220 | name = "[CP] Check Pods Manifest.lock";
221 | outputFileListPaths = (
222 | );
223 | outputPaths = (
224 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
225 | );
226 | runOnlyForDeploymentPostprocessing = 0;
227 | shellPath = /bin/sh;
228 | 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";
229 | showEnvVarsInLog = 0;
230 | };
231 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
232 | isa = PBXShellScriptBuildPhase;
233 | buildActionMask = 2147483647;
234 | files = (
235 | );
236 | inputPaths = (
237 | );
238 | name = "Thin Binary";
239 | outputPaths = (
240 | );
241 | runOnlyForDeploymentPostprocessing = 0;
242 | shellPath = /bin/sh;
243 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
244 | };
245 | 9740EEB61CF901F6004384FC /* Run Script */ = {
246 | isa = PBXShellScriptBuildPhase;
247 | buildActionMask = 2147483647;
248 | files = (
249 | );
250 | inputPaths = (
251 | );
252 | name = "Run Script";
253 | outputPaths = (
254 | );
255 | runOnlyForDeploymentPostprocessing = 0;
256 | shellPath = /bin/sh;
257 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
258 | };
259 | A2A1658621119CF32C290AB2 /* [CP] Embed Pods Frameworks */ = {
260 | isa = PBXShellScriptBuildPhase;
261 | buildActionMask = 2147483647;
262 | files = (
263 | );
264 | inputPaths = (
265 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
266 | "${BUILT_PRODUCTS_DIR}/url_launcher/url_launcher.framework",
267 | );
268 | name = "[CP] Embed Pods Frameworks";
269 | outputPaths = (
270 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/url_launcher.framework",
271 | );
272 | runOnlyForDeploymentPostprocessing = 0;
273 | shellPath = /bin/sh;
274 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
275 | showEnvVarsInLog = 0;
276 | };
277 | /* End PBXShellScriptBuildPhase section */
278 |
279 | /* Begin PBXSourcesBuildPhase section */
280 | 97C146EA1CF9000F007C117D /* Sources */ = {
281 | isa = PBXSourcesBuildPhase;
282 | buildActionMask = 2147483647;
283 | files = (
284 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
285 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
286 | );
287 | runOnlyForDeploymentPostprocessing = 0;
288 | };
289 | /* End PBXSourcesBuildPhase section */
290 |
291 | /* Begin PBXVariantGroup section */
292 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = {
293 | isa = PBXVariantGroup;
294 | children = (
295 | 97C146FB1CF9000F007C117D /* Base */,
296 | );
297 | name = Main.storyboard;
298 | sourceTree = "";
299 | };
300 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
301 | isa = PBXVariantGroup;
302 | children = (
303 | 97C147001CF9000F007C117D /* Base */,
304 | );
305 | name = LaunchScreen.storyboard;
306 | sourceTree = "";
307 | };
308 | /* End PBXVariantGroup section */
309 |
310 | /* Begin XCBuildConfiguration section */
311 | 249021D3217E4FDB00AE95B9 /* Profile */ = {
312 | isa = XCBuildConfiguration;
313 | buildSettings = {
314 | ALWAYS_SEARCH_USER_PATHS = NO;
315 | CLANG_ANALYZER_NONNULL = YES;
316 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
317 | CLANG_CXX_LIBRARY = "libc++";
318 | CLANG_ENABLE_MODULES = YES;
319 | CLANG_ENABLE_OBJC_ARC = YES;
320 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
321 | CLANG_WARN_BOOL_CONVERSION = YES;
322 | CLANG_WARN_COMMA = YES;
323 | CLANG_WARN_CONSTANT_CONVERSION = YES;
324 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
325 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
326 | CLANG_WARN_EMPTY_BODY = YES;
327 | CLANG_WARN_ENUM_CONVERSION = YES;
328 | CLANG_WARN_INFINITE_RECURSION = YES;
329 | CLANG_WARN_INT_CONVERSION = YES;
330 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
331 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
332 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
333 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
334 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
335 | CLANG_WARN_STRICT_PROTOTYPES = YES;
336 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
337 | CLANG_WARN_UNREACHABLE_CODE = YES;
338 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
339 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
340 | COPY_PHASE_STRIP = NO;
341 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
342 | ENABLE_NS_ASSERTIONS = NO;
343 | ENABLE_STRICT_OBJC_MSGSEND = YES;
344 | GCC_C_LANGUAGE_STANDARD = gnu99;
345 | GCC_NO_COMMON_BLOCKS = YES;
346 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
347 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
348 | GCC_WARN_UNDECLARED_SELECTOR = YES;
349 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
350 | GCC_WARN_UNUSED_FUNCTION = YES;
351 | GCC_WARN_UNUSED_VARIABLE = YES;
352 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
353 | MTL_ENABLE_DEBUG_INFO = NO;
354 | SDKROOT = iphoneos;
355 | SUPPORTED_PLATFORMS = iphoneos;
356 | TARGETED_DEVICE_FAMILY = "1,2";
357 | VALIDATE_PRODUCT = YES;
358 | };
359 | name = Profile;
360 | };
361 | 249021D4217E4FDB00AE95B9 /* Profile */ = {
362 | isa = XCBuildConfiguration;
363 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
364 | buildSettings = {
365 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
366 | CLANG_ENABLE_MODULES = YES;
367 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
368 | ENABLE_BITCODE = NO;
369 | FRAMEWORK_SEARCH_PATHS = (
370 | "$(inherited)",
371 | "$(PROJECT_DIR)/Flutter",
372 | );
373 | INFOPLIST_FILE = Runner/Info.plist;
374 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
375 | LIBRARY_SEARCH_PATHS = (
376 | "$(inherited)",
377 | "$(PROJECT_DIR)/Flutter",
378 | );
379 | PRODUCT_BUNDLE_IDENTIFIER = com.example.updaterExample;
380 | PRODUCT_NAME = "$(TARGET_NAME)";
381 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
382 | SWIFT_VERSION = 5.0;
383 | VERSIONING_SYSTEM = "apple-generic";
384 | };
385 | name = Profile;
386 | };
387 | 97C147031CF9000F007C117D /* Debug */ = {
388 | isa = XCBuildConfiguration;
389 | buildSettings = {
390 | ALWAYS_SEARCH_USER_PATHS = NO;
391 | CLANG_ANALYZER_NONNULL = YES;
392 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
393 | CLANG_CXX_LIBRARY = "libc++";
394 | CLANG_ENABLE_MODULES = YES;
395 | CLANG_ENABLE_OBJC_ARC = YES;
396 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
397 | CLANG_WARN_BOOL_CONVERSION = YES;
398 | CLANG_WARN_COMMA = YES;
399 | CLANG_WARN_CONSTANT_CONVERSION = YES;
400 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
401 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
402 | CLANG_WARN_EMPTY_BODY = YES;
403 | CLANG_WARN_ENUM_CONVERSION = YES;
404 | CLANG_WARN_INFINITE_RECURSION = YES;
405 | CLANG_WARN_INT_CONVERSION = YES;
406 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
407 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
408 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
409 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
410 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
411 | CLANG_WARN_STRICT_PROTOTYPES = YES;
412 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
413 | CLANG_WARN_UNREACHABLE_CODE = YES;
414 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
415 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
416 | COPY_PHASE_STRIP = NO;
417 | DEBUG_INFORMATION_FORMAT = dwarf;
418 | ENABLE_STRICT_OBJC_MSGSEND = YES;
419 | ENABLE_TESTABILITY = YES;
420 | GCC_C_LANGUAGE_STANDARD = gnu99;
421 | GCC_DYNAMIC_NO_PIC = NO;
422 | GCC_NO_COMMON_BLOCKS = YES;
423 | GCC_OPTIMIZATION_LEVEL = 0;
424 | GCC_PREPROCESSOR_DEFINITIONS = (
425 | "DEBUG=1",
426 | "$(inherited)",
427 | );
428 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
429 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
430 | GCC_WARN_UNDECLARED_SELECTOR = YES;
431 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
432 | GCC_WARN_UNUSED_FUNCTION = YES;
433 | GCC_WARN_UNUSED_VARIABLE = YES;
434 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
435 | MTL_ENABLE_DEBUG_INFO = YES;
436 | ONLY_ACTIVE_ARCH = YES;
437 | SDKROOT = iphoneos;
438 | TARGETED_DEVICE_FAMILY = "1,2";
439 | };
440 | name = Debug;
441 | };
442 | 97C147041CF9000F007C117D /* Release */ = {
443 | isa = XCBuildConfiguration;
444 | buildSettings = {
445 | ALWAYS_SEARCH_USER_PATHS = NO;
446 | CLANG_ANALYZER_NONNULL = YES;
447 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
448 | CLANG_CXX_LIBRARY = "libc++";
449 | CLANG_ENABLE_MODULES = YES;
450 | CLANG_ENABLE_OBJC_ARC = YES;
451 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
452 | CLANG_WARN_BOOL_CONVERSION = YES;
453 | CLANG_WARN_COMMA = YES;
454 | CLANG_WARN_CONSTANT_CONVERSION = YES;
455 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
456 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
457 | CLANG_WARN_EMPTY_BODY = YES;
458 | CLANG_WARN_ENUM_CONVERSION = YES;
459 | CLANG_WARN_INFINITE_RECURSION = YES;
460 | CLANG_WARN_INT_CONVERSION = YES;
461 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
462 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
463 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
464 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
465 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
466 | CLANG_WARN_STRICT_PROTOTYPES = YES;
467 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
468 | CLANG_WARN_UNREACHABLE_CODE = YES;
469 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
470 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
471 | COPY_PHASE_STRIP = NO;
472 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
473 | ENABLE_NS_ASSERTIONS = NO;
474 | ENABLE_STRICT_OBJC_MSGSEND = YES;
475 | GCC_C_LANGUAGE_STANDARD = gnu99;
476 | GCC_NO_COMMON_BLOCKS = YES;
477 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
478 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
479 | GCC_WARN_UNDECLARED_SELECTOR = YES;
480 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
481 | GCC_WARN_UNUSED_FUNCTION = YES;
482 | GCC_WARN_UNUSED_VARIABLE = YES;
483 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
484 | MTL_ENABLE_DEBUG_INFO = NO;
485 | SDKROOT = iphoneos;
486 | SUPPORTED_PLATFORMS = iphoneos;
487 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
488 | TARGETED_DEVICE_FAMILY = "1,2";
489 | VALIDATE_PRODUCT = YES;
490 | };
491 | name = Release;
492 | };
493 | 97C147061CF9000F007C117D /* Debug */ = {
494 | isa = XCBuildConfiguration;
495 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
496 | buildSettings = {
497 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
498 | CLANG_ENABLE_MODULES = YES;
499 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
500 | ENABLE_BITCODE = NO;
501 | FRAMEWORK_SEARCH_PATHS = (
502 | "$(inherited)",
503 | "$(PROJECT_DIR)/Flutter",
504 | );
505 | INFOPLIST_FILE = Runner/Info.plist;
506 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
507 | LIBRARY_SEARCH_PATHS = (
508 | "$(inherited)",
509 | "$(PROJECT_DIR)/Flutter",
510 | );
511 | PRODUCT_BUNDLE_IDENTIFIER = com.example.updaterExample;
512 | PRODUCT_NAME = "$(TARGET_NAME)";
513 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
514 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
515 | SWIFT_VERSION = 5.0;
516 | VERSIONING_SYSTEM = "apple-generic";
517 | };
518 | name = Debug;
519 | };
520 | 97C147071CF9000F007C117D /* Release */ = {
521 | isa = XCBuildConfiguration;
522 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
523 | buildSettings = {
524 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
525 | CLANG_ENABLE_MODULES = YES;
526 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
527 | ENABLE_BITCODE = NO;
528 | FRAMEWORK_SEARCH_PATHS = (
529 | "$(inherited)",
530 | "$(PROJECT_DIR)/Flutter",
531 | );
532 | INFOPLIST_FILE = Runner/Info.plist;
533 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
534 | LIBRARY_SEARCH_PATHS = (
535 | "$(inherited)",
536 | "$(PROJECT_DIR)/Flutter",
537 | );
538 | PRODUCT_BUNDLE_IDENTIFIER = com.example.updaterExample;
539 | PRODUCT_NAME = "$(TARGET_NAME)";
540 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
541 | SWIFT_VERSION = 5.0;
542 | VERSIONING_SYSTEM = "apple-generic";
543 | };
544 | name = Release;
545 | };
546 | /* End XCBuildConfiguration section */
547 |
548 | /* Begin XCConfigurationList section */
549 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
550 | isa = XCConfigurationList;
551 | buildConfigurations = (
552 | 97C147031CF9000F007C117D /* Debug */,
553 | 97C147041CF9000F007C117D /* Release */,
554 | 249021D3217E4FDB00AE95B9 /* Profile */,
555 | );
556 | defaultConfigurationIsVisible = 0;
557 | defaultConfigurationName = Release;
558 | };
559 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
560 | isa = XCConfigurationList;
561 | buildConfigurations = (
562 | 97C147061CF9000F007C117D /* Debug */,
563 | 97C147071CF9000F007C117D /* Release */,
564 | 249021D4217E4FDB00AE95B9 /* Profile */,
565 | );
566 | defaultConfigurationIsVisible = 0;
567 | defaultConfigurationName = Release;
568 | };
569 | /* End XCConfigurationList section */
570 | };
571 | rootObject = 97C146E61CF9000F007C117D /* Project object */;
572 | }
573 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
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 |
--------------------------------------------------------------------------------
/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/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/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/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/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/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/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/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/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/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/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/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/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/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/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/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/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/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/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/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/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/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/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/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/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/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/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/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/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.
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 | updater_example
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 |
--------------------------------------------------------------------------------
/example/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
--------------------------------------------------------------------------------
/example/lib/MyTemplate.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_beautiful_popup/main.dart';
3 |
4 | class MyTemplate extends BeautifulPopupTemplate {
5 | final BeautifulPopup options;
6 | MyTemplate(this.options) : super(options);
7 |
8 | @override
9 | final illustrationKey = 'images/mytemplate.png';
10 | @override
11 | Color get primaryColor => options.primaryColor ?? Color(0xff000000);
12 | @override
13 | final maxWidth = 400;
14 | @override
15 | final maxHeight = 600;
16 | @override
17 | final bodyMargin = 10;
18 | @override
19 | get layout {
20 | return [
21 | Positioned(
22 | child: background,
23 | ),
24 | Positioned(
25 | top: percentH(10),
26 | child: title,
27 | ),
28 | Positioned(
29 | top: percentH(40),
30 | height: percentH(actions == null ? 32 : 42),
31 | left: percentW(10),
32 | right: percentW(10),
33 | child: content,
34 | ),
35 | Positioned(
36 | bottom: percentW(10),
37 | left: percentW(10),
38 | right: percentW(10),
39 | child: actions ?? Container(),
40 | ),
41 | ];
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/example/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/cupertino.dart';
3 | import 'package:flutter/foundation.dart' show kIsWeb;
4 | import 'package:flutter_beautiful_popup/main.dart';
5 | import 'package:flutter_colorpicker/flutter_colorpicker.dart';
6 | import 'package:flutter_highlight/flutter_highlight.dart';
7 | import 'package:flutter_highlight/themes/github-gist.dart';
8 | import 'package:url_launcher/url_launcher.dart';
9 | import 'MyTemplate.dart';
10 |
11 | void main() {
12 | runApp(MyApp());
13 | }
14 |
15 | class MyApp extends StatelessWidget {
16 | @override
17 | Widget build(BuildContext context) {
18 | return MaterialApp(
19 | title: 'Flutter_beautiful_popup',
20 | theme: ThemeData(primaryColor: Colors.blue),
21 | home: MyHomePage(title: 'Flutter_Beautiful_Popup'),
22 | );
23 | }
24 | }
25 |
26 | class MyHomePage extends StatefulWidget {
27 | MyHomePage({Key? key, required this.title}) : super(key: key);
28 | final String title;
29 |
30 | @override
31 | _MyHomePageState createState() => _MyHomePageState();
32 | }
33 |
34 | class _MyHomePageState extends State {
35 | @override
36 | initState() {
37 | super.initState();
38 | final templates = [
39 | TemplateGift,
40 | TemplateCamera,
41 | TemplateNotification,
42 | TemplateGeolocation,
43 | TemplateSuccess,
44 | TemplateFail,
45 | // TemplateOrangeRocket,
46 | TemplateGreenRocket,
47 | TemplateOrangeRocket2,
48 | TemplateCoin,
49 | TemplateBlueRocket,
50 | TemplateThumb,
51 | TemplateAuthentication,
52 | TemplateTerm,
53 | TemplateRedPacket,
54 | ];
55 |
56 | demos = templates.map((template) {
57 | return BeautifulPopup(
58 | context: context,
59 | template: template,
60 | );
61 | }).toList();
62 | }
63 |
64 | List demos = [];
65 |
66 | BeautifulPopup? activeDemo;
67 |
68 | Widget get showcases {
69 | final popup = BeautifulPopup.customize(
70 | context: context,
71 | build: (options) => MyTemplate(options),
72 | );
73 | return Flex(
74 | mainAxisSize: MainAxisSize.max,
75 | direction: Axis.vertical,
76 | crossAxisAlignment: CrossAxisAlignment.start,
77 | children: [
78 | Container(
79 | margin: EdgeInsets.fromLTRB(20, 20, 10, 10),
80 | decoration: BoxDecoration(
81 | border: Border(
82 | top: BorderSide(
83 | color: Colors.white,
84 | width: 1,
85 | ),
86 | ),
87 | ),
88 | child: Flex(
89 | direction: Axis.horizontal,
90 | children: [
91 | Text(
92 | 'All Templates:',
93 | style: Theme.of(context).textTheme.headline4?.merge(
94 | TextStyle(
95 | backgroundColor: Colors.transparent,
96 | ),
97 | ),
98 | ),
99 | Spacer(),
100 | FlatButton(
101 | child: Text('Customize'),
102 | onPressed: () {
103 | popup.show(
104 | title: 'Example',
105 | content: Container(
106 | color: Colors.black12,
107 | child: Text(
108 | 'This popup shows you how to customize your own BeautifulPopupTemplate.'),
109 | ),
110 | actions: [
111 | popup.button(
112 | label: 'Code',
113 | labelStyle: TextStyle(),
114 | onPressed: () async {
115 | await _launchURL(
116 | 'https://github.com/jaweii/Flutter_beautiful_popup/blob/master/example/lib/MyTemplate.dart',
117 | );
118 | },
119 | ),
120 | ],
121 | );
122 | },
123 | )
124 | ],
125 | ),
126 | ),
127 | Expanded(
128 | child: SingleChildScrollView(
129 | padding: EdgeInsets.fromLTRB(20, 20, 0, 20),
130 | child: Wrap(
131 | alignment: WrapAlignment.start,
132 | spacing: 20,
133 | runSpacing: 30,
134 | children: demos.map((demo) {
135 | final i = demos.indexWhere((d) => d.template == demo.template);
136 | return InkWell(
137 | borderRadius: BorderRadius.circular(10),
138 | child: Container(
139 | constraints: BoxConstraints(minWidth: 160),
140 | padding: EdgeInsets.all(10),
141 | decoration: BoxDecoration(
142 | color: demo.primaryColor?.withOpacity(0.25),
143 | borderRadius: BorderRadius.circular(10),
144 | ),
145 | child: Column(
146 | crossAxisAlignment: CrossAxisAlignment.center,
147 | mainAxisAlignment: MainAxisAlignment.spaceBetween,
148 | children: [
149 | Image.asset(
150 | demo.instance.illustrationKey,
151 | height: 54,
152 | width: 100,
153 | fit: BoxFit.fitWidth,
154 | alignment: Alignment.topCenter,
155 | ),
156 | SizedBox(height: 10),
157 | Text(
158 | 'Demo-${i + 1}\n${demo.instance.runtimeType}',
159 | textAlign: TextAlign.center,
160 | )
161 | ],
162 | ),
163 | ),
164 | onTap: () {
165 | openDemo(demo: demo);
166 | },
167 | );
168 | }).toList(),
169 | ),
170 | ),
171 | ),
172 | ],
173 | );
174 | }
175 |
176 | Widget get body {
177 | final exampleCode = '''
178 | final popup = BeautifulPopup(
179 | context: context,
180 | template: ${activeDemo?.instance.runtimeType ?? '// Select a template in right'},
181 | );
182 |
183 | popup.show(
184 | title: 'String',
185 | content: 'BeautifulPopup is a flutter package that is responsible for beautify your app popups.',
186 | actions: [
187 | popup.button(
188 | label: 'Close',
189 | onPressed: Navigator.of(context).pop,
190 | ),
191 | ],
192 | );
193 | ''';
194 | if (MediaQuery.of(context).size.width > 1024) {
195 | return Flex(
196 | direction: Axis.horizontal,
197 | children: [
198 | Flexible(
199 | flex: 1,
200 | fit: FlexFit.tight,
201 | child: Container(
202 | color: activeDemo?.primaryColor?.withOpacity(0.25) ??
203 | Theme.of(context).primaryColor.withOpacity(0.25),
204 | child: Flex(
205 | mainAxisSize: MainAxisSize.max,
206 | direction: Axis.vertical,
207 | crossAxisAlignment: CrossAxisAlignment.start,
208 | children: [
209 | Container(
210 | margin: EdgeInsets.fromLTRB(20, 20, 10, 10),
211 | child: Text(
212 | '# Usage',
213 | style: Theme.of(context).textTheme.headline4?.merge(
214 | TextStyle(
215 | color: Colors.black54,
216 | backgroundColor: Colors.transparent,
217 | ),
218 | ),
219 | ),
220 | ),
221 | Expanded(
222 | child: Container(
223 | alignment: Alignment.center,
224 | child: HighlightView(
225 | exampleCode,
226 | language: 'dart',
227 | theme: githubGistTheme,
228 | padding: EdgeInsets.all(30),
229 | ),
230 | ),
231 | ),
232 | ],
233 | ),
234 | ),
235 | ),
236 | Flexible(
237 | flex: 1,
238 | fit: FlexFit.tight,
239 | child: showcases,
240 | ),
241 | ],
242 | );
243 | } else {
244 | return showcases;
245 | }
246 | }
247 |
248 | @override
249 | Widget build(BuildContext context) {
250 | return Scaffold(
251 | appBar: AppBar(
252 | title: Text(
253 | widget.title,
254 | style: TextStyle(color: Colors.white),
255 | ),
256 | elevation: 2,
257 | backgroundColor:
258 | activeDemo?.primaryColor ?? Theme.of(context).primaryColor,
259 | actions: [
260 | FlatButton(
261 | child: Image.asset(
262 | 'images/github.png',
263 | width: 32,
264 | height: 32,
265 | ),
266 | onPressed: () async {
267 | await _launchURL(
268 | 'https://github.com/jaweii/Flutter_beautiful_popup',
269 | );
270 | },
271 | ),
272 | ],
273 | ),
274 | body: body,
275 | );
276 | }
277 |
278 | void changeColor(
279 | BeautifulPopup demo,
280 | void Function(Color? color)? callback,
281 | ) {
282 | Color? color = demo.primaryColor?.withOpacity(0.5);
283 | showDialog(
284 | context: context,
285 | builder: (context) => AlertDialog(
286 | title: const Text('Pick a color!'),
287 | content: SingleChildScrollView(
288 | child: ColorPicker(
289 | pickerColor: color == null ? Color(0xFF000000) : color!,
290 | onColorChanged: (c) => color = c,
291 | showLabel: true,
292 | pickerAreaHeightPercent: 0.8,
293 | ),
294 | ),
295 | actions: [
296 | FlatButton(
297 | child: const Text('Got it'),
298 | onPressed: () async {
299 | callback?.call(color);
300 | },
301 | ),
302 | ],
303 | ),
304 | );
305 | }
306 |
307 | openDemo({
308 | required BeautifulPopup demo,
309 | dynamic title = 'String',
310 | dynamic content =
311 | 'BeautifulPopup is a flutter package that is responsible for beautify your app popups.',
312 | }) {
313 | assert(title is Widget || title is String);
314 | setState(() {
315 | activeDemo = demo;
316 | });
317 | demo.show(
318 | title: title,
319 | content: content,
320 | actions: [
321 | demo.button(
322 | label: 'Recolor',
323 | onPressed: () {
324 | changeColor(demo, (color) async {
325 | demo = await BeautifulPopup(
326 | context: context,
327 | template: demo.template,
328 | ).recolor(color!);
329 | Navigator.of(context).popUntil((route) {
330 | if (route.settings.name == '/') return true;
331 | return false;
332 | });
333 | openDemo(demo: demo);
334 | });
335 | },
336 | ),
337 | demo.button(
338 | label: 'Show more',
339 | outline: true,
340 | onPressed: () {
341 | Navigator.of(context).pop();
342 | if (title is Widget) {
343 | return openDemo(demo: demo);
344 | }
345 | getTitle() {
346 | return Opacity(
347 | opacity: 0.95,
348 | child: Row(
349 | mainAxisSize: MainAxisSize.min,
350 | crossAxisAlignment: CrossAxisAlignment.start,
351 | mainAxisAlignment: MainAxisAlignment.start,
352 | children: [
353 | Text(
354 | '[Widget]',
355 | style: TextStyle(
356 | fontWeight: FontWeight.bold,
357 | fontSize: 20,
358 | color: demo.primaryColor,
359 | backgroundColor: Colors.white70,
360 | ),
361 | ),
362 | Padding(
363 | padding: EdgeInsets.only(top: 20),
364 | child: Icon(
365 | Icons.star,
366 | color: demo.primaryColor?.withOpacity(0.75),
367 | size: 10,
368 | ),
369 | )
370 | ],
371 | ),
372 | );
373 | }
374 |
375 | getContent() {
376 | return Container(
377 | decoration: BoxDecoration(
378 | color: Colors.black.withOpacity(0.1),
379 | ),
380 | child: Scrollbar(
381 | child: SingleChildScrollView(
382 | child: Column(
383 | children: [
384 | CupertinoButton(
385 | child: Text('Remove all buttons'),
386 | onPressed: () {
387 | Navigator.of(context).pop();
388 | demo = BeautifulPopup(
389 | context: context,
390 | template: demo.template,
391 | );
392 | demo.show(
393 | title: getTitle(),
394 | content: getContent(),
395 | actions: [],
396 | );
397 | },
398 | ),
399 | CupertinoButton(
400 | child: Text('Keep one button'),
401 | onPressed: () {
402 | Navigator.of(context).pop();
403 | demo = BeautifulPopup(
404 | context: context,
405 | template: demo.template,
406 | );
407 | demo.show(
408 | title: getTitle(),
409 | content: getContent(),
410 | actions: [
411 | demo.button(
412 | label: 'One button',
413 | onPressed: () {
414 | Navigator.of(context).pop();
415 | },
416 | ),
417 | ],
418 | );
419 | },
420 | ),
421 | CupertinoButton(
422 | child: Text('Remove Close button'),
423 | onPressed: () {
424 | Navigator.of(context).pop();
425 | demo = BeautifulPopup(
426 | context: context,
427 | template: demo.template,
428 | );
429 | demo.show(
430 | title: getTitle(),
431 | content: getContent(),
432 | close: Container(),
433 | barrierDismissible: true,
434 | actions: [
435 | demo.button(
436 | label: 'Close',
437 | onPressed: () {
438 | Navigator.of(context).pop();
439 | },
440 | ),
441 | ],
442 | );
443 | },
444 | ),
445 | CupertinoButton(
446 | child: Text('Change button direction'),
447 | onPressed: () {
448 | Navigator.of(context).pop();
449 | demo = BeautifulPopup(
450 | context: context,
451 | template: demo.template,
452 | );
453 | demo.show(
454 | title: getTitle(),
455 | content: Flex(
456 | crossAxisAlignment: CrossAxisAlignment.start,
457 | direction: Axis.vertical,
458 | children: [
459 | Text('1. blabla... \n2. blabla...'),
460 | Spacer(),
461 | demo.button(
462 | label: 'Accpet',
463 | onPressed: () {},
464 | ),
465 | Container(
466 | alignment: Alignment.center,
467 | child: FlatButton(
468 | hoverColor: Colors.transparent,
469 | highlightColor: Colors.transparent,
470 | child: Text('Close'),
471 | onPressed: Navigator.of(context).pop,
472 | ),
473 | ),
474 | ],
475 | ),
476 | barrierDismissible: true,
477 | actions: [],
478 | );
479 | },
480 | )
481 | ],
482 | ),
483 | ),
484 | ),
485 | );
486 | }
487 |
488 | openDemo(
489 | demo: demo,
490 | title: getTitle(),
491 | content: getContent(),
492 | );
493 | },
494 | )
495 | ],
496 | );
497 | }
498 |
499 | Future _launchURL(String _url) async {
500 | await canLaunch(_url) ? await launch(_url) : throw 'Could not launch $_url';
501 | }
502 | }
503 |
--------------------------------------------------------------------------------
/example/pubspec.lock:
--------------------------------------------------------------------------------
1 | # Generated by pub
2 | # See https://dart.dev/tools/pub/glossary#lockfile
3 | packages:
4 | archive:
5 | dependency: transitive
6 | description:
7 | name: archive
8 | url: "https://pub.flutter-io.cn"
9 | source: hosted
10 | version: "3.1.2"
11 | async:
12 | dependency: transitive
13 | description:
14 | name: async
15 | url: "https://pub.flutter-io.cn"
16 | source: hosted
17 | version: "2.8.1"
18 | auto_size_text:
19 | dependency: transitive
20 | description:
21 | name: auto_size_text
22 | url: "https://pub.flutter-io.cn"
23 | source: hosted
24 | version: "3.0.0-nullsafety.0"
25 | boolean_selector:
26 | dependency: transitive
27 | description:
28 | name: boolean_selector
29 | url: "https://pub.flutter-io.cn"
30 | source: hosted
31 | version: "2.1.0"
32 | characters:
33 | dependency: transitive
34 | description:
35 | name: characters
36 | url: "https://pub.flutter-io.cn"
37 | source: hosted
38 | version: "1.1.0"
39 | charcode:
40 | dependency: transitive
41 | description:
42 | name: charcode
43 | url: "https://pub.flutter-io.cn"
44 | source: hosted
45 | version: "1.3.1"
46 | clock:
47 | dependency: transitive
48 | description:
49 | name: clock
50 | url: "https://pub.flutter-io.cn"
51 | source: hosted
52 | version: "1.1.0"
53 | collection:
54 | dependency: transitive
55 | description:
56 | name: collection
57 | url: "https://pub.flutter-io.cn"
58 | source: hosted
59 | version: "1.15.0"
60 | crypto:
61 | dependency: transitive
62 | description:
63 | name: crypto
64 | url: "https://pub.flutter-io.cn"
65 | source: hosted
66 | version: "3.0.1"
67 | cupertino_icons:
68 | dependency: "direct main"
69 | description:
70 | name: cupertino_icons
71 | url: "https://pub.flutter-io.cn"
72 | source: hosted
73 | version: "0.1.3"
74 | fake_async:
75 | dependency: transitive
76 | description:
77 | name: fake_async
78 | url: "https://pub.flutter-io.cn"
79 | source: hosted
80 | version: "1.2.0"
81 | flutter:
82 | dependency: "direct main"
83 | description: flutter
84 | source: sdk
85 | version: "0.0.0"
86 | flutter_beautiful_popup:
87 | dependency: "direct main"
88 | description:
89 | path: ".."
90 | relative: true
91 | source: path
92 | version: "1.7.0"
93 | flutter_colorpicker:
94 | dependency: "direct main"
95 | description:
96 | name: flutter_colorpicker
97 | url: "https://pub.flutter-io.cn"
98 | source: hosted
99 | version: "0.6.0"
100 | flutter_highlight:
101 | dependency: "direct main"
102 | description:
103 | name: flutter_highlight
104 | url: "https://pub.flutter-io.cn"
105 | source: hosted
106 | version: "0.7.0"
107 | flutter_test:
108 | dependency: "direct dev"
109 | description: flutter
110 | source: sdk
111 | version: "0.0.0"
112 | flutter_web_plugins:
113 | dependency: transitive
114 | description: flutter
115 | source: sdk
116 | version: "0.0.0"
117 | highlight:
118 | dependency: transitive
119 | description:
120 | name: highlight
121 | url: "https://pub.flutter-io.cn"
122 | source: hosted
123 | version: "0.7.0"
124 | image:
125 | dependency: transitive
126 | description:
127 | name: image
128 | url: "https://pub.flutter-io.cn"
129 | source: hosted
130 | version: "3.0.4"
131 | js:
132 | dependency: transitive
133 | description:
134 | name: js
135 | url: "https://pub.flutter-io.cn"
136 | source: hosted
137 | version: "0.6.3"
138 | matcher:
139 | dependency: transitive
140 | description:
141 | name: matcher
142 | url: "https://pub.flutter-io.cn"
143 | source: hosted
144 | version: "0.12.10"
145 | meta:
146 | dependency: transitive
147 | description:
148 | name: meta
149 | url: "https://pub.flutter-io.cn"
150 | source: hosted
151 | version: "1.7.0"
152 | path:
153 | dependency: transitive
154 | description:
155 | name: path
156 | url: "https://pub.flutter-io.cn"
157 | source: hosted
158 | version: "1.8.0"
159 | petitparser:
160 | dependency: transitive
161 | description:
162 | name: petitparser
163 | url: "https://pub.flutter-io.cn"
164 | source: hosted
165 | version: "4.1.0"
166 | plugin_platform_interface:
167 | dependency: transitive
168 | description:
169 | name: plugin_platform_interface
170 | url: "https://pub.flutter-io.cn"
171 | source: hosted
172 | version: "2.0.1"
173 | sky_engine:
174 | dependency: transitive
175 | description: flutter
176 | source: sdk
177 | version: "0.0.99"
178 | source_span:
179 | dependency: transitive
180 | description:
181 | name: source_span
182 | url: "https://pub.flutter-io.cn"
183 | source: hosted
184 | version: "1.8.1"
185 | stack_trace:
186 | dependency: transitive
187 | description:
188 | name: stack_trace
189 | url: "https://pub.flutter-io.cn"
190 | source: hosted
191 | version: "1.10.0"
192 | stream_channel:
193 | dependency: transitive
194 | description:
195 | name: stream_channel
196 | url: "https://pub.flutter-io.cn"
197 | source: hosted
198 | version: "2.1.0"
199 | string_scanner:
200 | dependency: transitive
201 | description:
202 | name: string_scanner
203 | url: "https://pub.flutter-io.cn"
204 | source: hosted
205 | version: "1.1.0"
206 | term_glyph:
207 | dependency: transitive
208 | description:
209 | name: term_glyph
210 | url: "https://pub.flutter-io.cn"
211 | source: hosted
212 | version: "1.2.0"
213 | test_api:
214 | dependency: transitive
215 | description:
216 | name: test_api
217 | url: "https://pub.flutter-io.cn"
218 | source: hosted
219 | version: "0.4.2"
220 | typed_data:
221 | dependency: transitive
222 | description:
223 | name: typed_data
224 | url: "https://pub.flutter-io.cn"
225 | source: hosted
226 | version: "1.3.0"
227 | url_launcher:
228 | dependency: "direct main"
229 | description:
230 | name: url_launcher
231 | url: "https://pub.flutter-io.cn"
232 | source: hosted
233 | version: "6.0.10"
234 | url_launcher_linux:
235 | dependency: transitive
236 | description:
237 | name: url_launcher_linux
238 | url: "https://pub.flutter-io.cn"
239 | source: hosted
240 | version: "2.0.2"
241 | url_launcher_macos:
242 | dependency: transitive
243 | description:
244 | name: url_launcher_macos
245 | url: "https://pub.flutter-io.cn"
246 | source: hosted
247 | version: "2.0.2"
248 | url_launcher_platform_interface:
249 | dependency: transitive
250 | description:
251 | name: url_launcher_platform_interface
252 | url: "https://pub.flutter-io.cn"
253 | source: hosted
254 | version: "2.0.4"
255 | url_launcher_web:
256 | dependency: "direct main"
257 | description:
258 | name: url_launcher_web
259 | url: "https://pub.flutter-io.cn"
260 | source: hosted
261 | version: "2.0.4"
262 | url_launcher_windows:
263 | dependency: transitive
264 | description:
265 | name: url_launcher_windows
266 | url: "https://pub.flutter-io.cn"
267 | source: hosted
268 | version: "2.0.2"
269 | vector_math:
270 | dependency: transitive
271 | description:
272 | name: vector_math
273 | url: "https://pub.flutter-io.cn"
274 | source: hosted
275 | version: "2.1.0"
276 | xml:
277 | dependency: transitive
278 | description:
279 | name: xml
280 | url: "https://pub.flutter-io.cn"
281 | source: hosted
282 | version: "5.1.2"
283 | sdks:
284 | dart: ">=2.12.0 <3.0.0"
285 | flutter: ">=2.0.0"
286 |
--------------------------------------------------------------------------------
/example/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: example
2 | description: A new Flutter project.
3 | publish_to: none
4 |
5 | # The following defines the version and build number for your application.
6 | # A version number is three numbers separated by dots, like 1.2.43
7 | # followed by an optional build number separated by a +.
8 | # Both the version and the builder number may be overridden in flutter
9 | # build by specifying --build-name and --build-number, respectively.
10 | # In Android, build-name is used as versionName while build-number used as versionCode.
11 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning
12 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
13 | # Read more about iOS versioning at
14 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
15 | version: 1.0.0+1
16 |
17 | environment:
18 | sdk: ">=2.12.0 <3.0.0"
19 |
20 | dependencies:
21 | flutter:
22 | sdk: flutter
23 |
24 | # The following adds the Cupertino Icons font to your application.
25 | # Use with the CupertinoIcons class for iOS style icons.
26 | cupertino_icons: ^0.1.2
27 | flutter_beautiful_popup:
28 | path: ../
29 | flutter_colorpicker: ^0.6.0
30 | flutter_highlight: ^0.7.0
31 | url_launcher: ^6.0.7
32 | url_launcher_web: ^2.0.1
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 | # The following line ensures that the Material Icons font is
44 | # included with your application, so that you can use the icons in
45 | # the material Icons class.
46 | uses-material-design: true
47 | # To add assets to your application, add an assets section, like this:
48 | assets:
49 | - images/github.png
50 | - images/mytemplate.png
51 | # - images/a_dot_ham.jpeg
52 | # An image asset can refer to one or more resolution-specific "variants", see
53 | # https://flutter.dev/assets-and-images/#resolution-aware.
54 | # For details regarding adding assets from package dependencies, see
55 | # https://flutter.dev/assets-and-images/#from-packages
56 | # To add custom fonts to your application, add a fonts section here,
57 | # in this "flutter" section. Each entry in this list should have a
58 | # "family" key with the font family name, and a "fonts" key with a
59 | # list giving the asset and other descriptors for the font. For
60 | # example:
61 | # fonts:
62 | # - family: Schyler
63 | # fonts:
64 | # - asset: fonts/Schyler-Regular.ttf
65 | # - asset: fonts/Schyler-Italic.ttf
66 | # style: italic
67 | # - family: Trajan Pro
68 | # fonts:
69 | # - asset: fonts/TrajanPro.ttf
70 | # - asset: fonts/TrajanPro_Bold.ttf
71 | # weight: 700
72 | #
73 | # For details regarding fonts from package dependencies,
74 | # see https://flutter.dev/custom-fonts/#from-packages
75 |
--------------------------------------------------------------------------------
/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:example/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/web/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | updater_example
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/img/bg/authentication.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/img/bg/authentication.png
--------------------------------------------------------------------------------
/img/bg/camera.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/img/bg/camera.png
--------------------------------------------------------------------------------
/img/bg/coin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/img/bg/coin.png
--------------------------------------------------------------------------------
/img/bg/fail.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/img/bg/fail.png
--------------------------------------------------------------------------------
/img/bg/geolocation.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/img/bg/geolocation.png
--------------------------------------------------------------------------------
/img/bg/gift.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/img/bg/gift.png
--------------------------------------------------------------------------------
/img/bg/notification.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/img/bg/notification.png
--------------------------------------------------------------------------------
/img/bg/red_packet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/img/bg/red_packet.png
--------------------------------------------------------------------------------
/img/bg/rocket_blue.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/img/bg/rocket_blue.png
--------------------------------------------------------------------------------
/img/bg/rocket_green.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/img/bg/rocket_green.png
--------------------------------------------------------------------------------
/img/bg/rocket_orange.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/img/bg/rocket_orange.png
--------------------------------------------------------------------------------
/img/bg/rocket_orange_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/img/bg/rocket_orange_2.png
--------------------------------------------------------------------------------
/img/bg/success.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/img/bg/success.png
--------------------------------------------------------------------------------
/img/bg/term.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/img/bg/term.png
--------------------------------------------------------------------------------
/img/bg/thumb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/img/bg/thumb.png
--------------------------------------------------------------------------------
/img/source/gift.ai:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jaweii/Flutter_beautiful_popup/c9e398ea5155dd6c418113747d4bf3fd95ad3505/img/source/gift.ai
--------------------------------------------------------------------------------
/lib/main.dart:
--------------------------------------------------------------------------------
1 | library beautiful_popup;
2 |
3 | import 'dart:typed_data';
4 |
5 | import 'package:flutter/material.dart';
6 | import 'dart:ui' as ui;
7 | import 'package:image/image.dart' as img;
8 | import 'package:flutter/services.dart';
9 | import 'templates/Common.dart';
10 | import 'templates/OrangeRocket.dart';
11 | import 'templates/GreenRocket.dart';
12 | import 'templates/OrangeRocket2.dart';
13 | import 'templates/Coin.dart';
14 | import 'templates/BlueRocket.dart';
15 | import 'templates/Thumb.dart';
16 | import 'templates/Gift.dart';
17 | import 'templates/Camera.dart';
18 | import 'templates/Notification.dart';
19 | import 'templates/Geolocation.dart';
20 | import 'templates/Success.dart';
21 | import 'templates/Fail.dart';
22 | import 'templates/Authentication.dart';
23 | import 'templates/Term.dart';
24 | import 'templates/RedPacket.dart';
25 |
26 | export 'templates/Common.dart';
27 | export 'templates/OrangeRocket.dart';
28 | export 'templates/GreenRocket.dart';
29 | export 'templates/OrangeRocket2.dart';
30 | export 'templates/Coin.dart';
31 | export 'templates/BlueRocket.dart';
32 | export 'templates/Thumb.dart';
33 | export 'templates/Gift.dart';
34 | export 'templates/Camera.dart';
35 | export 'templates/Notification.dart';
36 | export 'templates/Geolocation.dart';
37 | export 'templates/Success.dart';
38 | export 'templates/Fail.dart';
39 | export 'templates/Authentication.dart';
40 | export 'templates/Term.dart';
41 | export 'templates/RedPacket.dart';
42 |
43 | class BeautifulPopup {
44 | BuildContext _context;
45 | BuildContext get context => _context;
46 |
47 | Type? _template;
48 | Type? get template => _template;
49 |
50 | BeautifulPopupTemplate Function(BeautifulPopup options)? _build;
51 | BeautifulPopupTemplate get instance {
52 | final build = _build;
53 | if (build != null) return build(this);
54 | switch (template) {
55 | case TemplateOrangeRocket:
56 | return TemplateOrangeRocket(this);
57 | case TemplateGreenRocket:
58 | return TemplateGreenRocket(this);
59 | case TemplateOrangeRocket2:
60 | return TemplateOrangeRocket2(this);
61 | case TemplateCoin:
62 | return TemplateCoin(this);
63 | case TemplateBlueRocket:
64 | return TemplateBlueRocket(this);
65 | case TemplateThumb:
66 | return TemplateThumb(this);
67 | case TemplateGift:
68 | return TemplateGift(this);
69 | case TemplateCamera:
70 | return TemplateCamera(this);
71 | case TemplateNotification:
72 | return TemplateNotification(this);
73 | case TemplateGeolocation:
74 | return TemplateGeolocation(this);
75 | case TemplateSuccess:
76 | return TemplateSuccess(this);
77 | case TemplateFail:
78 | return TemplateFail(this);
79 | case TemplateAuthentication:
80 | return TemplateAuthentication(this);
81 | case TemplateTerm:
82 | return TemplateTerm(this);
83 | case TemplateRedPacket:
84 | default:
85 | return TemplateRedPacket(this);
86 | }
87 | }
88 |
89 | ui.Image? _illustration;
90 | ui.Image? get illustration => _illustration;
91 |
92 | dynamic title = '';
93 | dynamic content = '';
94 | List? actions;
95 | Widget? close;
96 | bool? barrierDismissible;
97 |
98 | Color? primaryColor;
99 |
100 | BeautifulPopup({
101 | required BuildContext context,
102 | required Type? template,
103 | }) : _context = context,
104 | _template = template {
105 | primaryColor = instance.primaryColor; // Get the default primary color.
106 | }
107 |
108 | static BeautifulPopup customize({
109 | required BuildContext context,
110 | required BeautifulPopupTemplate Function(BeautifulPopup options) build,
111 | }) {
112 | final popup = BeautifulPopup(
113 | context: context,
114 | template: null,
115 | );
116 | popup._build = build;
117 | return popup;
118 | }
119 |
120 | /// Recolor the BeautifulPopup.
121 | /// This method is kind of slow.R
122 | Future recolor(Color color) async {
123 | this.primaryColor = color;
124 | final illustrationData = await rootBundle.load(instance.illustrationKey);
125 | final buffer = illustrationData.buffer.asUint8List();
126 | img.Image? asset;
127 | asset = img.readPng(buffer);
128 | if (asset != null) {
129 | img.adjustColor(
130 | asset,
131 | saturation: 0,
132 | // hue: 0,
133 | );
134 | img.colorOffset(
135 | asset,
136 | red: color.red,
137 | // I don't know why the effect is nicer with the number ╮(╯▽╰)╭
138 | green: color.green ~/ 3,
139 | blue: color.blue ~/ 2,
140 | alpha: 0,
141 | );
142 | }
143 | final paint = await PaintingBinding.instance?.instantiateImageCodec(
144 | asset != null ? Uint8List.fromList(img.encodePng(asset)) : buffer);
145 | final nextFrame = await paint?.getNextFrame();
146 | _illustration = nextFrame?.image;
147 | return this;
148 | }
149 |
150 | /// `title`: Must be a `String` or `Widget`. Defaults to `''`.
151 | ///
152 | /// `content`: Must be a `String` or `Widget`. Defaults to `''`.
153 | ///
154 | /// `actions`: The set of actions that are displaed at bottom of the dialog,
155 | ///
156 | /// Typically this is a list of [BeautifulPopup.button]. Defaults to `[]`.
157 | ///
158 | /// `barrierDismissible`: Determine whether this dialog can be dismissed. Default to `False`.
159 | ///
160 | /// `close`: Close widget.
161 | Future show({
162 | dynamic title,
163 | dynamic content,
164 | List? actions,
165 | bool barrierDismissible = false,
166 | Widget? close,
167 | }) {
168 | this.title = title;
169 | this.content = content;
170 | this.actions = actions;
171 | this.barrierDismissible = barrierDismissible;
172 | this.close = close ?? instance.close;
173 | final child = WillPopScope(
174 | onWillPop: () {
175 | return Future.value(barrierDismissible);
176 | },
177 | child: instance,
178 | );
179 | return showGeneralDialog(
180 | barrierColor: Colors.black38,
181 | barrierDismissible: barrierDismissible,
182 | barrierLabel: barrierDismissible ? 'beautiful_popup' : null,
183 | context: context,
184 | pageBuilder: (context, animation1, animation2) {
185 | return child;
186 | },
187 | transitionDuration: Duration(milliseconds: 150),
188 | transitionBuilder: (ctx, a1, a2, child) {
189 | return Transform.scale(
190 | scale: a1.value,
191 | child: Opacity(
192 | opacity: a1.value,
193 | child: child,
194 | ),
195 | );
196 | },
197 | );
198 | }
199 |
200 | BeautifulPopupButton get button => instance.button;
201 | }
202 |
--------------------------------------------------------------------------------
/lib/templates/Authentication.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/cupertino.dart';
3 | import '../main.dart';
4 | import 'Common.dart';
5 |
6 | /// 
7 | class TemplateAuthentication extends BeautifulPopupTemplate {
8 | final BeautifulPopup options;
9 | TemplateAuthentication(this.options) : super(options);
10 |
11 | @override
12 | final illustrationPath = 'img/bg/authentication.png';
13 | @override
14 | Color get primaryColor => options.primaryColor ?? Color(0xff15c0ec);
15 | @override
16 | final maxWidth = 400;
17 | @override
18 | final maxHeight = 617;
19 | @override
20 | final bodyMargin = 0;
21 | @override
22 | get layout {
23 | return [
24 | Positioned(
25 | child: background,
26 | ),
27 | Positioned(
28 | top: percentH(32),
29 | child: title,
30 | ),
31 | Positioned(
32 | top: percentH(44),
33 | left: percentW(10),
34 | right: percentW(10),
35 | height: percentH(actions == null ? 52 : 38),
36 | child: content,
37 | ),
38 | Positioned(
39 | bottom: percentW(8),
40 | left: percentW(8),
41 | right: percentW(8),
42 | child: actions ?? Container(),
43 | ),
44 | ];
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/lib/templates/BlueRocket.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/cupertino.dart';
3 | import 'Common.dart';
4 | import '../main.dart';
5 | import 'package:auto_size_text/auto_size_text.dart';
6 |
7 | /// 
8 | class TemplateBlueRocket extends BeautifulPopupTemplate {
9 | final BeautifulPopup options;
10 | TemplateBlueRocket(this.options) : super(options);
11 |
12 | @override
13 | final illustrationPath = 'img/bg/rocket_blue.png';
14 | @override
15 | Color get primaryColor => options.primaryColor ?? Color(0xff4aa3f9);
16 | @override
17 | final maxWidth = 400;
18 | @override
19 | final maxHeight = 512;
20 | @override
21 | final bodyMargin = 0;
22 |
23 | @override
24 | Widget get title {
25 | if (options.title is Widget) {
26 | return SizedBox(
27 | width: percentW(54),
28 | height: percentH(10),
29 | child: options.title,
30 | );
31 | }
32 | return SizedBox(
33 | width: percentW(54),
34 | child: Opacity(
35 | opacity: 0.9,
36 | child: AutoSizeText(
37 | options.title,
38 | maxLines: 1,
39 | style: TextStyle(
40 | fontSize: Theme.of(options.context).textTheme.headline6?.fontSize,
41 | color: Colors.white,
42 | fontWeight: FontWeight.bold,
43 | ),
44 | ),
45 | ),
46 | );
47 | }
48 |
49 | @override
50 | get layout {
51 | return [
52 | Positioned(
53 | child: background,
54 | ),
55 | Positioned(
56 | top: percentH(13),
57 | left: percentW(10),
58 | child: title,
59 | ),
60 | Positioned(
61 | top: percentH(40),
62 | left: percentW(10),
63 | right: percentW(10),
64 | height: percentH(actions == null ? 50 : 38),
65 | child: content,
66 | ),
67 | Positioned(
68 | bottom: percentW(12),
69 | left: percentW(10),
70 | right: percentW(10),
71 | child: actions ?? Container(),
72 | ),
73 | ];
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/lib/templates/Camera.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/cupertino.dart';
3 | import 'Common.dart';
4 | import '../main.dart';
5 |
6 | /// 
7 | class TemplateCamera extends BeautifulPopupTemplate {
8 | final BeautifulPopup options;
9 | TemplateCamera(this.options) : super(options);
10 |
11 | @override
12 | final illustrationPath = 'img/bg/camera.png';
13 | @override
14 | Color get primaryColor => options.primaryColor ?? Color(0xff72b2e0);
15 | @override
16 | final maxWidth = 400;
17 | @override
18 | final maxHeight = 500;
19 | @override
20 | final bodyMargin = 20;
21 | @override
22 | get layout {
23 | return [
24 | Positioned(
25 | child: background,
26 | ),
27 | Positioned(
28 | top: percentH(42),
29 | child: title,
30 | ),
31 | Positioned(
32 | top: percentH(54),
33 | height: percentH(actions == null ? 40 : 24),
34 | left: percentW(8),
35 | right: percentW(8),
36 | child: content,
37 | ),
38 | Positioned(
39 | bottom: percentW(8),
40 | left: percentW(8),
41 | right: percentW(8),
42 | child: actions ?? Container(),
43 | ),
44 | ];
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/lib/templates/Coin.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/cupertino.dart';
3 | import 'Common.dart';
4 | import '../main.dart';
5 |
6 | /// 
7 | class TemplateCoin extends BeautifulPopupTemplate {
8 | final BeautifulPopup options;
9 | TemplateCoin(this.options) : super(options);
10 |
11 | @override
12 | final illustrationPath = 'img/bg/coin.png';
13 | @override
14 | Color get primaryColor => options.primaryColor ?? Color(0xffff8269);
15 | @override
16 | final maxWidth = 400;
17 | @override
18 | final maxHeight = 586;
19 | @override
20 | final bodyMargin = 0;
21 | @override
22 | get layout {
23 | return [
24 | Positioned(
25 | child: background,
26 | ),
27 | Positioned(
28 | top: percentH(46),
29 | child: title,
30 | ),
31 | Positioned(
32 | top: percentH(56),
33 | left: percentW(12),
34 | right: percentW(12),
35 | height: percentH(actions == null ? 36 : 24),
36 | child: content,
37 | ),
38 | Positioned(
39 | bottom: percentW(12),
40 | left: percentW(14),
41 | right: percentW(14),
42 | child: actions ?? Container(),
43 | ),
44 | ];
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/lib/templates/Common.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import '../main.dart';
3 | import 'dart:ui' as ui;
4 | import 'package:auto_size_text/auto_size_text.dart';
5 |
6 | typedef Widget BeautifulPopupButton({
7 | required String label,
8 | required void Function() onPressed,
9 | TextStyle labelStyle,
10 | bool outline,
11 | bool flat,
12 | });
13 |
14 | /// You can extend this class to custom your own template.
15 | abstract class BeautifulPopupTemplate extends StatefulWidget {
16 | final BeautifulPopup options;
17 | BeautifulPopupTemplate(this.options);
18 |
19 | final State state = BeautifulPopupTemplateState();
20 |
21 | @override
22 | State createState() => state;
23 |
24 | Size get size {
25 | double screenWidth = MediaQuery.of(options.context).size.width;
26 | double screenHeight = MediaQuery.of(options.context).size.height;
27 | double height = screenHeight > maxHeight ? maxHeight : screenHeight;
28 | double width;
29 | height = height - bodyMargin * 2;
30 | if ((screenHeight - height) < 140) {
31 | // For keep close button visible
32 | height = screenHeight - 140;
33 | width = height / maxHeight * maxWidth;
34 | } else {
35 | if (screenWidth > maxWidth) {
36 | width = maxWidth - bodyMargin * 2;
37 | } else {
38 | width = screenWidth - bodyMargin * 2;
39 | }
40 | height = width / maxWidth * maxHeight;
41 | }
42 | return Size(width, height);
43 | }
44 |
45 | double get width => size.width;
46 | double get height => size.height;
47 |
48 | double get maxWidth;
49 | double get maxHeight;
50 | double get bodyMargin;
51 |
52 | /// The path of the illustration asset.
53 | String get illustrationPath => '';
54 | String get illustrationKey =>
55 | 'packages/flutter_beautiful_popup/$illustrationPath';
56 | Color get primaryColor;
57 |
58 | double percentW(double n) {
59 | return width * n / 100;
60 | }
61 |
62 | double percentH(double n) {
63 | return height * n / 100;
64 | }
65 |
66 | Widget get close {
67 | return MaterialButton(
68 | shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(100)),
69 | splashColor: Colors.transparent,
70 | hoverColor: Colors.transparent,
71 | minWidth: 45,
72 | height: 45,
73 | child: Container(
74 | padding: EdgeInsets.all(20),
75 | child: Icon(Icons.close, color: Colors.white70, size: 26),
76 | ),
77 | padding: EdgeInsets.all(0),
78 | onPressed: Navigator.of(options.context).pop,
79 | );
80 | }
81 |
82 | Widget get background {
83 | final illustration = options.illustration;
84 | return illustration == null
85 | ? Image.asset(
86 | illustrationKey,
87 | width: percentW(100),
88 | height: percentH(100),
89 | fit: BoxFit.fill,
90 | )
91 | : CustomPaint(
92 | size: Size(percentW(100), percentH(100)),
93 | painter: ImageEditor(
94 | image: illustration,
95 | ),
96 | );
97 | }
98 |
99 | Widget get title {
100 | if (options.title is Widget) {
101 | return Container(
102 | width: percentW(100),
103 | height: percentH(10),
104 | alignment: Alignment.center,
105 | child: options.title,
106 | );
107 | }
108 | return Container(
109 | alignment: Alignment.center,
110 | width: percentW(100),
111 | height: percentH(10),
112 | child: Opacity(
113 | opacity: 0.95,
114 | child: AutoSizeText(
115 | options.title,
116 | maxLines: 1,
117 | style: TextStyle(
118 | fontSize: Theme.of(options.context).textTheme.headline6?.fontSize,
119 | color: primaryColor,
120 | fontWeight: FontWeight.bold,
121 | ),
122 | ),
123 | ),
124 | );
125 | }
126 |
127 | Widget get content {
128 | return options.content is String
129 | ? AutoSizeText(
130 | options.content,
131 | minFontSize: 10,
132 | style: TextStyle(
133 | color: Colors.black87,
134 | ),
135 | )
136 | : options.content;
137 | }
138 |
139 | Widget? get actions {
140 | final actionsList = options.actions;
141 | if (actionsList == null || actionsList.length == 0) return null;
142 | return Flex(
143 | mainAxisAlignment: MainAxisAlignment.center,
144 | crossAxisAlignment: CrossAxisAlignment.center,
145 | mainAxisSize: MainAxisSize.max,
146 | direction: Axis.horizontal,
147 | children: actionsList
148 | .map(
149 | (button) => Flexible(
150 | flex: 1,
151 | child: Padding(
152 | padding: EdgeInsets.symmetric(horizontal: 5),
153 | child: button,
154 | ),
155 | ),
156 | )
157 | .toList(),
158 | );
159 | }
160 |
161 | BeautifulPopupButton get button {
162 | return ({
163 | required String label,
164 | required void Function() onPressed,
165 | bool outline = false,
166 | bool flat = false,
167 | TextStyle labelStyle = const TextStyle(),
168 | }) {
169 | final gradient = LinearGradient(colors: [
170 | primaryColor.withOpacity(0.5),
171 | primaryColor,
172 | ]);
173 | final double elevation = (outline || flat) ? 0 : 2;
174 | final labelColor =
175 | (outline || flat) ? primaryColor : Colors.white.withOpacity(0.95);
176 | final decoration = BoxDecoration(
177 | gradient: (outline || flat) ? null : gradient,
178 | borderRadius: BorderRadius.all(Radius.circular(80.0)),
179 | border: Border.all(
180 | color: outline ? primaryColor : Colors.transparent,
181 | width: (outline && !flat) ? 1 : 0,
182 | ),
183 | );
184 | final minHeight = 40.0 - (outline ? 2 : 0);
185 | return RaisedButton(
186 | color: Colors.transparent,
187 | elevation: elevation,
188 | highlightElevation: 0,
189 | splashColor: Colors.transparent,
190 | child: Ink(
191 | decoration: decoration,
192 | child: Container(
193 | constraints: BoxConstraints(
194 | minWidth: 100,
195 | minHeight: minHeight,
196 | ),
197 | alignment: Alignment.center,
198 | child: Text(
199 | label,
200 | style: TextStyle(
201 | color: labelColor,
202 | ).merge(labelStyle),
203 | ),
204 | ),
205 | ),
206 | padding: EdgeInsets.all(0),
207 | shape: RoundedRectangleBorder(
208 | borderRadius: BorderRadius.circular(50),
209 | ),
210 | onPressed: onPressed,
211 | );
212 | };
213 | }
214 |
215 | List get layout;
216 | }
217 |
218 | class BeautifulPopupTemplateState extends State {
219 | OverlayEntry? closeEntry;
220 | @override
221 | void initState() {
222 | super.initState();
223 |
224 | // Display close button
225 | Future.delayed(Duration.zero, () {
226 | closeEntry = OverlayEntry(
227 | builder: (ctx) {
228 | final bottom = (MediaQuery.of(context).size.height -
229 | widget.height -
230 | widget.bodyMargin * 2) /
231 | 4 -
232 | 20;
233 | return Stack(
234 | overflow: Overflow.visible,
235 | children: [
236 | Positioned(
237 | child: Container(
238 | alignment: Alignment.center,
239 | child: widget.options.close ?? Container(),
240 | ),
241 | left: 0,
242 | right: 0,
243 | bottom: bottom,
244 | )
245 | ],
246 | );
247 | },
248 | );
249 | final entry = closeEntry;
250 | if (entry != null) Overlay.of(context)?.insert(entry);
251 | });
252 | }
253 |
254 | @override
255 | Widget build(BuildContext context) {
256 | return Column(
257 | mainAxisSize: MainAxisSize.min,
258 | mainAxisAlignment: MainAxisAlignment.center,
259 | children: [
260 | Material(
261 | color: Colors.transparent,
262 | child: Container(
263 | margin: EdgeInsets.all(widget.bodyMargin),
264 | height: widget.height,
265 | width: widget.width,
266 | child: Stack(
267 | overflow: Overflow.visible,
268 | children: widget.layout,
269 | ),
270 | ),
271 | )
272 | ],
273 | );
274 | }
275 |
276 | @override
277 | void dispose() {
278 | closeEntry?.remove();
279 | super.dispose();
280 | }
281 | }
282 |
283 | class ImageEditor extends CustomPainter {
284 | ui.Image image;
285 | ImageEditor({
286 | required this.image,
287 | });
288 |
289 | @override
290 | void paint(Canvas canvas, Size size) {
291 | canvas.drawImageRect(
292 | image,
293 | Rect.fromLTRB(0, 0, image.width.toDouble(), image.height.toDouble()),
294 | Rect.fromLTRB(0, 0, size.width, size.height),
295 | new Paint(),
296 | );
297 | }
298 |
299 | @override
300 | bool shouldRepaint(CustomPainter oldDelegate) => false;
301 | }
302 |
--------------------------------------------------------------------------------
/lib/templates/Fail.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/cupertino.dart';
3 | import '../main.dart';
4 |
5 | /// 
6 | class TemplateFail extends TemplateSuccess {
7 | final BeautifulPopup options;
8 | TemplateFail(this.options) : super(options);
9 |
10 | @override
11 | final illustrationPath = 'img/bg/fail.png';
12 | @override
13 | Color get primaryColor => options.primaryColor ?? Color(0xffF77273);
14 | }
15 |
--------------------------------------------------------------------------------
/lib/templates/Geolocation.dart:
--------------------------------------------------------------------------------
1 | import '../main.dart';
2 |
3 | /// 
4 | class TemplateGeolocation extends TemplateCamera {
5 | final BeautifulPopup options;
6 | TemplateGeolocation(this.options) : super(options);
7 |
8 | @override
9 | final illustrationPath = 'img/bg/geolocation.png';
10 | }
11 |
--------------------------------------------------------------------------------
/lib/templates/Gift.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/cupertino.dart';
3 | import 'Common.dart';
4 | import '../main.dart';
5 |
6 | /// 
7 | class TemplateGift extends BeautifulPopupTemplate {
8 | final BeautifulPopup options;
9 | TemplateGift(this.options) : super(options);
10 |
11 | @override
12 | final illustrationPath = 'img/bg/gift.png';
13 | @override
14 | Color get primaryColor => options.primaryColor ?? Color(0xffFF2F49);
15 | @override
16 | final maxWidth = 400;
17 | @override
18 | final maxHeight = 580;
19 | @override
20 | final bodyMargin = 30;
21 | @override
22 | BeautifulPopupButton get button {
23 | return ({
24 | required String label,
25 | required void Function() onPressed,
26 | bool outline = false,
27 | bool flat = false,
28 | TextStyle labelStyle = const TextStyle(),
29 | }) {
30 | final gradient = LinearGradient(colors: [
31 | primaryColor.withOpacity(0.5),
32 | primaryColor,
33 | ]);
34 | final double elevation = (outline || flat) ? 0 : 2;
35 | final labelColor =
36 | (outline || flat) ? primaryColor : Colors.white.withOpacity(0.95);
37 | final decoration = BoxDecoration(
38 | gradient: (outline || flat) ? null : gradient,
39 | borderRadius: BorderRadius.all(Radius.circular(80.0)),
40 | border: Border.all(
41 | color: outline ? primaryColor : Colors.transparent,
42 | width: (outline && !flat) ? 1 : 0,
43 | ),
44 | );
45 | final minHeight = 40.0 - (outline ? 4 : 0);
46 | return RaisedButton(
47 | color: Colors.transparent,
48 | elevation: elevation,
49 | highlightElevation: 0,
50 | splashColor: Colors.transparent,
51 | child: Ink(
52 | decoration: decoration,
53 | child: Container(
54 | constraints: BoxConstraints(
55 | minWidth: 100,
56 | minHeight: minHeight,
57 | ),
58 | alignment: Alignment.center,
59 | child: Text(
60 | label,
61 | style: TextStyle(
62 | color: Colors.white.withOpacity(0.95),
63 | fontWeight: FontWeight.bold,
64 | ).merge(labelStyle),
65 | ),
66 | ),
67 | ),
68 | padding: EdgeInsets.all(0),
69 | shape: RoundedRectangleBorder(
70 | borderRadius: BorderRadius.circular(50),
71 | ),
72 | onPressed: onPressed,
73 | );
74 | };
75 | }
76 |
77 | @override
78 | get layout {
79 | return [
80 | Positioned(
81 | child: background,
82 | ),
83 | Positioned(
84 | top: percentH(26),
85 | child: title,
86 | ),
87 | Positioned(
88 | top: percentH(36),
89 | left: percentW(5),
90 | right: percentW(5),
91 | height: percentH(actions == null ? 60 : 50),
92 | child: content,
93 | ),
94 | Positioned(
95 | bottom: percentW(5),
96 | left: percentW(5),
97 | right: percentW(5),
98 | child: actions ?? Container(),
99 | ),
100 | ];
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/lib/templates/GreenRocket.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/cupertino.dart';
3 | import 'Common.dart';
4 | import '../main.dart';
5 |
6 | /// 
7 | class TemplateGreenRocket extends BeautifulPopupTemplate {
8 | final BeautifulPopup options;
9 | TemplateGreenRocket(this.options) : super(options);
10 |
11 | @override
12 | final illustrationPath = 'img/bg/rocket_green.png';
13 | @override
14 | Color get primaryColor => options.primaryColor ?? Color(0xff49ceae);
15 | @override
16 | final maxWidth = 400;
17 | @override
18 | final maxHeight = 496;
19 | @override
20 | final bodyMargin = 0;
21 | @override
22 | get layout {
23 | return [
24 | Positioned(
25 | child: background,
26 | ),
27 | Positioned(
28 | top: percentH(35),
29 | child: title,
30 | ),
31 | Positioned(
32 | top: percentH(45),
33 | left: percentW(14),
34 | right: percentW(14),
35 | height: percentH(actions == null ? 44 : 32),
36 | child: content,
37 | ),
38 | Positioned(
39 | bottom: percentW(12),
40 | left: percentW(12),
41 | right: percentW(12),
42 | child: actions ?? Container(),
43 | ),
44 | ];
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/lib/templates/Notification.dart:
--------------------------------------------------------------------------------
1 | import '../main.dart';
2 |
3 | /// 
4 | class TemplateNotification extends TemplateCamera {
5 | final BeautifulPopup options;
6 | TemplateNotification(this.options) : super(options);
7 |
8 | @override
9 | final illustrationPath = 'img/bg/notification.png';
10 | }
11 |
--------------------------------------------------------------------------------
/lib/templates/OrangeRocket.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/cupertino.dart';
3 | import 'Common.dart';
4 | import '../main.dart';
5 | import 'package:auto_size_text/auto_size_text.dart';
6 |
7 | /// 
8 | class TemplateOrangeRocket extends BeautifulPopupTemplate {
9 | final BeautifulPopup options;
10 | TemplateOrangeRocket(this.options) : super(options);
11 |
12 | @override
13 | final illustrationPath = 'img/bg/rocket_orange.png';
14 | @override
15 | Color get primaryColor => options.primaryColor ?? Color(0xffdf3428);
16 | @override
17 | final maxWidth = 400;
18 | @override
19 | final maxHeight = 600;
20 | @override
21 | final bodyMargin = 30;
22 | Widget get title {
23 | if (options.title is Widget) {
24 | return SizedBox(
25 | width: percentW(40),
26 | height: percentH(10),
27 | child: options.title,
28 | );
29 | }
30 | return SizedBox(
31 | width: percentW(40),
32 | child: Opacity(
33 | opacity: 0.8,
34 | child: AutoSizeText(
35 | options.title,
36 | maxLines: 1,
37 | style: TextStyle(
38 | fontSize: Theme.of(options.context).textTheme.headline6?.fontSize,
39 | color: primaryColor,
40 | fontWeight: FontWeight.bold,
41 | ),
42 | ),
43 | ),
44 | );
45 | }
46 |
47 | @override
48 | get layout {
49 | return [
50 | Positioned(
51 | child: background,
52 | ),
53 | Positioned(
54 | top: percentH(20),
55 | left: percentW(10),
56 | child: title,
57 | ),
58 | Positioned(
59 | top: percentH(50),
60 | left: percentW(6),
61 | right: percentW(6),
62 | height: percentH(actions == null ? 46 : 34),
63 | child: content,
64 | ),
65 | Positioned(
66 | bottom: percentW(5),
67 | left: percentW(5),
68 | right: percentW(5),
69 | child: actions ?? Container(),
70 | ),
71 | ];
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/lib/templates/OrangeRocket2.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/cupertino.dart';
3 | import 'Common.dart';
4 | import '../main.dart';
5 |
6 | /// 
7 | class TemplateOrangeRocket2 extends BeautifulPopupTemplate {
8 | final BeautifulPopup options;
9 | TemplateOrangeRocket2(this.options) : super(options);
10 |
11 | @override
12 | final illustrationPath = 'img/bg/rocket_orange_2.png';
13 | @override
14 | Color get primaryColor => options.primaryColor ?? Color(0xffff902b);
15 | @override
16 | final maxWidth = 350;
17 | @override
18 | final maxHeight = 488;
19 | @override
20 | final bodyMargin = 0;
21 | @override
22 | get layout {
23 | return [
24 | Positioned(
25 | child: background,
26 | ),
27 | Positioned(
28 | top: percentH(42),
29 | width: percentW(54),
30 | child: title,
31 | ),
32 | Positioned(
33 | top: percentH(52),
34 | left: percentW(10),
35 | right: percentW(10),
36 | height: percentH(actions == null ? 40 : 26),
37 | child: content,
38 | ),
39 | Positioned(
40 | bottom: percentW(12),
41 | left: percentW(10),
42 | right: percentW(10),
43 | child: actions ?? Container(),
44 | ),
45 | ];
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/lib/templates/RedPacket.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/cupertino.dart';
3 | import '../main.dart';
4 | import 'package:auto_size_text/auto_size_text.dart';
5 | import 'Common.dart';
6 |
7 | /// 
8 | class TemplateRedPacket extends BeautifulPopupTemplate {
9 | final BeautifulPopup options;
10 | TemplateRedPacket(this.options) : super(options);
11 |
12 | @override
13 | final illustrationPath = 'img/bg/red_packet.png';
14 | @override
15 | Color get primaryColor => options.primaryColor ?? Color(0xfffa1a2c);
16 | @override
17 | final maxWidth = 400;
18 | @override
19 | final maxHeight = 620;
20 | @override
21 | final bodyMargin = 0;
22 | @override
23 | Widget get title {
24 | if (options.title is Widget) {
25 | return SizedBox(
26 | width: percentW(100),
27 | height: percentH(10),
28 | child: Center(
29 | child: options.title,
30 | ),
31 | );
32 | }
33 | return SizedBox(
34 | width: percentW(100),
35 | child: Center(
36 | child: Opacity(
37 | opacity: 0.95,
38 | child: AutoSizeText(
39 | options.title,
40 | maxLines: 1,
41 | style: TextStyle(
42 | fontSize: Theme.of(options.context).textTheme.headline6?.fontSize,
43 | color: Colors.white,
44 | fontWeight: FontWeight.bold,
45 | ),
46 | ),
47 | ),
48 | ),
49 | );
50 | }
51 |
52 | Widget get content {
53 | return options.content is String
54 | ? AutoSizeText(
55 | options.content,
56 | minFontSize:
57 | Theme.of(options.context).textTheme.headline6?.fontSize ?? 12,
58 | style: TextStyle(
59 | color: Colors.white.withOpacity(0.95),
60 | ),
61 | )
62 | : options.content;
63 | }
64 |
65 | @override
66 | BeautifulPopupButton get button {
67 | return ({
68 | required String label,
69 | required void Function() onPressed,
70 | bool outline = false,
71 | bool flat = false,
72 | TextStyle labelStyle = const TextStyle(),
73 | }) {
74 | final gradient = LinearGradient(colors: [
75 | primaryColor.withOpacity(0.5),
76 | primaryColor,
77 | ]);
78 | final double elevation = (outline || flat) ? 0 : 2;
79 | final labelColor =
80 | (outline || flat) ? primaryColor : Colors.white.withOpacity(0.95);
81 | final decoration = BoxDecoration(
82 | gradient: (outline || flat) ? null : gradient,
83 | borderRadius: BorderRadius.all(Radius.circular(80.0)),
84 | border: Border.all(
85 | color: outline ? primaryColor : Colors.transparent,
86 | width: (outline && !flat) ? 1 : 0,
87 | ),
88 | );
89 | final minHeight = 40.0 - (outline ? 2 : 0);
90 | return RaisedButton(
91 | color: Colors.transparent,
92 | elevation: elevation,
93 | highlightElevation: 0,
94 | splashColor: Colors.transparent,
95 | child: Ink(
96 | decoration: decoration,
97 | child: Container(
98 | constraints: BoxConstraints(
99 | minWidth: 100,
100 | minHeight: minHeight,
101 | ),
102 | alignment: Alignment.center,
103 | child: Text(
104 | label,
105 | style: TextStyle(
106 | color: Colors.white.withOpacity(0.95),
107 | fontWeight: FontWeight.bold,
108 | ).merge(labelStyle),
109 | ),
110 | ),
111 | ),
112 | padding: EdgeInsets.all(0),
113 | shape: RoundedRectangleBorder(
114 | borderRadius: BorderRadius.circular(50),
115 | ),
116 | onPressed: onPressed,
117 | );
118 | };
119 | }
120 |
121 | @override
122 | get layout {
123 | return [
124 | Positioned(
125 | child: background,
126 | ),
127 | Positioned(
128 | top: percentH(10),
129 | child: title,
130 | ),
131 | Positioned(
132 | top: percentH(40),
133 | left: percentW(12),
134 | right: percentW(12),
135 | height: percentH(actions == null ? 56 : 42),
136 | child: content,
137 | ),
138 | Positioned(
139 | bottom: percentW(10),
140 | left: percentW(10),
141 | right: percentW(10),
142 | child: actions ?? Container(),
143 | ),
144 | ];
145 | }
146 | }
147 |
--------------------------------------------------------------------------------
/lib/templates/Success.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/cupertino.dart';
3 | import 'Common.dart';
4 | import '../main.dart';
5 |
6 | /// 
7 | class TemplateSuccess extends BeautifulPopupTemplate {
8 | final BeautifulPopup options;
9 | TemplateSuccess(this.options) : super(options);
10 |
11 | @override
12 | final illustrationPath = 'img/bg/success.png';
13 | @override
14 | Color get primaryColor => options.primaryColor ?? Color(0xff4ABDFE);
15 | @override
16 | final maxWidth = 400;
17 | @override
18 | final maxHeight = 588;
19 | @override
20 | final bodyMargin = 30;
21 | @override
22 | get layout {
23 | return [
24 | Positioned(
25 | child: background,
26 | ),
27 | Positioned(
28 | top: percentH(46),
29 | child: title,
30 | ),
31 | Positioned(
32 | top: percentH(58),
33 | left: percentW(8),
34 | right: percentW(8),
35 | height: percentH(actions == null ? 40 : 24),
36 | child: content,
37 | ),
38 | Positioned(
39 | bottom: percentW(8),
40 | left: percentW(8),
41 | right: percentW(8),
42 | child: actions ?? Container(),
43 | ),
44 | ];
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/lib/templates/Term.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/cupertino.dart';
3 | import '../main.dart';
4 | import 'Common.dart';
5 |
6 | /// 
7 | class TemplateTerm extends BeautifulPopupTemplate {
8 | final BeautifulPopup options;
9 | TemplateTerm(this.options) : super(options);
10 |
11 | @override
12 | final illustrationPath = 'img/bg/term.png';
13 | @override
14 | Color get primaryColor => options.primaryColor ?? Color(0xfffb8c3c);
15 | @override
16 | final maxWidth = 400;
17 | @override
18 | final maxHeight = 617;
19 | @override
20 | final bodyMargin = 0;
21 | @override
22 | get layout {
23 | return [
24 | Positioned(
25 | child: background,
26 | ),
27 | Positioned(
28 | top: percentH(32),
29 | child: title,
30 | ),
31 | Positioned(
32 | top: percentH(42),
33 | left: percentW(12),
34 | right: percentW(12),
35 | height: percentH(actions == null ? 52 : 42),
36 | child: content,
37 | ),
38 | Positioned(
39 | bottom: percentW(9),
40 | left: percentW(12),
41 | right: percentW(12),
42 | child: actions ?? Container(),
43 | ),
44 | ];
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/lib/templates/Thumb.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/cupertino.dart';
3 | import 'Common.dart';
4 | import '../main.dart';
5 | import 'package:auto_size_text/auto_size_text.dart';
6 |
7 | /// 
8 | class TemplateThumb extends BeautifulPopupTemplate {
9 | final BeautifulPopup options;
10 | TemplateThumb(this.options) : super(options);
11 |
12 | @override
13 | final illustrationPath = 'img/bg/thumb.png';
14 | @override
15 | Color get primaryColor => options.primaryColor ?? Color(0xfffb675d);
16 | @override
17 | final maxWidth = 400;
18 | @override
19 | final maxHeight = 570;
20 | @override
21 | final bodyMargin = 0;
22 |
23 | @override
24 | Widget get title {
25 | if (options.title is Widget) {
26 | return SizedBox(
27 | width: percentW(54),
28 | height: percentH(10),
29 | child: options.title,
30 | );
31 | }
32 | return SizedBox(
33 | width: percentW(54),
34 | child: Opacity(
35 | opacity: 0.9,
36 | child: AutoSizeText(
37 | options.title,
38 | maxLines: 1,
39 | style: TextStyle(
40 | fontSize: Theme.of(options.context).textTheme.headline6?.fontSize,
41 | color: Colors.white,
42 | fontWeight: FontWeight.bold,
43 | ),
44 | ),
45 | ),
46 | );
47 | }
48 |
49 | @override
50 | BeautifulPopupButton get button {
51 | return ({
52 | required String label,
53 | required void Function() onPressed,
54 | bool outline = false,
55 | bool flat = false,
56 | TextStyle labelStyle = const TextStyle(),
57 | }) {
58 | final gradient = LinearGradient(colors: [
59 | primaryColor.withOpacity(0.5),
60 | primaryColor,
61 | ]);
62 | final double elevation = (outline || flat) ? 0 : 2;
63 | final labelColor =
64 | (outline || flat) ? primaryColor : Colors.white.withOpacity(0.95);
65 | final decoration = BoxDecoration(
66 | gradient: (outline || flat) ? null : gradient,
67 | borderRadius: BorderRadius.all(Radius.circular(80.0)),
68 | border: Border.all(
69 | color: outline ? primaryColor : Colors.transparent,
70 | width: (outline && !flat) ? 1 : 0,
71 | ),
72 | );
73 | final minHeight = 40.0 - (outline ? 2 : 0);
74 | return RaisedButton(
75 | color: Colors.transparent,
76 | elevation: elevation,
77 | highlightElevation: 0,
78 | splashColor: Colors.transparent,
79 | child: Ink(
80 | decoration: decoration,
81 | child: Container(
82 | constraints: BoxConstraints(
83 | minWidth: 100,
84 | minHeight: minHeight,
85 | ),
86 | alignment: Alignment.center,
87 | child: Text(
88 | label,
89 | style: TextStyle(
90 | color: Colors.white.withOpacity(0.95),
91 | ).merge(labelStyle),
92 | ),
93 | ),
94 | ),
95 | padding: EdgeInsets.all(0),
96 | shape: RoundedRectangleBorder(
97 | borderRadius: BorderRadius.circular(50),
98 | ),
99 | onPressed: onPressed,
100 | );
101 | };
102 | }
103 |
104 | @override
105 | get layout {
106 | return [
107 | Positioned(
108 | child: background,
109 | ),
110 | Positioned(
111 | top: percentH(10),
112 | left: percentW(10),
113 | child: title,
114 | ),
115 | Positioned(
116 | top: percentH(28),
117 | left: percentW(10),
118 | right: percentW(10),
119 | height: percentH(actions == null ? 62 : 50),
120 | child: content,
121 | ),
122 | Positioned(
123 | bottom: percentW(14),
124 | left: percentW(10),
125 | right: percentW(10),
126 | child: actions ?? Container(),
127 | ),
128 | ];
129 | }
130 | }
131 |
--------------------------------------------------------------------------------
/pubspec.lock:
--------------------------------------------------------------------------------
1 | # Generated by pub
2 | # See https://dart.dev/tools/pub/glossary#lockfile
3 | packages:
4 | archive:
5 | dependency: transitive
6 | description:
7 | name: archive
8 | url: "https://pub.flutter-io.cn"
9 | source: hosted
10 | version: "3.1.2"
11 | async:
12 | dependency: transitive
13 | description:
14 | name: async
15 | url: "https://pub.flutter-io.cn"
16 | source: hosted
17 | version: "2.8.1"
18 | auto_size_text:
19 | dependency: "direct main"
20 | description:
21 | name: auto_size_text
22 | url: "https://pub.flutter-io.cn"
23 | source: hosted
24 | version: "3.0.0-nullsafety.0"
25 | boolean_selector:
26 | dependency: transitive
27 | description:
28 | name: boolean_selector
29 | url: "https://pub.flutter-io.cn"
30 | source: hosted
31 | version: "2.1.0"
32 | characters:
33 | dependency: transitive
34 | description:
35 | name: characters
36 | url: "https://pub.flutter-io.cn"
37 | source: hosted
38 | version: "1.1.0"
39 | charcode:
40 | dependency: transitive
41 | description:
42 | name: charcode
43 | url: "https://pub.flutter-io.cn"
44 | source: hosted
45 | version: "1.3.1"
46 | clock:
47 | dependency: transitive
48 | description:
49 | name: clock
50 | url: "https://pub.flutter-io.cn"
51 | source: hosted
52 | version: "1.1.0"
53 | collection:
54 | dependency: transitive
55 | description:
56 | name: collection
57 | url: "https://pub.flutter-io.cn"
58 | source: hosted
59 | version: "1.15.0"
60 | crypto:
61 | dependency: transitive
62 | description:
63 | name: crypto
64 | url: "https://pub.flutter-io.cn"
65 | source: hosted
66 | version: "3.0.1"
67 | fake_async:
68 | dependency: transitive
69 | description:
70 | name: fake_async
71 | url: "https://pub.flutter-io.cn"
72 | source: hosted
73 | version: "1.2.0"
74 | flutter:
75 | dependency: "direct main"
76 | description: flutter
77 | source: sdk
78 | version: "0.0.0"
79 | flutter_test:
80 | dependency: "direct dev"
81 | description: flutter
82 | source: sdk
83 | version: "0.0.0"
84 | image:
85 | dependency: "direct main"
86 | description:
87 | name: image
88 | url: "https://pub.flutter-io.cn"
89 | source: hosted
90 | version: "3.0.4"
91 | matcher:
92 | dependency: transitive
93 | description:
94 | name: matcher
95 | url: "https://pub.flutter-io.cn"
96 | source: hosted
97 | version: "0.12.10"
98 | meta:
99 | dependency: transitive
100 | description:
101 | name: meta
102 | url: "https://pub.flutter-io.cn"
103 | source: hosted
104 | version: "1.7.0"
105 | path:
106 | dependency: transitive
107 | description:
108 | name: path
109 | url: "https://pub.flutter-io.cn"
110 | source: hosted
111 | version: "1.8.0"
112 | petitparser:
113 | dependency: transitive
114 | description:
115 | name: petitparser
116 | url: "https://pub.flutter-io.cn"
117 | source: hosted
118 | version: "4.3.0"
119 | sky_engine:
120 | dependency: transitive
121 | description: flutter
122 | source: sdk
123 | version: "0.0.99"
124 | source_span:
125 | dependency: transitive
126 | description:
127 | name: source_span
128 | url: "https://pub.flutter-io.cn"
129 | source: hosted
130 | version: "1.8.1"
131 | stack_trace:
132 | dependency: transitive
133 | description:
134 | name: stack_trace
135 | url: "https://pub.flutter-io.cn"
136 | source: hosted
137 | version: "1.10.0"
138 | stream_channel:
139 | dependency: transitive
140 | description:
141 | name: stream_channel
142 | url: "https://pub.flutter-io.cn"
143 | source: hosted
144 | version: "2.1.0"
145 | string_scanner:
146 | dependency: transitive
147 | description:
148 | name: string_scanner
149 | url: "https://pub.flutter-io.cn"
150 | source: hosted
151 | version: "1.1.0"
152 | term_glyph:
153 | dependency: transitive
154 | description:
155 | name: term_glyph
156 | url: "https://pub.flutter-io.cn"
157 | source: hosted
158 | version: "1.2.0"
159 | test_api:
160 | dependency: transitive
161 | description:
162 | name: test_api
163 | url: "https://pub.flutter-io.cn"
164 | source: hosted
165 | version: "0.4.2"
166 | typed_data:
167 | dependency: transitive
168 | description:
169 | name: typed_data
170 | url: "https://pub.flutter-io.cn"
171 | source: hosted
172 | version: "1.3.0"
173 | vector_math:
174 | dependency: transitive
175 | description:
176 | name: vector_math
177 | url: "https://pub.flutter-io.cn"
178 | source: hosted
179 | version: "2.1.0"
180 | xml:
181 | dependency: transitive
182 | description:
183 | name: xml
184 | url: "https://pub.flutter-io.cn"
185 | source: hosted
186 | version: "5.3.0"
187 | sdks:
188 | dart: ">=2.14.0 <3.0.0"
189 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: flutter_beautiful_popup
2 | description: A flutter package to help you beautify your app popups.
3 | version: 1.7.0
4 | homepage: https://jaweii.github.io/Flutter_beautiful_popup/example/build/web
5 |
6 | environment:
7 | sdk: ">=2.12.0 <3.0.0"
8 |
9 | dependencies:
10 | flutter:
11 | sdk: flutter
12 | auto_size_text: ^3.0.0-nullsafety.0
13 | image: ^3.0.4
14 |
15 | dev_dependencies:
16 | flutter_test:
17 | sdk: flutter
18 |
19 | # For information on the generic Dart part of this file, see the
20 | # following page: https://dart.dev/tools/pub/pubspec
21 |
22 | # The following section is specific to Flutter.
23 | flutter:
24 | uses-material-design: true
25 | # To add assets to your package, add an assets section, like this:
26 | assets:
27 | - img/bg/
28 | #
29 | # For details regarding assets in packages, see
30 | # https://flutter.dev/assets-and-images/#from-packages
31 | #
32 | # An image asset can refer to one or more resolution-specific "variants", see
33 | # https://flutter.dev/assets-and-images/#resolution-aware.
34 | # To add custom fonts to your package, add a fonts section here,
35 | # in this "flutter" section. Each entry in this list should have a
36 | # "family" key with the font family name, and a "fonts" key with a
37 | # list giving the asset and other descriptors for the font. For
38 | # example:
39 | # fonts:
40 | # - family: Schyler
41 | # fonts:
42 | # - asset: fonts/Schyler-Regular.ttf
43 | # - asset: fonts/Schyler-Italic.ttf
44 | # style: italic
45 | # - family: Trajan Pro
46 | # fonts:
47 | # - asset: fonts/TrajanPro.ttf
48 | # - asset: fonts/TrajanPro_Bold.ttf
49 | # weight: 700
50 | #
51 | # For details regarding fonts in packages, see
52 | # https://flutter.dev/custom-fonts/#from-packages
53 |
--------------------------------------------------------------------------------
/test/beautiful_popup_test.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_test/flutter_test.dart';
2 |
3 | import 'package:flutter_beautiful_popup/main.dart';
4 |
5 | void main() {
6 | test('test', () {
7 | // final popup = BeautifulPopup();
8 | });
9 | }
10 |
--------------------------------------------------------------------------------