Skip to content

Commit

Permalink
Merge pull request #48 from boyan01/pre-1.0.5
Browse files Browse the repository at this point in the history
Release 1.0.5
  • Loading branch information
boyan01 committed Jul 19, 2020
2 parents 9df63bd + de2e368 commit 2af2919
Show file tree
Hide file tree
Showing 11 changed files with 76 additions and 45 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
root = true

[*]
charset = utf-8
end_of_line = crlf
indent_size = 4
indent_style = space
insert_final_newline = false
max_line_length = 100
tab_width = 4

[*.dart]
max_line_length = 120

[*.yaml]
indent_size = 2
2 changes: 1 addition & 1 deletion .github/workflows/deploy_web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Setup Flutter
uses: subosito/flutter-action@v1
with:
channel: 'dev'
channel: 'stable'
- run: flutter config --enable-web
- run: flutter pub get

Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: CI

on: [push]
on: [push, pull_request]

jobs:
build:
Expand All @@ -16,10 +16,13 @@ jobs:
- name: Setup Flutter
uses: subosito/flutter-action@v1
with:
channel: 'dev'
channel: 'stable'
- run: flutter config --enable-web
- run: flutter pub get

- name: Project format check
run: flutter format -l 120 -n .

- name: Flutter unit test
run: flutter test --coverage --coverage-path=lcov.info

