Skip to content
Merged
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
59 changes: 35 additions & 24 deletions lib/src/alerts/confirmation_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ Future<bool> showConfirmDialog({
return Center(
child: Card(
margin: const EdgeInsets.all(16),
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(24)),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(24),
),
clipBehavior: Clip.hardEdge,
child: Column(
mainAxisSize: MainAxisSize.min,
Expand All @@ -45,37 +46,41 @@ Future<bool> showConfirmDialog({
: Lottie.asset(lottie, width: double.infinity),
),
),
const SizedBox(
height: 12,
),
const SizedBox(height: 12),
Container(
padding:
const EdgeInsets.symmetric(vertical: 10.0, horizontal: 16),
padding: const EdgeInsets.symmetric(
vertical: 10.0,
horizontal: 16,
),
width: double.infinity,
child: Text(
title,
style: titleTextStyle ??
style:
titleTextStyle ??
const TextStyle(
fontSize: 20, fontWeight: FontWeight.bold),
fontSize: 20,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.start,
),
),
Container(
padding:
const EdgeInsets.symmetric(vertical: 12.0, horizontal: 16),
padding: const EdgeInsets.symmetric(
vertical: 12.0,
horizontal: 16,
),
width: double.infinity,
child: Text(
message,
style: messageTextStyle ??
const TextStyle(
fontSize: 18,
),
style: messageTextStyle ?? const TextStyle(fontSize: 18),
textAlign: TextAlign.start,
),
),
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 8.0, vertical: 12),
padding: const EdgeInsets.symmetric(
horizontal: 8.0,
vertical: 12,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Expand All @@ -87,7 +92,8 @@ Future<bool> showConfirmDialog({
isConfirmed = true;
onConfirmed();
},
style: confirmButtonStyle ??
style:
confirmButtonStyle ??
ElevatedButton.styleFrom(
backgroundColor: Theme.of(context).primaryColor,
shape: RoundedRectangleBorder(
Expand All @@ -100,7 +106,8 @@ Future<bool> showConfirmDialog({
),
child: Text(
confirmText,
style: confirmButtonTextStyle ??
style:
confirmButtonTextStyle ??
const TextStyle(fontSize: 18),
),
),
Expand All @@ -114,7 +121,8 @@ Future<bool> showConfirmDialog({
isConfirmed = false;
Navigator.pop(context);
},
style: cancelButtonStyle ??
style:
cancelButtonStyle ??
TextButton.styleFrom(
padding: const EdgeInsets.symmetric(
horizontal: 8,
Expand All @@ -126,16 +134,19 @@ Future<bool> showConfirmDialog({
),
child: Text(
cancelText,
style: cancelButtonTextStyle ??
style:
cancelButtonTextStyle ??
const TextStyle(
color: Colors.grey, fontSize: 18),
color: Colors.grey,
fontSize: 18,
),
),
),
),
)
),
],
),
)
),
],
),
),
Expand Down
5 changes: 1 addition & 4 deletions lib/src/date/date_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,7 @@ class DateTimePicker {
initialTime: TimeOfDay.fromDateTime(initialDate ?? DateTime.now()),
);
if (time != null) {
date = date.copyWith(
hour: time.hour,
minute: time.minute,
);
date = date.copyWith(hour: time.hour, minute: time.minute);
}
}

Expand Down
19 changes: 10 additions & 9 deletions lib/src/utils/common_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@ import 'package:flutter/rendering.dart';
import 'package:flutter_svg/flutter_svg.dart';

