提交 2daeba60 编写于 作者: bluesofy's avatar bluesofy 🎏

🎏 增加export辅助类

上级 a3b10122
## 1.1.0 - 2020/06/12
* Export the Other Classes in *bytoast.dart*, so just import *bytoast.dart* is okay
## 1.0.2 - 2020/05/13 ## 1.0.2 - 2020/05/13
* Slightly Adjust the UI * Slightly Adjust the UI
......
# ByToast # ByToast
[![pub package](https://img.shields.io/badge/pub-v1.0.1-brightgreen?style=flat&logo=flutter)](https://pub.dev/packages/bytoast) [![pub package](https://img.shields.io/badge/pub-v1.0.1-brightgreen?style=flat&logo=flutter)](https://pub.dev/packages/bytoast)
[![author](https://img.shields.io/badge/author-:byk-4189d5?style=flat&logo=github)](https://github.com/bluesofy)
A Toast Widget for Flutter. A Toast Widget for Flutter.
<br>
用于Flutter项目的吐司,非调用原生Toast,纯Dart层实现。 ## Feature
- 非调用原生Toast,Dart实现;
- 交互和动效接近原生Toast,不触发遮罩点击事件,跨页仍显示;
- 其他
## Get Started ## Get Started
### Add Dependency ### Add Dependency
```yaml ```yaml
dependencies: dependencies:
bytoast: ^1.0.2 bytoast: ^1.1.0
``` ```
### Usage ### Usage
......
import 'package:bytoast/bytoast.dart'; import 'package:bytoast/bytoast.dart';
import 'package:bytoast/core/toast_style.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'base/page_widget.dart'; import 'base/page_widget.dart';
...@@ -50,8 +49,10 @@ class _MyHomePageState extends BasePageState<MyHomePage> { ...@@ -50,8 +49,10 @@ class _MyHomePageState extends BasePageState<MyHomePage> {
toast(context, 'This is a Toast'); toast(context, 'This is a Toast');
break; break;
case 1: case 1:
toast(context, toast(
'This is a Long Long Long Long Long Long Long Long Long Long Long Long Long Toast'); context,
'This is a Long Long Long Long Long Long Long Long Long Long Long Long Long Toast',
);
break; break;
case 2: case 2:
ByToast.withIcon( ByToast.withIcon(
...@@ -62,8 +63,7 @@ class _MyHomePageState extends BasePageState<MyHomePage> { ...@@ -62,8 +63,7 @@ class _MyHomePageState extends BasePageState<MyHomePage> {
); );
break; break;
case 3: case 3:
ByToast.withIcon( ByToast.withIcon(context, 'U Got a new Msg', Icon(Icons.alarm, color: Colors.white));
context, 'U Got a new Msg', Icon(Icons.alarm, color: Colors.white));
break; break;
case 4: case 4:
ByToast.more( ByToast.more(
......
...@@ -21,7 +21,7 @@ packages: ...@@ -21,7 +21,7 @@ packages:
path: ".." path: ".."
relative: true relative: true
source: path source: path
version: "1.0.2" version: "1.1.0"
charcode: charcode:
dependency: transitive dependency: transitive
description: description:
...@@ -134,7 +134,7 @@ packages: ...@@ -134,7 +134,7 @@ packages:
name: test_api name: test_api
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.2.15" version: "0.2.16"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
......
...@@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev ...@@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at # Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.2+102 version: 1.1.0+110
environment: environment:
sdk: ">=2.7.0 <3.0.0" sdk: ">=2.7.0 <3.0.0"
...@@ -30,7 +30,7 @@ dependencies: ...@@ -30,7 +30,7 @@ dependencies:
cupertino_icons: ^0.1.3 cupertino_icons: ^0.1.3
# ByToast # ByToast
# bytoast: ^1.0.2 # bytoast: ^1.1.0
bytoast: bytoast:
path: ../ path: ../
......
...@@ -6,12 +6,15 @@ import 'core/toast_data.dart'; ...@@ -6,12 +6,15 @@ import 'core/toast_data.dart';
import 'core/toast_mgr.dart'; import 'core/toast_mgr.dart';
import 'core/toast_style.dart'; import 'core/toast_style.dart';
export 'core/toast_data.dart';
export 'core/toast_mgr.dart';
export 'core/toast_style.dart';
class ByToast { class ByToast {
ByToast._(); ByToast._();
/// Show Normal Toast /// Show Normal Toast
static void short(BuildContext context, String msg) => static void short(BuildContext context, String msg) => more(context, msg: msg);
more(context, msg: msg);
/// Show Long Shown Toast /// Show Long Shown Toast
static void long(BuildContext context, String msg) => more( static void long(BuildContext context, String msg) => more(
...@@ -21,9 +24,7 @@ class ByToast { ...@@ -21,9 +24,7 @@ class ByToast {
); );
/// Show Toast with Icon on Left/Top /// Show Toast with Icon on Left/Top
static void withIcon(BuildContext context, String msg, Widget icon, static void withIcon(BuildContext context, String msg, Widget icon, {isOnTop = false}) => more(
{isOnTop = false}) =>
more(
context, context,
msg: msg, msg: msg,
iconPathLeft: isOnTop ? null : icon, iconPathLeft: isOnTop ? null : icon,
......
...@@ -68,7 +68,7 @@ class ToastLayerState extends State<ToastLayer> ...@@ -68,7 +68,7 @@ class ToastLayerState extends State<ToastLayer>
columnWidgets columnWidgets
..add(_holder.iconPathTop) ..add(_holder.iconPathTop)
..add( ..add(
SizedBox(height: 8.0), SizedBox(height: 12.0),
); );
} }
columnWidgets.add(Row( columnWidgets.add(Row(
...@@ -97,7 +97,7 @@ class ToastLayerState extends State<ToastLayer> ...@@ -97,7 +97,7 @@ class ToastLayerState extends State<ToastLayer>
blurRadius: 2, blurRadius: 2,
spreadRadius: 1) spreadRadius: 1)
], ],
borderRadius: new BorderRadius.all(Radius.circular(4)), borderRadius: new BorderRadius.all(Radius.circular(2)),
), ),
child: _buildContent(), child: _buildContent(),
); );
......
...@@ -9,7 +9,7 @@ class ToastStyle { ...@@ -9,7 +9,7 @@ class ToastStyle {
static const EdgeInsetsGeometry textPadding = static const EdgeInsetsGeometry textPadding =
EdgeInsets.only(left: 32, right: 32, top: 10, bottom: 10); EdgeInsets.only(left: 32, right: 32, top: 10, bottom: 10);
static const EdgeInsetsGeometry textWithIconPadding = static const EdgeInsetsGeometry textWithIconPadding =
EdgeInsets.only(left: 20, right: 20, top: 14, bottom: 14); EdgeInsets.only(left: 20, right: 20, top: 16, bottom: 16);
// Duration // Duration
static const Duration shortDuration = Duration(milliseconds: 2400); static const Duration shortDuration = Duration(milliseconds: 2400);
......
...@@ -120,7 +120,7 @@ packages: ...@@ -120,7 +120,7 @@ packages:
name: test_api name: test_api
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.2.15" version: "0.2.16"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
......
name: bytoast name: bytoast
description: A Toast Widget for Flutter. Pure Dart Code. Both Android and iOS. Can Show Simple Text Toast or with Image or Customize. description: A Toast Widget for Flutter. Pure Dart Code. Both Android and iOS. Can Show Simple Text Toast or with Image or Customize.
version: 1.0.2 version: 1.1.0
homepage: https://github.com/PandoraMaze/ByToast homepage: https://github.com/PandoraMaze/ByToast
environment: environment:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册