Expand Down
15 changes: 15 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"[dart]": {
"editor.formatOnSave": true,
"editor.formatOnType": true,
"editor.rulers": [
80
],
"editor.selectionHighlight": false,
"editor.suggest.snippetsPreventQuickSuggestions": false,
"editor.suggestSelection": "first",
"editor.tabCompletion": "onlySnippets",
"editor.wordBasedSuggestions": false
},
"dart.lineLength": 120
}
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [1.0.5] - 2020/7/20
* Expose duration to `showSimpleNotification` [#46](https://github.com/boyan01/overlay_support/pull/46) by [Elvis Sun](https://github.com/elvisun)

## [1.0.4] - 2020/5/26
* Support for `BottomSlideNotification`. [#40](https://github.com/boyan01/overlay_support/pull/40) by [Giles Correia Morton](https://github.com/gilescm)
* Upgrade min dart sdk version to 2.1.0. [Policy](https://dart.dev/tools/pub/publishing#publishing-prereleases)
Expand Down
5 changes: 5 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
linter:
# TODO: add more rules
rules:
- avoid_empty_else
# - lines_longer_than_80_chars # not yet tested
1 change: 1 addition & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
.pub-cache/
.pub/
build/
.flutter-plugins-dependencies

# Android related
**/android/**/gradle-wrapper.jar
Expand Down
3 changes: 1 addition & 2 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ class _NavigationTiles extends StatelessWidget {
ListTile(
title: Text("Star On GitHub"),
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(builder: (context) => PageWithIme()));
Navigator.of(context).push(MaterialPageRoute(builder: (context) => PageWithIme()));
},
)
],
Expand Down
43 changes: 20 additions & 23 deletions lib/src/notification/overlay_notification.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import 'package:overlay_support/overlay_support.dart';
import 'package:overlay_support/src/notification/notification.dart';
import 'package:overlay_support/src/overlay.dart';

/// popup a notification at the top of screen
/// Popup a notification at the top of screen.
///
///[duration] the notification display duration , overlay will auto dismiss after [duration]
///if null , will be set to [kNotificationDuration]
///if zero , will not auto dismiss in the future
/// [duration] the notification display duration , overlay will auto dismiss after [duration].
/// if null , will be set to [kNotificationDuration].
/// if zero , will not auto dismiss in the future.
///
/// [position] the position of notification, default is [NotificationPosition.top],
/// can be [NotificationPosition.top] or [NotificationPosition.bottom]
/// can be [NotificationPosition.top] or [NotificationPosition.bottom].
///
OverlaySupportEntry showOverlayNotification(
WidgetBuilder builder, {
Expand All @@ -23,8 +23,7 @@ OverlaySupportEntry showOverlayNotification(
}
return showOverlay((context, t) {
MainAxisAlignment alignment = MainAxisAlignment.start;
if (position == NotificationPosition.bottom)
alignment = MainAxisAlignment.end;
if (position == NotificationPosition.bottom) alignment = MainAxisAlignment.end;
return Column(
mainAxisAlignment: alignment,
children: <Widget>[
Expand All @@ -37,23 +36,23 @@ OverlaySupportEntry showOverlayNotification(
}

///
///show a simple notification above the top of window
/// Show a simple notification above the top of window.
///
///
/// [content] see more [ListTile.title]
/// [leading] see more [ListTile.leading]
/// [subtitle] see more [ListTile.subtitle]
/// [trailing] see more [ListTile.trailing]
/// [contentPadding] see more [ListTile.contentPadding]
/// [content] see more [ListTile.title].
/// [leading] see more [ListTile.leading].
/// [subtitle] see more [ListTile.subtitle].
/// [trailing] see more [ListTile.trailing].
/// [contentPadding] see more [ListTile.contentPadding].
///
/// [background] the background color for notification , default is [ThemeData.accentColor]
/// [foreground] see more [ListTileTheme.textColor],[ListTileTheme.iconColor]
/// [background] the background color for notification , default is [ThemeData.accentColor].
/// [foreground] see more [ListTileTheme.textColor],[ListTileTheme.iconColor].
///
/// [elevation] the elevation of notification, see more [Material.elevation]
/// [autoDismiss] true to auto hide after duration [kNotificationDuration]
/// [slideDismiss] support left/right to dismiss notification
/// [elevation] the elevation of notification, see more [Material.elevation].
/// [autoDismiss] true to auto hide after duration [kNotificationDuration].
/// [slideDismiss] support left/right to dismiss notification.
/// [position] the position of notification, default is [NotificationPosition.top],
/// can be [NotificationPosition.top] or [NotificationPosition.bottom]
/// can be [NotificationPosition.top] or [NotificationPosition.bottom].
///
OverlaySupportEntry showSimpleNotification(Widget content,
{Widget leading,
Expand All @@ -80,10 +79,8 @@ OverlaySupportEntry showSimpleNotification(Widget content,
bottom: position == NotificationPosition.bottom,
top: position == NotificationPosition.top,
child: ListTileTheme(
textColor: foreground ??
Theme.of(context)?.accentTextTheme?.title?.color,
iconColor: foreground ??
Theme.of(context)?.accentTextTheme?.title?.color,
textColor: foreground ?? Theme.of(context)?.accentTextTheme?.title?.color,
iconColor: foreground ?? Theme.of(context)?.accentTextTheme?.title?.color,
child: ListTile(
leading: leading,
title: content,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: overlay_support
description: proivder support for overlay, easy to build toast and internal notification
version: 1.0.4
version: 1.0.5
author: YangBin <yangbinyhbn@gmail.com>
homepage: https://github.com/boyan01/overlay_support

Expand Down
24 changes: 8 additions & 16 deletions test/overlay_support_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ void main() {
await tester.pumpWidget(_FakeOverlay(child: Builder(builder: (context) {
return FlatButton(
onPressed: () {
entry =
showSimpleNotification(Text('message'), autoDismiss: false);
entry = showSimpleNotification(Text('message'), autoDismiss: false);
},
child: Text('notification'));
})));
Expand All @@ -95,8 +94,7 @@ void main() {
await tester.pumpWidget(_FakeOverlay(child: Builder(builder: (context) {
return FlatButton(
onPressed: () {
final entry =
showSimpleNotification(Text('message'), autoDismiss: false);
final entry = showSimpleNotification(Text('message'), autoDismiss: false);
//dismiss immediately
entry.dismiss();
},
Expand Down Expand Up @@ -163,14 +161,12 @@ void main() {
children: <Widget>[
FlatButton(
onPressed: () {
showSimpleNotification(Text('message'),
autoDismiss: false, key: ValueKey('hello'));
showSimpleNotification(Text('message'), autoDismiss: false, key: ValueKey('hello'));
},
child: Text('notification')),
FlatButton(
onPressed: () {
showSimpleNotification(Text('message2'),
autoDismiss: false, key: ValueKey('hello'));
showSimpleNotification(Text('message2'), autoDismiss: false, key: ValueKey('hello'));
},
child: Text('notification2')),
],
Expand Down Expand Up @@ -203,14 +199,12 @@ void main() {
children: <Widget>[
FlatButton(
onPressed: () {
showSimpleNotification(Text('message'),
autoDismiss: false, key: ModalKey('hello'));
showSimpleNotification(Text('message'), autoDismiss: false, key: ModalKey('hello'));
},
child: Text('notification')),
FlatButton(
onPressed: () {
showSimpleNotification(Text('message2'),
autoDismiss: false, key: ModalKey('hello'));
showSimpleNotification(Text('message2'), autoDismiss: false, key: ModalKey('hello'));
},
child: Text('notification2')),
],
Expand All @@ -237,8 +231,7 @@ void main() {
await tester.pumpWidget(_FakeOverlay(child: Builder(builder: (context) {
return FlatButton(
onPressed: () {
showSimpleNotification(Text('message'),
trailing: Builder(builder: (context) {
showSimpleNotification(Text('message'), trailing: Builder(builder: (context) {
return FlatButton(
onPressed: () {
entry = OverlaySupportEntry.of(context);
Expand All @@ -265,8 +258,7 @@ void main() {
await tester.pumpWidget(_FakeOverlay(child: Builder(builder: (context) {
return FlatButton(
onPressed: () {
entry =
showSimpleNotification(Text('message'), autoDismiss: true);
entry = showSimpleNotification(Text('message'), autoDismiss: true);
},
child: Text('notification'));
})));
Expand Down

0 comments on commit 2af2919

Please sign in to comment.