cleaneasyalert 1.0.1 cleaneasyalert: ^1.0.1 copied to clipboard
With EasyAlert, instantly display animated alert dialogs such as success, error, warning, confirm, loading or even a custom dialog.
A Flutter plugin to display animated alert dialogs such as success, error, warning, confirm, loading or even a custom dialog.
Salient Features #
- Easy To Use
- Predefined Beautiful Alert Styles
- Predefined Title & Actions
- Super Customizable
- Change Animation
- Set Autoclose
- Set Overlay Tap to Dismiss
- And Many More... Coming Soon...
Getting Started #
Add this to your package's pubspec.yaml file:
dependencies:
cleaneasyalert: <latest version>
Run the command to get the dependency
$ flutter pub get
Usage #
Then you just have to import the package with
import 'package:cleaneasyalert/cleaneasyalert.dart';
Examples #
In order to display alert use EasyAlert.show()
and define the type
of alert.
EasyAlert.show(
context: context,
type: EasyAlertType.success,
); // That's it to display an alert, use other properties to customize.
Success #
EasyAlert.show(
context: context,
type: EasyAlertType.success,
text: 'Homework completed Successfully!',
);
Error #
EasyAlert.show(
context: context,
type: EasyAlertType.error,
title: 'Oops...',
text: 'Sorry, something went wrong',
);
Warning #
EasyAlert.show(
context: context,
type: EasyAlertType.warning,
text: 'You just broke protocol',
);
Info #
EasyAlert.show(
context: context,
type: EasyAlertType.info,
text: 'Buy two, get one free',
);
Confirm #
EasyAlert.show(
context: context,
type: EasyAlertType.confirm,
text: 'Do you want to logout',
confirmBtnText: 'Yes',
cancelBtnText: 'No',
confirmBtnColor: Colors.green,
);
Loading #
EasyAlert.show(
context: context,
type: EasyAlertType.loading,
title: 'Loading',
text: 'Fetching your data',
);
Custom #
EasyAlert.show(
context: context,
type: EasyAlertType.custom,
barrierDismissible: true,
confirmBtnText: 'Save',
customAsset: 'assets/custom.gif',
widget: TextFormField(
decoration: const InputDecoration(
alignLabelWithHint: true,
hintText: 'Enter Phone Number',
prefixIcon: Icon(
Icons.phone_outlined,
),
),
textInputAction: TextInputAction.next,
keyboardType: TextInputType.phone,
onChanged: (value) => message = value,
),
onConfirmBtnTap: () async {
if (message.length < 5) {
await EasyAlert.show(
context: context,
type: EasyAlertType.error,
text: 'Please input something',
);
return;
}
Navigator.pop(context);
await Future.delayed(const Duration(milliseconds: 1000));
await EasyAlert.show(
context: context,
type: EasyAlertType.success,
text: "Phone number '$message' has been saved!.",
);
},
);
},
title: 'Custom',
text: 'Custom Widget Alert',
leadingImage: 'assets/custom.gif',
);
Example #
License #
Copyright (c) 2022 Laxman Magarati.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.