class CommonImageUtils {
static Future<Uint8List> getImageFromSvgAsset(String assetName,
{Size size = const Size(48, 48),
BuildContext? context,
ColorMapper? colorMapper}) async {
static Future<Uint8List> getImageFromSvgAsset(
String assetName, {
Size size = const Size(48, 48),
BuildContext? context,
ColorMapper? colorMapper,
}) async {
final pictureInfo = await vg.loadPicture(
SvgAssetLoader(
assetName,
colorMapper: colorMapper,
),
SvgAssetLoader(assetName, colorMapper: colorMapper),
null,
);

Expand Down Expand Up @@ -68,7 +67,9 @@ class CommonImageUtils {
final renderView = RenderView(
view: view,
child: RenderPositionedBox(
alignment: Alignment.center, child: repaintBoundary),
alignment: Alignment.center,
child: repaintBoundary,
),
configuration: ViewConfiguration(
physicalConstraints:
BoxConstraints.tight(logicalSize) * view.devicePixelRatio,
Expand Down
15 changes: 8 additions & 7 deletions lib/src/utils/icon_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,14 @@ class IconInfo {
BoxFit? fit,
TextDirection? textDirection,
}) {
return ImageViewer.icon(this,
color: color,
width: size,
height: size,
fit: fit,
iconDirection: textDirection);
return ImageViewer.icon(
this,
color: color,
width: size,
height: size,
fit: fit,
iconDirection: textDirection,
);
}
}

Expand All @@ -70,5 +72,4 @@ extension IconInfoExtension on IconData {
IconInfo toIconInfo({Color? color, double? size}) {
return IconInfo.icon(this, color: color, size: size);
}

}
96 changes: 50 additions & 46 deletions lib/src/widgets/anim_search_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,9 @@ class _AnimSearchBarState extends State<AnimSearchBar>
children: [
///Using Animated Positioned widget to expand and shrink the widget
AnimatedPositioned(
duration:
Duration(milliseconds: widget.animationDurationInMilli),
duration: Duration(
milliseconds: widget.animationDurationInMilli,
),
top: 6.0,
right: 7.0,
curve: Curves.easeOut,
Expand Down Expand Up @@ -231,7 +232,8 @@ class _AnimSearchBarState extends State<AnimSearchBar>
},

///suffixIcon is of type Icon
child: widget.suffixIcon ??
child:
widget.suffixIcon ??
Icon(
Icons.close,
size: 20.0,
Expand All @@ -243,20 +245,22 @@ class _AnimSearchBarState extends State<AnimSearchBar>
),
),
Directionality(
textDirection:
widget.rtl ? TextDirection.rtl : TextDirection.ltr,
textDirection: widget.rtl
? TextDirection.rtl
: TextDirection.ltr,
child: AnimatedPositioned(
duration:
Duration(milliseconds: widget.animationDurationInMilli),
duration: Duration(
milliseconds: widget.animationDurationInMilli,
),
left: widget.rtl
? null
: (toggle == 0)
? 20.0
: 40.0,
? 20.0
: 40.0,
right: widget.rtl
? (toggle == 0)
? 20.0
: 40.0
? 20.0
: 40.0
: null,
curve: Curves.easeOut,
top: widget.rtl ? 6 : 11,
Expand Down Expand Up @@ -299,15 +303,17 @@ class _AnimSearchBarState extends State<AnimSearchBar>
},

///style is of type TextStyle, the default is just a color black
style: widget.style ??
style:
widget.style ??
const TextStyle(color: Colors.black),
cursorColor: widget.cursorColor,
decoration: InputDecoration(
contentPadding: const EdgeInsets.only(bottom: 5),
isDense: true,
floatingLabelBehavior: FloatingLabelBehavior.never,
labelText: widget.helpText,
labelStyle: widget.labelStyle ??
labelStyle:
widget.labelStyle ??
TextStyle(
color: const Color(0xff5B5B5B),
fontSize: 14.0.sp,
Expand Down Expand Up @@ -340,11 +346,11 @@ class _AnimSearchBarState extends State<AnimSearchBar>
///prefixIcon is of type Icon
icon: widget.prefixIcon != null
? toggle == 1
? Icon(
Icons.arrow_back_ios,
color: widget.textFieldIconColor,
)
: widget.prefixIcon!
? Icon(
Icons.arrow_back_ios,
color: widget.textFieldIconColor,
)
: widget.prefixIcon!
: Icon(
toggle == 1 ? Icons.arrow_back_ios : Icons.search,
// search icon color when closed
Expand All @@ -354,34 +360,32 @@ class _AnimSearchBarState extends State<AnimSearchBar>
size: 20.0,
),
onPressed: () {
setState(
() {
///if the search bar is closed
if (toggle == 0) {
toggle = 1;
setState(() {
///if the autoFocus is true, the keyboard will pop open, automatically
if (widget.autoFocus) {
FocusScope.of(context).requestFocus(focusNode);
}
});

///forward == expand
_con.forward();
} else {
///if the search bar is expanded
toggle = 0;

///if the autoFocus is true, the keyboard will close, automatically
setState(() {
if (widget.autoFocus) unfocusKeyboard();
});

///reverse == close
_con.reverse();
}
},
);
setState(() {
///if the search bar is closed
if (toggle == 0) {
toggle = 1;
setState(() {
///if the autoFocus is true, the keyboard will pop open, automatically
if (widget.autoFocus) {
FocusScope.of(context).requestFocus(focusNode);
}
});

///forward == expand
_con.forward();
} else {
///if the search bar is expanded
toggle = 0;

///if the autoFocus is true, the keyboard will close, automatically
setState(() {
if (widget.autoFocus) unfocusKeyboard();
});

///reverse == close
_con.reverse();
}
});
widget.searchBarOpen?.call(toggle);
},
),
Expand Down
Loading
Loading