Skip to content

Commit

Permalink
代码优化,icon嵌入
Browse files Browse the repository at this point in the history
  • Loading branch information
shirne committed Jun 27, 2022
1 parent 36f3b10 commit 95e0268
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 22 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [2.0.2]
* 代码优化
* icon嵌入
## [2.0.1]
* example 更新
* toast 参数提示
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ packages:
path: ".."
relative: true
source: path
version: "2.0.1"
version: "2.0.2"
sky_engine:
dependency: transitive
description: flutter
Expand Down
13 changes: 12 additions & 1 deletion lib/src/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,22 @@ class ProgressController extends DialogController<int> {
[this.entry])
: super.of(context, notifier);

OverlayState? getOverlayState(BuildContext context) {
var overlay = Overlay.of(context);
if (overlay == null) {
// var children;
// context.findRenderObject()?.visitChildren((child) {
// if(child is )
// });
}
return overlay;
}

@override
open() {
final overlay = Overlay.of(context);
assert(overlay != null,
'ProgressController shuld be create with a Scaffold context');
'ProgressController shuld be create within a Overlay context');
overlay!.insert(entry!);
}

Expand Down
44 changes: 30 additions & 14 deletions lib/src/dialog_icons.dart
Original file line number Diff line number Diff line change
@@ -1,19 +1,35 @@
import 'package:flutter/widgets.dart';

const _fontPackage = 'shirne_dialog';

class DialogIcons {
static const _fontFamily = 'dicons';
static const checkmark = IconData(0xe900, fontFamily: _fontFamily);
static const checkmarkCircle = IconData(0xe901, fontFamily: _fontFamily);
static const checkmarkFill = IconData(0xe902, fontFamily: _fontFamily);
static const close = IconData(0xe903, fontFamily: _fontFamily);
static const closeCircle = IconData(0xe904, fontFamily: _fontFamily);
static const closeFill = IconData(0xe905, fontFamily: _fontFamily);
static const help = IconData(0xe906, fontFamily: _fontFamily);
static const helpCircle = IconData(0xe907, fontFamily: _fontFamily);
static const helpFill = IconData(0xe908, fontFamily: _fontFamily);
static const information = IconData(0xe909, fontFamily: _fontFamily);
static const informationCircle = IconData(0xe90a, fontFamily: _fontFamily);
static const informationFill = IconData(0xe90b, fontFamily: _fontFamily);
static const warningFill = IconData(0xe90c, fontFamily: _fontFamily);
static const warningOutline = IconData(0xe90d, fontFamily: _fontFamily);
static const checkmark =
IconData(0xe900, fontFamily: _fontFamily, fontPackage: _fontPackage);
static const checkmarkCircle =
IconData(0xe901, fontFamily: _fontFamily, fontPackage: _fontPackage);
static const checkmarkFill =
IconData(0xe902, fontFamily: _fontFamily, fontPackage: _fontPackage);
static const close =
IconData(0xe903, fontFamily: _fontFamily, fontPackage: _fontPackage);
static const closeCircle =
IconData(0xe904, fontFamily: _fontFamily, fontPackage: _fontPackage);
static const closeFill =
IconData(0xe905, fontFamily: _fontFamily, fontPackage: _fontPackage);
static const help =
IconData(0xe906, fontFamily: _fontFamily, fontPackage: _fontPackage);
static const helpCircle =
IconData(0xe907, fontFamily: _fontFamily, fontPackage: _fontPackage);
static const helpFill =
IconData(0xe908, fontFamily: _fontFamily, fontPackage: _fontPackage);
static const information =
IconData(0xe909, fontFamily: _fontFamily, fontPackage: _fontPackage);
static const informationCircle =
IconData(0xe90a, fontFamily: _fontFamily, fontPackage: _fontPackage);
static const informationFill =
IconData(0xe90b, fontFamily: _fontFamily, fontPackage: _fontPackage);
static const warningFill =
IconData(0xe90c, fontFamily: _fontFamily, fontPackage: _fontPackage);
static const warningOutline =
IconData(0xe90d, fontFamily: _fontFamily, fontPackage: _fontPackage);
}
8 changes: 4 additions & 4 deletions lib/src/progress.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class _ProgressWidgetState extends State<ProgressWidget>
child: Container(
padding: widget.padding,
decoration: widget.decoration ??
BoxDecoration(
const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(5)),
),
Expand All @@ -101,10 +101,10 @@ class _ProgressWidgetState extends State<ProgressWidget>
),
strokeWidth: widget.strokeWidth,
),
SizedBox(height: 10),
const SizedBox(height: 10),
Text(
widget.message!,
style: TextStyle(
style: const TextStyle(
color: Colors.black54,
decoration: TextDecoration.none,
fontSize: 14,
Expand Down Expand Up @@ -132,7 +132,7 @@ class _ProgressWidgetState extends State<ProgressWidget>
});
} else {
if (progress >= 100) {
Future.delayed(Duration(milliseconds: 200)).then((v) {
Future.delayed(const Duration(milliseconds: 200)).then((v) {
widget.controller!.remove();
});
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/snack.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class _SnackWidgetState extends State<SnackWidget>
}
alignment = Alignment(0, alignY);
_aniController = AnimationController.unbounded(
vsync: this, duration: Duration(milliseconds: 300));
vsync: this, duration: const Duration(milliseconds: 300));
_aniController.value = 0;
_aniController.addListener(_onAnimation);

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: shirne_dialog
description: A package to use alert, confirm, toast, imagePreview, snack and popup within one line code.
version: 2.0.1
version: 2.0.2
homepage: https://www.shirne.com/demo/easydialog/
repository: https://github.com/shirne/shirne_dialog

Expand Down

0 comments on commit 95e0268

Please sign in to comment.