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

updated with the latest version #2

Open
wants to merge 3 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
Empty file added 0
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ public final class GeneratedPluginRegistrant {
public static void registerWith(@NonNull FlutterEngine flutterEngine) {
try {
flutterEngine.getPlugins().add(new dev.flutter.plugins.integration_test.IntegrationTestPlugin());
} catch(Exception e) {
} catch (Exception e) {
Log.e(TAG, "Error registering plugin integration_test, dev.flutter.plugins.integration_test.IntegrationTestPlugin", e);
}
try {
flutterEngine.getPlugins().add(new io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin());
} catch(Exception e) {
} catch (Exception e) {
Log.e(TAG, "Error registering plugin shared_preferences_android, io.flutter.plugins.sharedpreferences.SharedPreferencesPlugin", e);
}
}
Expand Down
7 changes: 4 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
buildscript {
ext.kotlin_version = '1.6.10'
ext.kotlin_version = '1.9.10'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.android.tools.build:gradle:7.4.2'

classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand All @@ -26,6 +27,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
18 changes: 10 additions & 8 deletions lib/app/components/category_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class CategoryItem extends StatelessWidget {
Widget build(BuildContext context) {
final theme = context.theme;
return GestureDetector(
onTap: () => Get.toNamed(Routes.PRODUCTS),
onTap: () => Get.toNamed(Routes.products),
child: Column(
children: [
CircleAvatar(
Expand All @@ -27,14 +27,16 @@ class CategoryItem extends StatelessWidget {
child: SvgPicture.asset(category.image),
).animate().fade(duration: 200.ms),
10.verticalSpace,
Text(category.title, style: theme.textTheme.headline6)
.animate().fade().slideY(
duration: 200.ms,
begin: 1,
curve: Curves.easeInSine,
),
Text(category.title, style: theme.textTheme.bodyMedium)
.animate()
.fade()
.slideY(
duration: 200.ms,
begin: 1,
curve: Curves.easeInSine,
),
],
),
);
}
}
}
28 changes: 16 additions & 12 deletions lib/app/components/custom_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,30 +59,34 @@ class CustomButton extends StatelessWidget {
onTap: !disabled ? onPressed : null,
child: Ink(
width: width ?? double.infinity,
padding: EdgeInsets.symmetric(horizontal: 20.w, vertical: verticalPadding ?? 14.h),
padding: EdgeInsets.symmetric(
horizontal: 20.w, vertical: verticalPadding ?? 14.h),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(radius ?? 10.r),
border: Border.all(color: borderColor ?? Colors.transparent),
color: !disabled ? backgroundColor ?? Get.theme.primaryColor : Get.theme.primaryColor.withOpacity(0.5),
color: !disabled
? backgroundColor ?? Get.theme.primaryColor
: Get.theme.primaryColor.withOpacity(0.5),
gradient: gradient,
boxShadow: !hasShadow || disabled
? null
: [
BoxShadow(
color: ( shadowColor ?? Colors.black).withOpacity(shadowOpacity),
spreadRadius: shadowSpreadRadius,
blurRadius: shadowBlurRadius,
offset: const Offset(0, 2),
),
],
? null
: [
BoxShadow(
color: (shadowColor ?? Colors.black)
.withOpacity(shadowOpacity),
spreadRadius: shadowSpreadRadius,
blurRadius: shadowBlurRadius,
offset: const Offset(0, 2),
),
],
),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
text,
style: Get.theme.textTheme.bodyText1?.copyWith(
style: Get.theme.textTheme.bodyMedium?.copyWith(
fontSize: fontSize,
fontWeight: fontWeight,
color: foregroundColor ?? Colors.white,
Expand Down
7 changes: 4 additions & 3 deletions lib/app/components/custom_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,17 @@ class CustomCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
title, style: theme.textTheme.headline5?.copyWith(
title,
style: theme.textTheme.bodyMedium?.copyWith(
color: theme.primaryColor,
),
),
4.verticalSpace,
Text(subtitle, style: theme.textTheme.bodyText2),
Text(subtitle, style: theme.textTheme.bodySmall),
],
)
],
),
);
}
}
}
108 changes: 73 additions & 35 deletions lib/app/components/custom_form_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class CustomFormField extends StatefulWidget {
final bool isSearchField; // will show cancel prefix icon to cancel search
final Function? onCanceled; // callback for cancel (if its search field)


const CustomFormField({
Key? key,
this.hint,
Expand Down Expand Up @@ -105,7 +104,6 @@ class CustomFormField extends StatefulWidget {
}

class _CustomFormFieldState extends State<CustomFormField> {

String text = '';

@override
Expand All @@ -114,11 +112,10 @@ class _CustomFormFieldState extends State<CustomFormField> {
color: Colors.transparent,
child: Theme(
data: Get.theme.copyWith(
primaryColor: widget.iconColor ?? Get.theme.primaryColor,
colorScheme: Get.theme.colorScheme.copyWith(
primary: widget.iconColor ?? Get.theme.primaryColor,
)
),
primaryColor: widget.iconColor ?? Get.theme.primaryColor,
colorScheme: Get.theme.colorScheme.copyWith(
primary: widget.iconColor ?? Get.theme.primaryColor,
)),
child: TextFormField(
textAlign: widget.textAlign ?? TextAlign.start,
enabled: widget.enabled,
Expand All @@ -128,13 +125,15 @@ class _CustomFormFieldState extends State<CustomFormField> {
//cursorHeight: 15,
autovalidateMode: AutovalidateMode.onUserInteraction,
initialValue: widget.initialValue,
style: MyStyles.getTextTheme(isLightTheme: Get.isDarkMode).bodyText2!.copyWith(
fontSize: widget.textSize ?? 14.sp,
color: widget.textColor ?? Colors.black.withOpacity(0.8),
),
style: MyStyles.getTextTheme(isLightTheme: Get.isDarkMode)
.bodySmall!
.copyWith(
fontSize: widget.textSize ?? 14.sp,
color: widget.textColor ?? Colors.black.withOpacity(0.8),
),
onSaved: widget.onFieldSubmit,
onEditingComplete: widget.onEditingComplete,
onChanged: (value){
onChanged: (value) {
setState(() {
text = value;
});
Expand All @@ -144,34 +143,73 @@ class _CustomFormFieldState extends State<CustomFormField> {
maxLines: widget.obscureText == true ? 1 : widget.maxLines,
expands: widget.expands ?? false,
decoration: InputDecoration(
label: widget.label == null ? null : Text(widget.label ?? '', style: TextStyle(fontSize: widget.labelSize),),
suffixIcon: widget.isSearchField ? text.isEmpty ? null : GestureDetector(onTap: (){
setState(() {
widget.controller?.clear();
text = '';
widget.onCanceled?.call();
FocusScope.of(context).unfocus();
});
},child: Icon(Icons.close,color: Get.theme.iconTheme.color,)) : widget.suffixIcon,
label: widget.label == null
? null
: Text(
widget.label ?? '',
style: TextStyle(fontSize: widget.labelSize),
),
suffixIcon: widget.isSearchField
? text.isEmpty
? null
: GestureDetector(
onTap: () {
setState(() {
widget.controller?.clear();
text = '';
widget.onCanceled?.call();
FocusScope.of(context).unfocus();
});
},
child: Icon(
Icons.close,
color: Get.theme.iconTheme.color,
))
: widget.suffixIcon,
prefixIcon: widget.prefixIcon,
contentPadding: widget.contentPadding ?? EdgeInsets.symmetric(vertical: 12.h, horizontal: 20.w),
contentPadding: widget.contentPadding ??
EdgeInsets.symmetric(vertical: 12.h, horizontal: 20.w),
isDense: widget.isDense,
filled: true,
fillColor: widget.backgroundColor ?? const Color(0xFFF9F9F9),
hintStyle: MyFonts.getAppFontType.copyWith(
fontSize: widget.hintFontSize ?? 14.sp,
fontWeight: widget.hintFontWeight ?? FontWeight.normal,
color: widget.hintColor ?? Colors.black.withOpacity(0.4)
),
hintStyle: MyFonts.getAppFontType.copyWith(
fontSize: widget.hintFontSize ?? 14.sp,
fontWeight: widget.hintFontWeight ?? FontWeight.normal,
color: widget.hintColor ?? Colors.black.withOpacity(0.4)),
hintText: widget.hint,
focusedErrorBorder: widget.errorBorder ?? OutlineInputBorder(borderSide: const BorderSide(color: Colors.redAccent, width: 0.0), borderRadius: BorderRadius.circular(widget.borderRound ?? 10)),
disabledBorder: OutlineInputBorder(borderSide: BorderSide(color: Colors.grey.withOpacity(0), width: 0.0), borderRadius: BorderRadius.circular(widget.borderRound ?? 10)),
errorBorder: widget.errorBorder ?? OutlineInputBorder(borderSide: const BorderSide(color: Colors.redAccent, width: 0.0), borderRadius: BorderRadius.circular(widget.borderRound ?? 10)),
enabledBorder: widget.enabledBorder ?? OutlineInputBorder(borderSide: BorderSide(color: widget.enabledBorder == null ? Colors.transparent : Colors.grey[300]!, width: 0.0), borderRadius: BorderRadius.circular(widget.borderRound ?? 10)),
focusedBorder: widget.focusedBorder ?? OutlineInputBorder(
borderSide: BorderSide(color: widget.focusedBorderColor ?? Theme.of(context).primaryColor, width: 1.0),
borderRadius: BorderRadius.circular(widget.borderRound ?? 10),
),
focusedErrorBorder: widget.errorBorder ??
OutlineInputBorder(
borderSide:
const BorderSide(color: Colors.redAccent, width: 0.0),
borderRadius:
BorderRadius.circular(widget.borderRound ?? 10)),
disabledBorder: OutlineInputBorder(
borderSide:
BorderSide(color: Colors.grey.withOpacity(0), width: 0.0),
borderRadius: BorderRadius.circular(widget.borderRound ?? 10)),
errorBorder: widget.errorBorder ??
OutlineInputBorder(
borderSide:
const BorderSide(color: Colors.redAccent, width: 0.0),
borderRadius:
BorderRadius.circular(widget.borderRound ?? 10)),
enabledBorder: widget.enabledBorder ??
OutlineInputBorder(
borderSide: BorderSide(
color: widget.enabledBorder == null
? Colors.transparent
: Colors.grey[300]!,
width: 0.0),
borderRadius:
BorderRadius.circular(widget.borderRound ?? 10)),
focusedBorder: widget.focusedBorder ??
OutlineInputBorder(
borderSide: BorderSide(
color: widget.focusedBorderColor ??
Theme.of(context).primaryColor,
width: 1.0),
borderRadius: BorderRadius.circular(widget.borderRound ?? 10),
),
),
validator: widget.validator,
controller: widget.controller,
Expand Down
10 changes: 6 additions & 4 deletions lib/app/components/custom_icon_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ class CustomIconButton extends StatelessWidget {
width: width ?? 44.w,
height: height ?? 44.h,
child: Material(
color: backgroundColor ?? theme.backgroundColor,
shape: borderColor == null ? const CircleBorder() : CircleBorder(
side: BorderSide(color: borderColor!),
),
color: backgroundColor ?? theme.primaryColor.withOpacity(0.1),
shape: borderColor == null
? const CircleBorder()
: CircleBorder(
side: BorderSide(color: borderColor!),
),
child: InkWell(
onTap: onPressed,
child: icon,
Expand Down
49 changes: 33 additions & 16 deletions lib/app/components/custom_loading_overlay.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,23 @@ showLoadingOverLay({
required Future<dynamic> Function() asyncFunction,
String? msg,
}) async {
await Get.showOverlay(asyncFunction: () async {
try{
await asyncFunction();
} catch(error) {
rethrow;
}
}, loadingWidget: Center(
child: _getLoadingIndicator(msg: msg),
), opacity: 0.7,
await Get.showOverlay(
asyncFunction: () async {
try {
await asyncFunction();
} catch (error) {
rethrow;
}
},
loadingWidget: Center(
child: _getLoadingIndicator(msg: msg),
),
opacity: 0.7,
opacityColor: Colors.black,
);
}

Widget _getLoadingIndicator({String? msg}){
Widget _getLoadingIndicator({String? msg}) {
return Container(
padding: EdgeInsets.symmetric(
horizontal: 20.w,
Expand All @@ -31,10 +34,24 @@ Widget _getLoadingIndicator({String? msg}){
borderRadius: BorderRadius.circular(10.r),
color: Colors.white,
),
child: Column(mainAxisSize: MainAxisSize.min,children: [
Image.asset('assets/images/app_icon.png',height: 45.h,),
SizedBox(width: 8.h,),
Text(msg ?? Strings.loading.tr,style: Get.theme.textTheme.bodyText1),
],),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Image.asset(
'assets/images/app_icon.png',
height: 45.h,
),
SizedBox(
width: 8.h,
),
Text(
msg ?? Strings.loading.tr,
style: Get.theme.textTheme.bodyMedium?.copyWith(
fontSize: 16.sp,
color: Get.theme.primaryColor,
),
),
],
),
);
}
}
Loading