Skip to content

successfully implemented CRUD operations for Customer model #15

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

Open
wants to merge 1 commit 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 android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,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
8 changes: 8 additions & 0 deletions lib/core/exceptions/unique_exception.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class UniqueException implements Exception{
final String message;

UniqueException(this.message);

@override
String toString() => message;
}
245 changes: 245 additions & 0 deletions lib/core/resoruces/colors/color_pallete.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart';
import 'package:mc_crud_test/core/resoruces/colors/my_colors.dart';
// ignore: must_be_immutable
class DarkThemeColors extends Equatable implements MyColors {
// @override
// String key = darkThemeKey;

@override
Color background = const Color.fromARGB(255, 16, 22, 30);

@override
Color onPrimary = const Color.fromARGB(255, 0, 0, 0);

@override
Color onSecondary = const Color.fromARGB(255, 0, 0, 0);
@override
Color primary = const Color.fromARGB(255, 134, 183, 184);

@override
Color secondary = const Color.fromARGB(255, 158, 253, 231);

@override
Color surface = const Color.fromARGB(255, 53, 61, 72);

@override
Color onBackground = const Color.fromARGB(255, 255, 255, 255);

@override
Color onSurface = const Color.fromARGB(255, 255, 255, 255);

@override
Brightness brightness = Brightness.dark;

@override
List<Object?> get props => [
background,
onPrimary,
onSecondary,
primary,
secondary,
surface,
onBackground,
onSurface,
brightness,
];

@override
bool? get stringify => true;
}

// ignore: must_be_immutable
class DarkThemeColors2 extends Equatable implements MyColors {
// @override
// String key = darkTheme2Key;

@override
Color background = const Color(0xFF07161b);

@override
Color onPrimary = const Color.fromARGB(255, 0, 0, 0);

@override
Color onSecondary = const Color.fromARGB(255, 255, 255, 255);
@override
Color primary = const Color(0xFF3d737f);

@override
Color secondary = const Color.fromARGB(255, 240, 159, 66);

@override
Color surface = const Color.fromARGB(255, 18, 60, 74);

@override
Color onBackground = const Color.fromARGB(255, 255, 255, 255);

@override
Color onSurface = const Color.fromARGB(255, 255, 255, 255);

@override
Brightness brightness = Brightness.dark;

@override
List<Object?> get props => [
background,
onPrimary,
onSecondary,
primary,
secondary,
surface,
onBackground,
onSurface,
brightness,
];

@override
bool? get stringify => true;
}

// ignore: must_be_immutable
class DarkThemeColors3 extends Equatable implements MyColors {
// @override
// String key = darkTheme3Key;

@override
Color background = const Color(0xFF333c4b);

@override
Color onPrimary = const Color.fromARGB(255, 255, 255, 255);

@override
Color onSecondary = const Color.fromARGB(255, 255, 255, 255);
@override
Color primary = const Color.fromARGB(255, 172, 125, 58);

@override
Color secondary = const Color(0xFFd4a056);

@override
Color surface = const Color(0xFF4a4c5c);

@override
Color onBackground = const Color.fromARGB(255, 255, 255, 255);

@override
Color onSurface = const Color.fromARGB(255, 255, 255, 255);

@override
Brightness brightness = Brightness.dark;

@override
List<Object?> get props => [
background,
onPrimary,
onSecondary,
primary,
secondary,
surface,
onBackground,
onSurface,
brightness,
];

@override
bool? get stringify => true;
}

// ignore: must_be_immutable
class LightThemeColors extends Equatable implements MyColors {
// @override
// String key = lightThemeKey;

@override
Color background = const Color.fromARGB(255, 246, 237, 236);

@override
Color onPrimary = Colors.white;

@override
Color onSecondary = Colors.white;

@override
Color primary = const Color.fromARGB(255, 252, 204, 218);

@override
Color secondary = const Color.fromARGB(255, 1, 0, 49);

@override
Color surface = const Color.fromARGB(255, 225, 225, 225);

@override
Color onBackground = Colors.black;

@override
Color onSurface = const Color.fromARGB(255, 0, 0, 0);

@override
Brightness brightness = Brightness.light;

@override
List<Object?> get props => [
background,
onPrimary,
onSecondary,
primary,
secondary,
surface,
onBackground,
onSurface,
brightness,
];

@override
bool? get stringify => true;
}


// ignore: must_be_immutable
class LightThemeColors2 extends Equatable implements MyColors {
// @override
// String key = lightThemeKey;

@override
Color background = const Color(0xfff0f1f1);

@override
Color onPrimary = Colors.white;

@override
Color onSecondary = Colors.white;

@override
Color primary = const Color(0xff3a30c7);

@override
Color secondary = const Color.fromARGB(255, 1, 0, 49);

@override
Color surface = const Color(0xfffffdfc);

@override
Color onBackground = Colors.black;

@override
Color onSurface = const Color(0xff333434);

@override
Brightness brightness = Brightness.light;

@override
List<Object?> get props => [
background,
onPrimary,
onSecondary,
primary,
secondary,
surface,
onBackground,
onSurface,
brightness,
];

@override
bool? get stringify => true;
}
31 changes: 31 additions & 0 deletions lib/core/resoruces/colors/my_colors.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import 'package:flutter/material.dart';
abstract class MyColors {
// late final String key;
late final Color background;
late final Color onBackground;
late final Color onSurface;
late final Color surface;

late final Color primary;
late final Color onPrimary;

late final Color secondary;
late final Color onSecondary;

late final Brightness brightness;

// factory MyColors.fromMap(Map<String, dynamic> map) {
// switch (map["key"]) {
// case darkThemeKey:
// return DarkThemeColors();
// case darkTheme2Key:
// return DarkThemeColors2();
// case darkTheme3Key:
// return DarkThemeColors3();
// case lightThemeKey:
// return LightThemeColors();
// default:
// return DarkThemeColors();
// }
// }
}
1 change: 1 addition & 0 deletions lib/core/resoruces/const/dimensions.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const double defaultRadius = 15;
49 changes: 49 additions & 0 deletions lib/core/resoruces/functions/functions.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:mc_crud_test/core/resoruces/widgets/my_banner.dart';
import 'package:mc_crud_test/features/customer/presentation/bloc/cubit/customer_cubit.dart';

void showResultBanner(bool isSucc, BuildContext context, String succText,
String failText, bool pop) {
if (isSucc) {
BlocProvider.of<CustomerCubit>(context).readCustomers();
if (pop) {
Navigator.of(context).pop();
}

MyBanner.show(
context,
configuredBanner: MyBanner(
containerDecoration: BoxDecoration(
color: const Color.fromARGB(255, 52, 201, 57),
borderRadius: BorderRadius.circular(10)),
content: [
Text(
succText,
style: const TextStyle(
color: Colors.white,
),
),
],
),
);
} else {
MyBanner.show(
context,
configuredBanner: MyBanner(
containerDecoration: BoxDecoration(
color: Colors.red,
borderRadius: BorderRadius.circular(10),
),
content: [
Text(
failText,
style: const TextStyle(
color: Colors.white,
),
),
],
),
);
}
}
13 changes: 13 additions & 0 deletions lib/core/resoruces/styles/button_style.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import 'package:flutter/material.dart';
import 'package:mc_crud_test/core/resoruces/const/dimensions.dart';

primaryElevatedButtonStyle(BuildContext context, Size? fixedSize) =>
ElevatedButton.styleFrom(
fixedSize: fixedSize,
backgroundColor: Theme.of(context).colorScheme.primary,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(
defaultRadius,
),
),
);
Loading