Skip to content

Commit

Permalink
update read me
Browse files Browse the repository at this point in the history
  • Loading branch information
Sovann authored and Sovann committed Feb 20, 2023
1 parent c38d605 commit 7d2f1fe
Show file tree
Hide file tree
Showing 10 changed files with 165 additions and 94 deletions.
30 changes: 29 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1 +1,29 @@
TODO: Add your license here.
BSD 3-Clause License

Copyright (c) 2022, Chhum Sovann, Vann Dev
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. 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.

3. Neither the name of the copyright holder 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 HOLDER 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.
63 changes: 35 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,7 @@
<!--
This README describes the package. If you publish this package to pub.dev,
this README's contents appear on the landing page for your package.
# Dialog kh library
A Flutter library to help you create animated, simple, style, custom dialogs in your app.
Dialog kh is opensource library developed by <a href="https://kimsoer.site/">Voern Kimsoer</a> with <a href="https://www.youtube.com/channel/UCeOdLQeAytUW38kgLUbZ2BA">Vann Dev</a>

For information about how to write a good package README, see the guide for
[writing package pages](https://dart.dev/guides/libraries/writing-package-pages).
For general information about developing packages, see the Dart guide for
[creating packages](https://dart.dev/guides/libraries/create-library-packages)
and the Flutter guide for
[developing packages and plugins](https://flutter.dev/developing-packages).
-->

TODO: Put a short description of the package here that helps potential users
know whether this package might be useful for them.

## Features

Expand All @@ -25,22 +14,40 @@ know whether this package might be useful for them.
- Header can customize widget
- Bottom can customize widget

## Getting started

TODO: List prerequisites and provide or point to information on how to
start using the package.

## Usage

TODO: Include short and useful examples for package users. Add longer examples
to `/example` folder.
## Installation

1. Add the latest version of package to your pubspec.yaml (and run`dart pub get`):
```yaml
dependencies:
dialog_kh: ^0.0.1
```
2. Import the package and use it in your Flutter App.
```dart
const like = 'sample';
import 'package:dialog_kh/dialog_kh.dart';
```

## Additional information
## Example
For example, to create dialog kh, you could use the following code:

TODO: Tell users more about the package: where to find more information, how to
contribute to the package, how to file issues, what response they can expect
from the package authors, and more.
```dart
/// Show alert message
SizedBox(
width: 280,
height: 50,
child: ElevatedButton(
child: const Text('Show alert message'),
onPressed: () {
DialogKh.alertDialogKh(
context: context,
isAutoClosed: true, // default: true
seconds: 2,
header: const Icon(Icons.check_circle, color: Colors.green, size: 100),
title: "Congratulations",
description: "Congratulation your work is good",
radius: 30,
);
},
),
),
```
<img src="https://github.com/chhumsovann/dialog_kh/raw/main/img/alert_message.jpg" width="200"/>
4 changes: 2 additions & 2 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,12 @@ class _MyHomePageState extends State<MyHomePage> {
child: ElevatedButton(
child: const Text('Bottom sheet message'),
onPressed: () {
DialogKh.bottomSheetKh(
DialogKh.messageKh(
context: context,
height: 80,
radius: 15,
title: "Message",
description: "Congratulation your work is good",
leading: const Icon(Icons.email, size: 40),
);
},
),
Expand Down
Binary file added img/alert_dialog_01.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/alert_dialog_02.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/alert_message.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/bottom_sheet.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/show_message.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
159 changes: 97 additions & 62 deletions lib/dialog_kh.dart
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,57 @@ class DialogKh {
});
}

static Future<dynamic> messageKh({
required BuildContext context,
double? radius,
String? title,
Color? titleColor,
String? description,
Color? descColor,
String? fontFamily,
Widget? leading,
Widget? trailing,
}) async {
showModalBottomSheet(
context: context,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topRight: Radius.circular(radius ?? 20),
topLeft: Radius.circular(radius ?? 20),
),
),
builder: (context) {
return Container(
height: 80,
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Row(
children: [
leading ?? Container(),
const SizedBox(width: 10),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title ?? 'Success',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600, color: titleColor, fontFamily: fontFamily),
),
const SizedBox(height: 4),
Text(
description ?? 'Your request successfully',
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: descColor, fontFamily: fontFamily),
),
],
),
const SizedBox(width: 10),
trailing ?? Container(),
],
),
);
},
);
}

static Future<dynamic> bottomSheetKh({
required BuildContext context,
double? height,
Expand Down Expand Up @@ -188,75 +239,59 @@ class DialogKh {
),
),
builder: (context) {
return Container(
height: height ?? 70.00,
padding: (height ?? 0) < 70 ? const EdgeInsets.symmetric(horizontal: 20) : null,
child: (height ?? 0) < 70
? Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title ?? 'Success',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600, color: titleColor),
),
Text(
description ?? 'Your request successfully',
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: descColor),
),
],
)
: ListView(
padding: const EdgeInsets.symmetric(horizontal: 20),
return SizedBox(
height: height ?? 280.00,
child: ListView(
padding: const EdgeInsets.symmetric(horizontal: 20),
children: [
header ?? Container(),
const SizedBox(height: 20),
Text(
title ?? "Congratulations",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18,
color: titleColor ?? Colors.black,
fontWeight: FontWeight.w600,
fontFamily: fontFamily,
),
),
const SizedBox(height: 8),
Text(
description ?? "Congratulation your work is good",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 14,
fontFamily: fontFamily,
fontWeight: FontWeight.w400,
color: descColor ?? Colors.grey,
),
),
const SizedBox(height: 20),
if (disableBtn == false)
Row(
children: [
header ?? Container(),
const SizedBox(height: 20),
Text(
title ?? "Congratulations",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18,
color: titleColor ?? Colors.black,
fontWeight: FontWeight.w600,
fontFamily: fontFamily,
Expanded(
child: ArtButtonsKh(
text: btnLabelR ?? "Cancel",
textColor: labelColorBtnL,
backgroundColor: backgroundColorBtnL ?? Colors.black,
onPressed: onCancel,
),
),
const SizedBox(height: 8),
Text(
description ?? "Congratulation your work is good",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 14,
fontFamily: fontFamily,
fontWeight: FontWeight.w400,
color: descColor ?? Colors.grey,
const SizedBox(width: 20),
Expanded(
child: ArtButtonsKh(
text: btnLabelL ?? "Okay",
textColor: labelColorBtnR,
backgroundColor: backgroundColorBtnR ?? Theme.of(context).primaryColor,
onPressed: onConfirm,
),
),
const SizedBox(height: 20),
if (disableBtn == false)
Row(
children: [
Expanded(
child: ArtButtonsKh(
text: btnLabelR ?? "Cancel",
textColor: labelColorBtnL,
backgroundColor: backgroundColorBtnL ?? Colors.black,
onPressed: onCancel,
),
),
const SizedBox(width: 20),
Expanded(
child: ArtButtonsKh(
text: btnLabelL ?? "Okay",
textColor: labelColorBtnR,
backgroundColor: backgroundColorBtnR ?? Theme.of(context).primaryColor,
onPressed: onConfirm,
),
),
],
),
],
),
],
),
);
},
);
Expand Down
3 changes: 2 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: dialog_kh
description: A Flutter library to help you create animated, simple, style, custom dialogs in your app.
version: 0.0.1
homepage:
homepage: https://github.com/chhumsovann/dialog_kh
repository: https://github.com/chhumsovann/dialog_kh.git

environment:
sdk: '>=2.19.2 <3.0.0'
Expand Down

0 comments on commit 7d2f1fe

Please sign in to comment.