Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Padding, text alignment and warnings #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 27
compileSdkVersion 28

lintOptions {
disable 'InvalidPackage'
Expand Down
1 change: 1 addition & 0 deletions example/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
10 changes: 10 additions & 0 deletions example/ios/Flutter/flutter_export_environment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=C:\flutter"
export "FLUTTER_APPLICATION_PATH=G:\Projets\packages\sweetalert\example"
export "FLUTTER_TARGET=lib\main.dart"
export "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build\ios"
export "FLUTTER_FRAMEWORK_DIR=C:\flutter\bin\cache\artifacts\engine\ios"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"
114 changes: 71 additions & 43 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import 'dart:ui';

import 'package:flutter_sequence_animation/flutter_sequence_animation.dart';
import 'package:sweetalert/sweetalert.dart';
import 'package:flutter/material.dart';

import 'dart:math' as Math;
import 'package:vector_math/vector_math_64.dart' as math;

void main() => runApp(MyApp());
Expand Down Expand Up @@ -80,7 +78,10 @@ class _MyHomePageState extends State<MyHomePage> {
new Text("Basic usage"),
new RaisedButton(
onPressed: () {
SweetAlert.show(context, title: "Just show a message");
SweetAlert.show(context,
title: "Just show a message",
titlePadding: EdgeInsets.all(20.0),
titleAlign: TextAlign.center);
},
child: new Text("Try me"),
color: SweetAlert.success,
Expand All @@ -89,9 +90,13 @@ class _MyHomePageState extends State<MyHomePage> {
new Text("Title with subtitle"),
new RaisedButton(
onPressed: () {
SweetAlert.show(context,
title: "Just show a message",
subtitle: "Sweet alert is pretty");
SweetAlert.show(
context,
title: "Just show a message",
titleAlign: TextAlign.center,
subtitle: "Sweet alert is pretty",
subtitlePadding: EdgeInsets.all(8.0),
);
},
child: new Text("Try me"),
color: SweetAlert.success,
Expand All @@ -100,10 +105,12 @@ class _MyHomePageState extends State<MyHomePage> {
new Text("A success message"),
new RaisedButton(
onPressed: () {
SweetAlert.show(context,
title: "Just show a message",
subtitle: "Sweet alert is pretty",
style: SweetAlertStyle.success);
SweetAlert.show(
context,
title: "Just show a message",
subtitle: "Sweet alert is pretty",
style: SweetAlertStyle.success,
);
},
child: new Text("Try me"),
color: SweetAlert.success,
Expand All @@ -113,18 +120,23 @@ class _MyHomePageState extends State<MyHomePage> {
"A warning message,with a function action on \"Confirm\"-button"),
new RaisedButton(
onPressed: () {
SweetAlert.show(context,
title: "Just show a message",
subtitle: "Sweet alert is pretty",
style: SweetAlertStyle.confirm,
showCancelButton: true, onPress: (bool isConfirm) {
if (isConfirm) {
SweetAlert.show(context,style: SweetAlertStyle.success,title: "Success");
SweetAlert.show(
context,
title: "Just show a message",
subtitle: "Sweet alert is pretty",
style: SweetAlertStyle.confirm,
showCancelButton: true,
onPress: (bool isConfirm) {
if (isConfirm) {
SweetAlert.show(context,
style: SweetAlertStyle.success, title: "Success");

// return false to keep dialog
return false;
}
});
// return false to keep dialog
return false;
} else
return true;
},
);
},
child: new Text("Try me"),
color: SweetAlert.success,
Expand All @@ -137,13 +149,21 @@ class _MyHomePageState extends State<MyHomePage> {
subtitle: "Do you want to delete this message",
style: SweetAlertStyle.confirm,
showCancelButton: true, onPress: (bool isConfirm) {
if(isConfirm){
SweetAlert.show(context,subtitle: "Deleting...", style: SweetAlertStyle.loading);
new Future.delayed(new Duration(seconds: 2),(){
SweetAlert.show(context,subtitle: "Success!", style: SweetAlertStyle.success);
if (isConfirm) {
SweetAlert.show(context,
subtitle: "Deleting...",
style: SweetAlertStyle.loading);
new Future.delayed(new Duration(seconds: 2), () {
SweetAlert.show(context,
subtitle: "Success!",
style: SweetAlertStyle.success);
});
}else{
SweetAlert.show(context,subtitle: "Canceled!", style: SweetAlertStyle.error);
} else {
SweetAlert.show(
context,
subtitle: "Canceled!",
style: SweetAlertStyle.error,
);
}
// return false to keep dialog
return false;
Expand All @@ -153,29 +173,37 @@ class _MyHomePageState extends State<MyHomePage> {
color: SweetAlert.success,
textColor: Colors.white,
),


new Text("Do a job that may fail"),
new RaisedButton(
onPressed: () {
SweetAlert.show(context,
subtitle: "Do you want to delete this message",
style: SweetAlertStyle.confirm,
showCancelButton: true, onPress: (bool isConfirm) {
if (isConfirm) {
//Return false to keep dialog
if(isConfirm){
SweetAlert.show(context,subtitle: "Deleting...", style: SweetAlertStyle.loading);
new Future.delayed(new Duration(seconds: 2),(){
SweetAlert.show(context,subtitle: "Job fail!", style: SweetAlertStyle.error);
});
}else{
SweetAlert.show(context,subtitle: "Canceled!", style: SweetAlertStyle.error);
}
return false;
}

});
if (isConfirm) {
//Return false to keep dialog
if (isConfirm) {
SweetAlert.show(context,
subtitle: "Deleting...",
style: SweetAlertStyle.loading);
new Future.delayed(new Duration(seconds: 2), () {
SweetAlert.show(
context,
subtitle: "Job fail!",
style: SweetAlertStyle.error,
);
});
} else {
SweetAlert.show(
context,
subtitle: "Canceled!",
style: SweetAlertStyle.error,
);
}
return false;
} else
return true;
});
},
child: new Text("Try me"),
color: SweetAlert.success,
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: A new Flutter project.
version: 1.0.0+1

environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
sdk: ">=2.1.0 <3.0.0"

dependencies:
flutter:
Expand Down
3 changes: 1 addition & 2 deletions lib/src/cancel.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:sweetalert/sweetalert.dart';
import 'dart:math' as Math;
import 'package:vector_math/vector_math_64.dart' as math;
import 'dart:ui';
import 'package:flutter_sequence_animation/flutter_sequence_animation.dart';
Expand All @@ -20,7 +19,7 @@ class CancelViewState extends State<CancelView>

@override
void initState() {
int factor = 50;
//int factor = 50;
animationController = new AnimationController(vsync: this);

sequenceAnimation = new SequenceAnimationBuilder()
Expand Down
4 changes: 1 addition & 3 deletions lib/src/confirm.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import 'package:flutter/material.dart';
import 'dart:math' as Math;
import 'package:vector_math/vector_math_64.dart' as math;
import 'dart:ui';
import 'package:flutter_sequence_animation/flutter_sequence_animation.dart';

class ConfirmView extends StatefulWidget {
@override
Expand All @@ -19,7 +17,7 @@ class ConfirmViewState extends State<ConfirmView>

@override
void initState() {
int factor = 50;
//int factor = 50;
animationController = new AnimationController(vsync: this);
animation =
new ColorTween(begin: new Color(0xffF7D58B), end: new Color(0xffF2A665))
Expand Down
1 change: 0 additions & 1 deletion lib/src/success.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'dart:math' as Math;
import 'package:vector_math/vector_math_64.dart' as math;
import 'dart:ui';
import 'package:flutter_sequence_animation/flutter_sequence_animation.dart';
Expand Down
Loading