-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Solution for Bug Hero animations
- Loading branch information
Showing
9 changed files
with
168 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
{ | ||
"dart.flutterSdkPath": "/Users/jacobmoura/fvm/versions/beta" | ||
"dart.flutterSdkPath": "C:\\Users\\bwolf\\fvm\\versions\\beta" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
library asuka; | ||
|
||
export 'src/asuka_singleton.dart'; | ||
export 'snackbars/asuka_snack_bar.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import 'package:flutter/foundation.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:asuka/asuka.dart' as asuka; | ||
|
||
class AsukaSnackbar extends SnackBar { | ||
AsukaSnackbar._( | ||
Key? key, | ||
String content, | ||
Color background, { | ||
IconData? icon, | ||
SnackBarAction? action, | ||
}) : super( | ||
elevation: 2, | ||
backgroundColor: background, | ||
action: action, | ||
shape: RoundedRectangleBorder( | ||
borderRadius: BorderRadius.circular( | ||
4, | ||
), | ||
), | ||
behavior: SnackBarBehavior.floating, | ||
content: Row( | ||
children: [ | ||
if (icon != null) ...[ | ||
Icon( | ||
icon, | ||
size: 20, | ||
color: Colors.black45, | ||
), | ||
SizedBox(width: 10) | ||
], | ||
Expanded( | ||
child: Text( | ||
content, | ||
style: TextStyle( | ||
fontSize: 16, | ||
color: Colors.white, | ||
), | ||
), | ||
), | ||
if (action == null) | ||
InkWell( | ||
child: Icon(Icons.close, color: Colors.white), | ||
onTap: asuka.hideCurrentSnackBar, | ||
) | ||
], | ||
), | ||
); | ||
|
||
factory AsukaSnackbar.warning(String content, {Key? key}) => AsukaSnackbar._(key, content, Color(0xFFE6CA72), icon: Icons.warning); | ||
|
||
factory AsukaSnackbar.alert(String content, {Key? key}) => AsukaSnackbar._(key, content, Color(0xffFA5456), icon: Icons.report); | ||
|
||
factory AsukaSnackbar.info(String content, {Key? key, SnackBarAction? snackBarAction}) => AsukaSnackbar._(key, content, Color(0xff3196DA), action: snackBarAction, icon: Icons.help); | ||
|
||
factory AsukaSnackbar.success(String content, {Key? key, SnackBarAction? snackBarAction}) => AsukaSnackbar._(key, content, Color(0xFF80AD49), action: snackBarAction, icon: Icons.check_circle); | ||
|
||
factory AsukaSnackbar.message(String content, {Key? key}) => AsukaSnackbar._(key, content, Color(0xff484848)); | ||
|
||
void call() => show(); | ||
|
||
void show() => asuka.showSnackBar(this); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,14 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
|
||
import 'package:asuka/asuka.dart' as asuka; | ||
|
||
void main() { | ||
test('erro when not called build method', () { | ||
expect(() => asuka.showSnackBar(null), throwsAssertionError); | ||
expect(() => asuka.showSnackBar(SnackBar(content: Container())), throwsAssertionError); | ||
expect(() => asuka.hideCurrentSnackBar(), throwsAssertionError); | ||
expect(() => asuka.removeCurrentSnackBar(), throwsAssertionError); | ||
expect(() => asuka.showBottomSheet(null), throwsAssertionError); | ||
expect(() => asuka.showDialog(), throwsAssertionError); | ||
expect(() => asuka.showBottomSheet((e) => Container()), throwsAssertionError); | ||
expect(() => asuka.showDialog(builder: (e) => Container()), throwsAssertionError); | ||
}); | ||
} |