add flutter_whatsnew

This commit is contained in:
2026-01-14 01:05:24 -08:00
parent ea97794e19
commit 42350734bb
43 changed files with 60270 additions and 0 deletions
@@ -0,0 +1,10 @@
# This is a generated file; do not edit or check into version control.
path_provider_linux=/Users/rodydavis/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-2.1.7/
path_provider_windows=/Users/rodydavis/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.1.3/
shared_preferences=/Users/rodydavis/.pub-cache/hosted/pub.dartlang.org/shared_preferences-2.0.15/
shared_preferences_android=/Users/rodydavis/.pub-cache/hosted/pub.dartlang.org/shared_preferences_android-2.0.13/
shared_preferences_ios=/Users/rodydavis/.pub-cache/hosted/pub.dartlang.org/shared_preferences_ios-2.1.1/
shared_preferences_linux=/Users/rodydavis/.pub-cache/hosted/pub.dartlang.org/shared_preferences_linux-2.1.1/
shared_preferences_macos=/Users/rodydavis/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-2.0.4/
shared_preferences_web=/Users/rodydavis/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-2.0.4/
shared_preferences_windows=/Users/rodydavis/.pub-cache/hosted/pub.dartlang.org/shared_preferences_windows-2.1.1/
@@ -0,0 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"shared_preferences_ios","path":"/Users/rodydavis/.pub-cache/hosted/pub.dartlang.org/shared_preferences_ios-2.1.1/","native_build":true,"dependencies":[]}],"android":[{"name":"shared_preferences_android","path":"/Users/rodydavis/.pub-cache/hosted/pub.dartlang.org/shared_preferences_android-2.0.13/","native_build":true,"dependencies":[]}],"macos":[{"name":"shared_preferences_macos","path":"/Users/rodydavis/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-2.0.4/","native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/rodydavis/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-2.1.7/","native_build":false,"dependencies":[]},{"name":"shared_preferences_linux","path":"/Users/rodydavis/.pub-cache/hosted/pub.dartlang.org/shared_preferences_linux-2.1.1/","native_build":false,"dependencies":["path_provider_linux"]}],"windows":[{"name":"path_provider_windows","path":"/Users/rodydavis/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.1.3/","native_build":false,"dependencies":[]},{"name":"shared_preferences_windows","path":"/Users/rodydavis/.pub-cache/hosted/pub.dartlang.org/shared_preferences_windows-2.1.1/","native_build":false,"dependencies":["path_provider_windows"]}],"web":[{"name":"shared_preferences_web","path":"/Users/rodydavis/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-2.0.4/","dependencies":[]}]},"dependencyGraph":[{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_android","shared_preferences_ios","shared_preferences_linux","shared_preferences_macos","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_android","dependencies":[]},{"name":"shared_preferences_ios","dependencies":[]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]}],"date_created":"2022-10-31 19:15:52.915634","version":"3.4.0-30.0.pre.12"}
+32
View File
@@ -0,0 +1,32 @@
name: github pages
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Setup Flutter
uses: subosito/flutter-action@v1
with:
channel: 'dev'
- name: Install
run: |
flutter config --enable-web
flutter pub get
- name: Build
run: cd example && flutter build web
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# personal_token: ${{ secrets.PERSONAL_TOKEN }}
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
publish_dir: ./example/build/web
+10
View File
@@ -0,0 +1,10 @@
.DS_Store
.dart_tool/
.packages
.pub/
build/
ios/.generated/
ios/Flutter/Generated.xcconfig
ios/Runner/GeneratedPluginRegistrant.*
+84
View File
@@ -0,0 +1,84 @@
## 1.0.5
* Adding adaptive option
* Updating example
* Adding delay option
## 1.0.4
* Null safety
* Updating styles
* Adding ScheduledWhatsNewPage with delay or app version check
* Making more methods optional
* Web compatible
## 1.0.3
* Adding Web Support
## 1.0.2
* Adding Path Option
* Removing Native Widgets
## 1.0.1
* Bumping Version
## 1.0.0
* Addign Cupertino UI
## 0.3.0 - 04.06.2019
* Making Example Desktop Aware
## 0.2.1 - 04.05.2019
* `tb2761` Added Button Colors
## [0.2.0] - Breaking Changes
* Updated Example
* Added Ability to Read from Changelog
* Removed Method WhatsNewPage.show()
* Adding `flutter_markdown`
## [0.1.0] - Breaking Change
* Updated Example
* Removed `get_version`
* Plugin is now pure dart
* Added Method WhatsNewPage.show()
## [0.0.7] - New Button Action
* Updated Example
## [0.0.6] - New Button Action
* Added Optional Callback for Button Press.
* By Defualt it will Push to the Passed Widget.
* Updating Dart Dependency
## [0.0.5] - Updating for Flutter
* Increased button width on android.
* Updated native_widgets 0.1.0
## [0.0.4] - Bug Fixes
* Fixed Loading Bug.
## [0.0.3] - Bug Fixes
* Updating Startup Behavior.
## [0.0.2] - Bug Fixes
* Updating Startup Behavior.
## [0.0.1] - Whats New Widget
* Added Components, Version Check and Example.
* Added `native_widgets`
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018 Rhodes Davis Jr.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+174
View File
@@ -0,0 +1,174 @@
[![Flutter Community: flutter_whatsnew](https://fluttercommunity.dev/_github/header/flutter_whatsnew)](https://github.com/fluttercommunity/community)
[![Buy Me A Coffee](https://img.shields.io/badge/Donate-Buy%20Me%20A%20Coffee-yellow.svg)](https://www.buymeacoffee.com/rodydavis)
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WSH3GVC49GNNJ)
![github pages](https://github.com/fluttercommunity/flutter_whatsnew/workflows/github%20pages/badge.svg)
# flutter_whatsnew
[![pub package](https://img.shields.io/pub/v/flutter_whatsnew.svg)](https://pub.dartlang.org/packages/flutter_whatsnew)
A Flutter Plugin to Show a Whats New page.
Online Demo: https://fluttercommunity.github.io/flutter_whatsnew/
## Usage
To use this plugin, add `flutter_whatsnew` as a [dependency in your pubspec.yaml file](https://flutter.io/platform-plugins/).
``` dart
// Import package
import 'package:flutter_whatsnew/flutter_whatsnew.dart';
```
![changelog](https://github.com/fluttercommunity/flutter_whatsnew/blob/master/doc/screenshots/changes.png)
If using `WhatsNewPage.changelog` and you want it to pickup the `CHANGELOG.md' add it to the Flutter asset directory, otherwise manually pass in the .md file with the changes. This uses the full markdown previewer.
``` yaml
assets:
- CHANGELOG.md
```
![changelog](https://github.com/fluttercommunity/flutter_whatsnew/blob/master/doc/screenshots/changelog.png)
## Example
``` dart
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_whatsnew/flutter_whatsnew.dart';
void main() {
runApp(MaterialApp(home: ShowWhatsNew()));
}
class ShowWhatsNew extends StatelessWidget {
final double textScaleFactor = 1.0;
@override
Widget build(BuildContext context) {
return new Scaffold(
body: SafeArea(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
RaisedButton(
child: Text("Show Changelog"),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => WhatsNewPage.changelog(
title: Text(
"What's New",
textScaleFactor: textScaleFactor,
textAlign: TextAlign.center,
style: const TextStyle(
// Text Style Needed to Look like iOS 11
fontSize: 22.0,
fontWeight: FontWeight.bold,
),
),
buttonText: Text(
'Continue',
textScaleFactor: textScaleFactor,
style: const TextStyle(color: Colors.white),
),
),
fullscreenDialog: true,
),
);
},
),
Container(height: 50.0),
RaisedButton(
child: Text("Show Changes"),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => WhatsNewPage(
title: Text(
"What's New",
textScaleFactor: textScaleFactor,
textAlign: TextAlign.center,
style: const TextStyle(
// Text Style Needed to Look like iOS 11
fontSize: 22.0,
fontWeight: FontWeight.bold,
),
),
buttonText: Text(
'Continue',
textScaleFactor: textScaleFactor,
style: const TextStyle(color: Colors.white),
),
// Create a List of WhatsNewItem for use in the Whats New Page
// Create as many as you need, it will be scrollable
items: <ListTile>[
ListTile(
leading: const Icon(Icons.color_lens),
title: Text(
'Dark Theme',
textScaleFactor: textScaleFactor,
), //Title is the only Required Item
subtitle: Text(
'Black and grey theme (Tap to Change)',
textScaleFactor: textScaleFactor,
),
onTap: () {
// You Can Navigate to Locations in the App
Navigator.of(context).pushNamed("/settings");
},
),
ListTile(
leading: const Icon(Icons.map),
title: Text(
'Google Maps',
textScaleFactor: textScaleFactor,
),
subtitle: Text(
'Open Address Links in Google Maps instead of Apple Maps (Tap to Change)',
textScaleFactor: textScaleFactor,
),
onTap: () {
// You Can Navigate to Locations in the App
Navigator.of(context).pushNamed("/settings");
},
),
ListTile(
leading: const Icon(Icons.notifications_active),
title: Text(
'Push Notifications',
textScaleFactor: textScaleFactor,
),
subtitle: Text(
'Stay tuned for important information that can be pushed to you',
textScaleFactor: textScaleFactor,
),
onTap: () {
WhatsNewPage.showDetailPopUp(
context,
'Info',
"You can turn off push notifications any time in your application settings.",
);
},
),
], //Required
),
fullscreenDialog: true,
),
);
},
),
],
),
)),
);
}
}
```
Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

@@ -0,0 +1 @@
{"CHANGELOG.md":["CHANGELOG.md"],"packages/cupertino_icons/assets/CupertinoIcons.ttf":["packages/cupertino_icons/assets/CupertinoIcons.ttf"]}
@@ -0,0 +1,44 @@
## [0.2.0] - Breaking Changes
* Updated Example
* Added Ability to Read from Changelog
* Removed Method WhatsNewPage.show()
* Adding `flutter_markdown`
## [0.1.0] - Breaking Change
* Updated Example
* Removed `get_version`
* Plugin is now pure dart
* Added Method WhatsNewPage.show()
## [0.0.7] - New Button Action
* Updated Example
## [0.0.6] - New Button Action
* Added Optional Callback for Button Press.
* By Defualt it will Push to the Passed Widget.
* Updating Dart Dependency
## [0.0.5] - Updating for Flutter
* Increased button width on android.
* Updated native_widgets 0.1.0
## [0.0.4] - Bug Fixes
* Fixed Loading Bug.
## [0.0.3] - Bug Fixes
* Updating Startup Behavior.
## [0.0.2] - Bug Fixes
* Updating Startup Behavior.
## [0.0.1] - Whats New Widget
* Added Components, Version Check and Example.
@@ -0,0 +1 @@
[{"family":"MaterialIcons","fonts":[{"asset":"fonts/MaterialIcons-Regular.ttf"}]},{"family":"packages/cupertino_icons/CupertinoIcons","fonts":[{"asset":"packages/cupertino_icons/assets/CupertinoIcons.ttf"}]}]
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 917 B

@@ -0,0 +1,42 @@
'use strict';
const CACHE_NAME = 'flutter-app-cache';
const RESOURCES = {
"/index.html": "e36211d86e9c70409c58295974f749a1",
"/main.dart.js": "c1e1c2e5ea16c188c22975a9166f5a72",
"/favicon.png": "5dcef449791fa27946b3d35ad8803796",
"/icons/Icon-192.png": "ac9a721a12bbc803b44f645561ecb1e1",
"/icons/Icon-512.png": "96e752610906ba2a93c65f8abe1645f1",
"/manifest.json": "00e0b69b49487ce4f9ff0c5fac8fda49",
"/assets/LICENSE": "f8ebb17df69514cfec71dfa66e490471",
"/assets/CHANGELOG.md": "b6d57b5714b9ce36fb30ce40a715b2ca",
"/assets/AssetManifest.json": "cc5894ec3c840a4a6ca93b27b8e8178a",
"/assets/FontManifest.json": "01700ba55b08a6141f33e168c4a6c22f",
"/assets/packages/cupertino_icons/assets/CupertinoIcons.ttf": "9a62a954b81a1ad45a58b9bcea89b50b",
"/assets/fonts/MaterialIcons-Regular.ttf": "56d3ffdef7a25659eab6a68a3fbfaf16"
};
self.addEventListener('activate', function (event) {
event.waitUntil(
caches.keys().then(function (cacheName) {
return caches.delete(cacheName);
}).then(function (_) {
return caches.open(CACHE_NAME);
}).then(function (cache) {
return cache.addAll(Object.keys(RESOURCES));
})
);
});
self.addEventListener('fetch', function (event) {
event.respondWith(
caches.match(event.request)
.then(function (response) {
if (response) {
return response;
}
return fetch(event.request, {
credentials: 'include'
});
})
);
});
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

+33
View File
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
<meta name="description" content="A new Flutter project.">
<!-- iOS meta tags & icons -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="example">
<link rel="apple-touch-icon" href="/icons/Icon-192.png">
<!-- Favicon -->
<link rel="shortcut icon" type="image/png" href="/favicon.png"/>
<title>example</title>
<link rel="manifest" href="/manifest.json">
</head>
<body>
<!-- This script installs service_worker.js to provide PWA functionality to
application. For more information, see:
https://developers.google.com/web/fundamentals/primers/service-workers -->
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', function () {
navigator.serviceWorker.register('/flutter_service_worker.js');
});
}
</script>
<script src="main.dart.js" type="application/javascript"></script>
</body>
</html>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,23 @@
{
"name": "example",
"short_name": "example",
"start_url": ".",
"display": "minimal-ui",
"background_color": "#0175C2",
"theme_color": "#0175C2",
"description": "A new Flutter project.",
"orientation": "portrait-primary",
"prefer_related_applications": false,
"icons": [
{
"src": "icons/Icon-192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "icons/Icon-512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}
@@ -0,0 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"shared_preferences_ios","path":"/Users/rodydavis/.pub-cache/hosted/pub.dartlang.org/shared_preferences_ios-2.1.1/","native_build":true,"dependencies":[]}],"android":[{"name":"shared_preferences_android","path":"/Users/rodydavis/.pub-cache/hosted/pub.dartlang.org/shared_preferences_android-2.0.13/","native_build":true,"dependencies":[]}],"macos":[{"name":"shared_preferences_macos","path":"/Users/rodydavis/.pub-cache/hosted/pub.dartlang.org/shared_preferences_macos-2.0.4/","native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/rodydavis/.pub-cache/hosted/pub.dartlang.org/path_provider_linux-2.1.7/","native_build":false,"dependencies":[]},{"name":"shared_preferences_linux","path":"/Users/rodydavis/.pub-cache/hosted/pub.dartlang.org/shared_preferences_linux-2.1.1/","native_build":false,"dependencies":["path_provider_linux"]}],"windows":[{"name":"path_provider_windows","path":"/Users/rodydavis/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-2.1.3/","native_build":false,"dependencies":[]},{"name":"shared_preferences_windows","path":"/Users/rodydavis/.pub-cache/hosted/pub.dartlang.org/shared_preferences_windows-2.1.1/","native_build":false,"dependencies":["path_provider_windows"]}],"web":[{"name":"shared_preferences_web","path":"/Users/rodydavis/.pub-cache/hosted/pub.dartlang.org/shared_preferences_web-2.0.4/","dependencies":[]}]},"dependencyGraph":[{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_android","shared_preferences_ios","shared_preferences_linux","shared_preferences_macos","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_android","dependencies":[]},{"name":"shared_preferences_ios","dependencies":[]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]}],"date_created":"2022-10-31 19:15:52.967674","version":"3.4.0-30.0.pre.12"}
@@ -0,0 +1,70 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# Visual Studio Code related
.vscode/
# Flutter/Dart/Pub related
**/doc/api/
.dart_tool/
.flutter-plugins
.packages
.pub-cache/
.pub/
/build/
# Android related
**/android/**/gradle-wrapper.jar
**/android/.gradle
**/android/captures/
**/android/gradlew
**/android/gradlew.bat
**/android/local.properties
**/android/**/GeneratedPluginRegistrant.java
# iOS/XCode related
**/ios/**/*.mode1v3
**/ios/**/*.mode2v3
**/ios/**/*.moved-aside
**/ios/**/*.pbxuser
**/ios/**/*.perspectivev3
**/ios/**/*sync/
**/ios/**/.sconsign.dblite
**/ios/**/.tags*
**/ios/**/.vagrant/
**/ios/**/DerivedData/
**/ios/**/Icon?
**/ios/**/Pods/
**/ios/**/.symlinks/
**/ios/**/profile
**/ios/**/xcuserdata
**/ios/.generated/
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/flutter_assets/
**/ios/ServiceDefinitions.json
**/ios/Runner/GeneratedPluginRegistrant.*
# Exceptions to above rules.
!**/ios/**/default.mode1v3
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
@@ -0,0 +1,45 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled.
version:
revision: 7679b8c37130170ddcf60afac00954dfdccd2763
channel: master
project_type: app
# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 7679b8c37130170ddcf60afac00954dfdccd2763
base_revision: 7679b8c37130170ddcf60afac00954dfdccd2763
- platform: android
create_revision: 7679b8c37130170ddcf60afac00954dfdccd2763
base_revision: 7679b8c37130170ddcf60afac00954dfdccd2763
- platform: ios
create_revision: 7679b8c37130170ddcf60afac00954dfdccd2763
base_revision: 7679b8c37130170ddcf60afac00954dfdccd2763
- platform: linux
create_revision: 7679b8c37130170ddcf60afac00954dfdccd2763
base_revision: 7679b8c37130170ddcf60afac00954dfdccd2763
- platform: macos
create_revision: 7679b8c37130170ddcf60afac00954dfdccd2763
base_revision: 7679b8c37130170ddcf60afac00954dfdccd2763
- platform: web
create_revision: 7679b8c37130170ddcf60afac00954dfdccd2763
base_revision: 7679b8c37130170ddcf60afac00954dfdccd2763
- platform: windows
create_revision: 7679b8c37130170ddcf60afac00954dfdccd2763
base_revision: 7679b8c37130170ddcf60afac00954dfdccd2763
# User provided section
# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
@@ -0,0 +1,44 @@
## [0.2.0] - Breaking Changes
* Updated Example
* Added Ability to Read from Changelog
* Removed Method WhatsNewPage.show()
* Adding `flutter_markdown`
## [0.1.0] - Breaking Change
* Updated Example
* Removed `get_version`
* Plugin is now pure dart
* Added Method WhatsNewPage.show()
## [0.0.7] - New Button Action
* Updated Example
## [0.0.6] - New Button Action
* Added Optional Callback for Button Press.
* By Defualt it will Push to the Passed Widget.
* Updating Dart Dependency
## [0.0.5] - Updating for Flutter
* Increased button width on android.
* Updated native_widgets 0.1.0
## [0.0.4] - Bug Fixes
* Fixed Loading Bug.
## [0.0.3] - Bug Fixes
* Updating Startup Behavior.
## [0.0.2] - Bug Fixes
* Updating Startup Behavior.
## [0.0.1] - Whats New Widget
* Added Components, Version Check and Example.
+142
View File
@@ -0,0 +1,142 @@
# flutter_whatsnew_example
Demonstrates how to use the flutter_whatsnew plugin.
```dart
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_whatsnew/flutter_whatsnew.dart';
void main() {
runApp(MaterialApp(home: ShowWhatsNew()));
}
class ShowWhatsNew extends StatelessWidget {
final double textScaleFactor = 1.0;
@override
Widget build(BuildContext context) {
return new Scaffold(
body: SafeArea(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
RaisedButton(
child: Text("Show Changelog"),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => WhatsNewPage.changelog(
title: Text(
"What's New",
textScaleFactor: textScaleFactor,
textAlign: TextAlign.center,
style: const TextStyle(
// Text Style Needed to Look like iOS 11
fontSize: 22.0,
fontWeight: FontWeight.bold,
),
),
buttonText: Text(
'Continue',
textScaleFactor: textScaleFactor,
style: const TextStyle(color: Colors.white),
),
),
fullscreenDialog: true,
),
);
},
),
Container(height: 50.0),
RaisedButton(
child: Text("Show Changes"),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => WhatsNewPage(
title: Text(
"What's New",
textScaleFactor: textScaleFactor,
textAlign: TextAlign.center,
style: const TextStyle(
// Text Style Needed to Look like iOS 11
fontSize: 22.0,
fontWeight: FontWeight.bold,
),
),
buttonText: Text(
'Continue',
textScaleFactor: textScaleFactor,
style: const TextStyle(color: Colors.white),
),
// Create a List of WhatsNewItem for use in the Whats New Page
// Create as many as you need, it will be scrollable
items: <ListTile>[
ListTile(
leading: const Icon(Icons.color_lens),
title: Text(
'Dark Theme',
textScaleFactor: textScaleFactor,
), //Title is the only Required Item
subtitle: Text(
'Black and grey theme (Tap to Change)',
textScaleFactor: textScaleFactor,
),
onTap: () {
// You Can Navigate to Locations in the App
Navigator.of(context).pushNamed("/settings");
},
),
ListTile(
leading: const Icon(Icons.map),
title: Text(
'Google Maps',
textScaleFactor: textScaleFactor,
),
subtitle: Text(
'Open Address Links in Google Maps instead of Apple Maps (Tap to Change)',
textScaleFactor: textScaleFactor,
),
onTap: () {
// You Can Navigate to Locations in the App
Navigator.of(context).pushNamed("/settings");
},
),
ListTile(
leading: const Icon(Icons.notifications_active),
title: Text(
'Push Notifications',
textScaleFactor: textScaleFactor,
),
subtitle: Text(
'Stay tuned for important information that can be pushed to you',
textScaleFactor: textScaleFactor,
),
onTap: () {
WhatsNewPage.showDetailPopUp(
context,
'Info',
"You can turn off push notifications any time in your application settings.",
);
},
),
], //Required
),
fullscreenDialog: true,
),
);
},
),
],
),
)),
);
}
}
```
@@ -0,0 +1,29 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
@@ -0,0 +1,181 @@
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_whatsnew/flutter_whatsnew.dart';
import 'dart:io' show Platform;
import 'package:flutter/foundation.dart';
// The existing imports
// !! Keep your existing impots here !!
/// main is entry point of Flutter application
void main() {
// Desktop platforms aren't a valid platform.
if (!kIsWeb) _setTargetPlatformForDesktop();
return runApp(MyApp());
}
/// If the current platform is desktop, override the default platform to
/// a supported platform (iOS for macOS, Android for Linux and Windows).
/// Otherwise, do nothing.
void _setTargetPlatformForDesktop() {
TargetPlatform targetPlatform;
if (Platform.isMacOS) {
targetPlatform = TargetPlatform.iOS;
} else if (Platform.isLinux || Platform.isWindows) {
targetPlatform = TargetPlatform.android;
}
if (targetPlatform != null) {
debugDefaultTargetPlatformOverride = targetPlatform;
}
}
class MyApp extends StatelessWidget {
final double textScaleFactor = 1.0;
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: HomeScreen(textScaleFactor: textScaleFactor),
);
}
}
class HomeScreen extends StatelessWidget {
const HomeScreen({
Key key,
@required this.textScaleFactor,
}) : super(key: key);
final double textScaleFactor;
@override
Widget build(BuildContext context) {
return ScheduledWhatsNewPage(
details: WhatsNewPage.changelog(),
delay: Duration(seconds: 7),
child: Scaffold(
body: SafeArea(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
ElevatedButton(
child: Text("Show Changelog"),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => WhatsNewPage.changelog(
title: Text(
"What's New",
textScaleFactor: textScaleFactor,
textAlign: TextAlign.center,
style: const TextStyle(
// Text Style Needed to Look like iOS 11
fontSize: 22.0,
fontWeight: FontWeight.bold,
),
),
buttonText: Text(
'Continue',
textScaleFactor: textScaleFactor,
style: const TextStyle(color: Colors.white),
),
),
fullscreenDialog: true,
),
);
},
),
Container(height: 50.0),
ElevatedButton(
child: Text("Show Changes"),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => WhatsNewPage(
title: Text(
"What's New",
textScaleFactor: textScaleFactor,
textAlign: TextAlign.center,
style: const TextStyle(
// Text Style Needed to Look like iOS 11
fontSize: 22.0,
fontWeight: FontWeight.bold,
),
),
buttonText: Text(
'Continue',
textScaleFactor: textScaleFactor,
style: const TextStyle(color: Colors.white),
),
// Create a List of WhatsNewItem for use in the Whats New Page
// Create as many as you need, it will be scrollable
items: <ListTile>[
ListTile(
leading: const Icon(Icons.color_lens),
title: Text(
'Dark Theme',
textScaleFactor: textScaleFactor,
), //Title is the only Required Item
subtitle: Text(
'Black and grey theme (Tap to Change)',
textScaleFactor: textScaleFactor,
),
onTap: () {
// You Can Navigate to Locations in the App
Navigator.of(context).pushNamed("/settings");
},
),
ListTile(
leading: const Icon(Icons.map),
title: Text(
'Google Maps',
textScaleFactor: textScaleFactor,
),
subtitle: Text(
'Open Address Links in Google Maps instead of Apple Maps (Tap to Change)',
textScaleFactor: textScaleFactor,
),
onTap: () {
// You Can Navigate to Locations in the App
Navigator.of(context).pushNamed("/settings");
},
),
ListTile(
leading: const Icon(Icons.notifications_active),
title: Text(
'Push Notifications',
textScaleFactor: textScaleFactor,
),
subtitle: Text(
'Stay tuned for important information that can be pushed to you',
textScaleFactor: textScaleFactor,
),
onTap: () {
WhatsNewPage.showDetailPopUp(
context,
'Info',
"You can turn off push notifications any time in your application settings.",
);
},
),
], //Required
),
fullscreenDialog: true,
),
);
},
),
],
),
),
),
),
);
}
}
@@ -0,0 +1,24 @@
name: flutter_whatsnew_example
description: Demonstrates how to use the flutter_whatsnew plugin.
publish_to: 'none'
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter_whatsnew:
path: ../
flutter:
uses-material-design: true
assets:
- CHANGELOG.md
Binary file not shown.

After

Width:  |  Height:  |  Size: 917 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
<meta name="description" content="A new Flutter project.">
<!-- iOS meta tags & icons -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="example">
<link rel="apple-touch-icon" href="/icons/Icon-192.png">
<!-- Favicon -->
<link rel="shortcut icon" type="image/png" href="/favicon.png"/>
<title>example</title>
<link rel="manifest" href="/manifest.json">
</head>
<body>
<!-- This script installs service_worker.js to provide PWA functionality to
application. For more information, see:
https://developers.google.com/web/fundamentals/primers/service-workers -->
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', function () {
navigator.serviceWorker.register('/flutter_service_worker.js');
});
}
</script>
<script src="main.dart.js" type="application/javascript"></script>
</body>
</html>
@@ -0,0 +1,23 @@
{
"name": "example",
"short_name": "example",
"start_url": ".",
"display": "minimal-ui",
"background_color": "#0175C2",
"theme_color": "#0175C2",
"description": "A new Flutter project.",
"orientation": "portrait-primary",
"prefer_related_applications": false,
"icons": [
{
"src": "icons/Icon-192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "icons/Icon-512.png",
"sizes": "512x512",
"type": "image/png"
}
]
}
@@ -0,0 +1,5 @@
library flutter_whatsnew;
export 'src/base.dart';
export 'src/changelog.dart';
export 'src/scheduled.dart';
+238
View File
@@ -0,0 +1,238 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'changelog.dart';
class WhatsNewPage extends StatelessWidget {
final Widget title;
final Widget buttonText;
final List<ListTile>? items;
final VoidCallback? onButtonPressed;
final bool changelog;
final String? changes;
final Color? backgroundColor;
final Color? buttonColor;
final String? path;
final MarkdownTapLinkCallback? onTapLink;
final bool adaptive;
const WhatsNewPage({
required this.items,
required this.title,
required this.buttonText,
this.onButtonPressed,
this.backgroundColor,
this.buttonColor,
this.onTapLink,
this.adaptive = true,
}) : changelog = false,
changes = null,
path = null;
const WhatsNewPage.changelog({
this.title = const Text(
'Changelog',
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 22.0,
fontWeight: FontWeight.bold,
),
),
this.buttonText = const Text(
'Continue',
style: const TextStyle(color: Colors.white),
),
this.onButtonPressed,
this.changes,
this.backgroundColor,
this.buttonColor,
this.path,
this.onTapLink,
this.adaptive = true,
}) : changelog = true,
items = null;
static void showDetailPopUp(
BuildContext context,
String title,
String detail,
) async {
void showDemoDialog<T>({
required BuildContext context,
required Widget child,
}) {
showDialog<T>(
context: context,
barrierDismissible: false,
builder: (BuildContext context) => child,
);
}
return showDemoDialog<Null>(
context: context,
child: AlertDialog(
title: Text(title),
content: Text(detail),
actions: <Widget>[
TextButton(
child: Text('OK'),
onPressed: () {
Navigator.pop(context);
},
),
],
),
);
}
@override
Widget build(BuildContext context) {
assert(items != null || changelog);
if (adaptive &&
!kIsWeb &&
(defaultTargetPlatform == TargetPlatform.iOS ||
defaultTargetPlatform == TargetPlatform.macOS)) {
return _buildIOS(context);
}
return _buildAndroid(context);
}
Widget _buildAndroid(BuildContext context) {
final buttonStyle = ElevatedButton.styleFrom(
backgroundColor: buttonColor ?? Theme.of(context).colorScheme.primary,
foregroundColor: buttonColor != null
? (buttonColor!.computeLuminance() > 0.5
? Colors.black
: Colors.white)
: Theme.of(context).colorScheme.onPrimary,
);
if (changelog) {
return Scaffold(
backgroundColor:
backgroundColor ?? Theme.of(context).scaffoldBackgroundColor,
body: SafeArea(
child: Stack(
fit: StackFit.loose,
children: <Widget>[
Positioned(
top: 10.0,
left: 0.0,
right: 0.0,
child: title,
),
Positioned(
left: 0.0,
right: 0.0,
top: 50.0,
bottom: 80.0,
child: ChangeLogView(
changes: changes,
path: path,
onTapLink: onTapLink,
adaptive: adaptive,
),
),
Positioned(
bottom: 5.0,
right: 10.0,
left: 10.0,
child: ListTile(
title: ElevatedButton(
child: buttonText,
style: buttonStyle,
onPressed: onButtonPressed != null
? onButtonPressed
: () {
Navigator.pop(context);
},
),
),
),
],
),
),
);
} else if (items != null) {
return Scaffold(
backgroundColor:
backgroundColor ?? Theme.of(context).scaffoldBackgroundColor,
body: SafeArea(
child: Stack(
fit: StackFit.loose,
children: <Widget>[
Positioned(
top: 10.0,
left: 0.0,
right: 0.0,
child: title,
),
Positioned(
left: 0.0,
right: 0.0,
top: 50.0,
bottom: 80.0,
child: ListView(
children: items!
.map(
(ListTile item) => ListTile(
title: item.title,
subtitle: item.subtitle,
leading: item.leading,
trailing: item.trailing,
onTap: item.onTap,
onLongPress: item.onLongPress,
),
)
.toList(),
),
),
Positioned(
bottom: 5.0,
right: 10.0,
left: 10.0,
child: ListTile(
title: ElevatedButton(
child: buttonText,
style: buttonStyle,
onPressed: onButtonPressed != null
? onButtonPressed
: () => Navigator.pop(context),
),
),
),
],
),
),
);
}
return Container();
}
Widget _buildIOS(BuildContext context) {
Widget? child;
if (changelog) {
child = ChangeLogView(
changes: changes,
path: path,
onTapLink: onTapLink,
adaptive: adaptive,
);
} else if (items != null) {
child = Material(
child: ListView(
children: items!,
),
);
}
return CupertinoPageScaffold(
navigationBar: CupertinoNavigationBar(
middle: title,
),
child: SafeArea(
child: child ?? Container(),
),
);
}
}
@@ -0,0 +1,57 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
class ChangeLogView extends StatefulWidget {
const ChangeLogView({
this.onTapLink,
this.path,
this.changes,
required this.adaptive,
});
final String? changes;
final String? path;
final bool adaptive;
final MarkdownTapLinkCallback? onTapLink;
@override
_ChangeLogViewState createState() => _ChangeLogViewState();
}
class _ChangeLogViewState extends State<ChangeLogView> {
String? _changelog;
@override
void initState() {
if (widget.changes == null) {
rootBundle.loadString(widget.path ?? "CHANGELOG.md").then((data) {
setState(() {
_changelog = data;
});
});
} else {
setState(() {
_changelog = widget.changes;
});
}
super.initState();
}
@override
Widget build(BuildContext context) {
if (_changelog == null) {
if (widget.adaptive &&
(defaultTargetPlatform == TargetPlatform.iOS ||
defaultTargetPlatform == TargetPlatform.macOS)) {
return Center(child: CupertinoActivityIndicator());
} else {
return Center(child: CircularProgressIndicator());
}
}
return Markdown(
data: _changelog!,
onTapLink: widget.onTapLink,
);
}
}
@@ -0,0 +1,68 @@
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'base.dart';
class ScheduledWhatsNewPage extends StatefulWidget {
const ScheduledWhatsNewPage({
Key? key,
required this.details,
this.delay,
this.appVersion,
required this.child,
}) : super(key: key);
final WhatsNewPage details;
final Widget child;
/// Wait a set duration and show the dialog
final Duration? delay;
/// Check the last saved version and show the dialog if different (or fresh)
final String? appVersion;
@override
State<ScheduledWhatsNewPage> createState() => _ScheduledWhatsNewPageState();
}
class _ScheduledWhatsNewPageState extends State<ScheduledWhatsNewPage> {
late SharedPreferences prefs;
@override
void initState() {
SharedPreferences.getInstance().then((value) {
prefs = value;
check();
});
super.initState();
}
void check() async {
if (widget.appVersion != null) {
final settingsKey = 'last-app-version';
final lastVersion = prefs.getString(settingsKey);
if (lastVersion == widget.appVersion) {
return;
}
await prefs.setString(settingsKey, widget.appVersion!);
}
if (widget.delay != null) {
await Future<void>.delayed(widget.delay!);
}
show(context);
}
void show(BuildContext context) {
if (!mounted) return;
final nav = Navigator.of(context, rootNavigator: true);
nav.push(MaterialPageRoute(
builder: (context) => widget.details,
fullscreenDialog: true,
));
}
@override
Widget build(BuildContext context) {
return widget.child;
}
}
+26
View File
@@ -0,0 +1,26 @@
name: flutter_whatsnew
description: A new Flutter package to show updates to users.
version: 1.0.5+2
# author: Rody Davis <rody.davis.jr@gmail.com>
homepage: https://github.com/fluttercommunity/flutter_whatsnew
maintainer: Rody Davis (@rodydavis)
environment:
sdk: ">=2.19.0-168.0.dev <3.0.0"
flutter: ">=1.17.0"
dependencies:
flutter:
sdk: flutter
flutter_markdown: ^0.6.12
shared_preferences: ^2.0.15
dev_dependencies:
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec
# The following section is specific to Flutter.
flutter: