first
This commit is contained in:
5
lib/constant/box_name.dart
Normal file
5
lib/constant/box_name.dart
Normal file
@@ -0,0 +1,5 @@
|
||||
class BoxName {
|
||||
static const String driverID = "driverID";
|
||||
|
||||
static const String lang = "lang";
|
||||
}
|
||||
7
lib/constant/colors.dart
Normal file
7
lib/constant/colors.dart
Normal file
@@ -0,0 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class AppColor {
|
||||
static const Color primaryColor = Colors.black;
|
||||
static const Color secondaryColor = Colors.white;
|
||||
static const Color accentColor = Colors.grey;
|
||||
}
|
||||
12
lib/constant/credential.dart
Normal file
12
lib/constant/credential.dart
Normal file
@@ -0,0 +1,12 @@
|
||||
import 'dart:convert';
|
||||
|
||||
class AppCredintials {
|
||||
static const String basicAuthCredentials = 'hamzaayedphp:malDEV@2101';
|
||||
static const String serverAPI =
|
||||
'AAAAinYllCo:APA91bF1shTpzSsSxqbfY6c60D8zs1ZsdIsl9ix6nl7GDdjCqWPRK0G0ub5SqFdb1jDpQDvQPxGg-697MWLo0sy3oYImBwBLObyhk0GjtNzyr0PbE3hI-pOvhf8Vp1xgUgBmofbZYXkH';
|
||||
// static const String mapAPIKEY = 'AIzaSyC1pjEgB78OFz_-2nwTvGltHjXho0y99MY';
|
||||
static const String mapAPIKEY = 'AIzaSyCyfwRXTwSTLOFQSQgN5p7QZgGJVZnEKq0';
|
||||
String getBasicAuthCredentials() {
|
||||
return base64Encode(utf8.encode(basicAuthCredentials));
|
||||
}
|
||||
}
|
||||
7
lib/constant/info.dart
Normal file
7
lib/constant/info.dart
Normal file
@@ -0,0 +1,7 @@
|
||||
class Fleek {
|
||||
static const String companyName = 'Fleek-tech';
|
||||
static const String phoneNumber = '962798583052';
|
||||
static const String linkedInProfile =
|
||||
'https://www.linkedin.com/in/hamza-ayed/';
|
||||
static const String website = 'https://mobile-app.store';
|
||||
}
|
||||
25
lib/constant/links.dart
Normal file
25
lib/constant/links.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
class AppLink {
|
||||
static const String server = 'https://ride.mobile-app.store/';
|
||||
|
||||
static const String test = "$server/test.php";
|
||||
|
||||
static const String pathImage = "$server/upload/types/";
|
||||
static const String uploadImage = "$server/uploadImage.php";
|
||||
static const String uploadImageType = "$server/uploadImageType.php";
|
||||
|
||||
//==================certifcate==========
|
||||
static const String certifcate =
|
||||
'https://portfolio.mobile-app.store/hamzaayed/certifications';
|
||||
static const String getCertificate = "$certifcate/get.php";
|
||||
static const String addCertificate = "$certifcate/add.php";
|
||||
static const String deleteCertificate = "$certifcate/delete.php";
|
||||
static const String updateCertificate = "$certifcate/update.php";
|
||||
|
||||
//==================Blog=============
|
||||
static const String blog =
|
||||
'https://portfolio.mobile-app.store/hamzaayed/blogs';
|
||||
static const String getBlog = "$blog/get.php";
|
||||
static const String addBlog = "$blog/add.php";
|
||||
static const String deleteBlog = "$blog/delete.php";
|
||||
static const String updateBlog = "$blog/update.php";
|
||||
}
|
||||
31
lib/constant/style.dart
Normal file
31
lib/constant/style.dart
Normal file
@@ -0,0 +1,31 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'colors.dart';
|
||||
|
||||
class AppStyle {
|
||||
static TextStyle headTitle = TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 40,
|
||||
color: AppColor.accentColor,
|
||||
fontFamily: GoogleFonts.pacifico().fontFamily);
|
||||
static TextStyle headtitle2 = TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 26,
|
||||
color: AppColor.primaryColor,
|
||||
fontFamily: GoogleFonts.eduSaBeginner().fontFamily);
|
||||
static TextStyle title = TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
color: AppColor.primaryColor,
|
||||
fontFamily: GoogleFonts.roboto().fontFamily);
|
||||
static TextStyle subtitle = TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 13,
|
||||
color: AppColor.primaryColor,
|
||||
fontFamily: GoogleFonts.roboto().fontFamily);
|
||||
static TextStyle number = TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 20,
|
||||
color: AppColor.primaryColor,
|
||||
fontFamily: GoogleFonts.roboto().fontFamily);
|
||||
}
|
||||
13
lib/controller/auth/login_controller.dart
Normal file
13
lib/controller/auth/login_controller.dart
Normal file
@@ -0,0 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class LoginController extends GetxController {
|
||||
TextEditingController emailController = TextEditingController();
|
||||
TextEditingController phoneController = TextEditingController();
|
||||
TextEditingController firstNameController = TextEditingController();
|
||||
TextEditingController lastNameController = TextEditingController();
|
||||
|
||||
void login() {
|
||||
//TODO: Implement login logic
|
||||
}
|
||||
}
|
||||
89
lib/controller/functions/crud.dart
Normal file
89
lib/controller/functions/crud.dart
Normal file
@@ -0,0 +1,89 @@
|
||||
import 'dart:convert';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../../constant/credential.dart';
|
||||
|
||||
class CRUD {
|
||||
Future<dynamic> get({
|
||||
required String link,
|
||||
Map<String, dynamic>? payload,
|
||||
}) async {
|
||||
var url = Uri.parse(link);
|
||||
var response = await http.get(
|
||||
url,
|
||||
headers: {
|
||||
'Authorization':
|
||||
'Basic ${base64Encode(utf8.encode(AppCredintials.basicAuthCredentials))}',
|
||||
},
|
||||
);
|
||||
List data = jsonDecode(response.body)['data'];
|
||||
print(data);
|
||||
return data;
|
||||
}
|
||||
|
||||
Future<dynamic> post({
|
||||
required String link,
|
||||
Map<String, dynamic>? payload,
|
||||
}) async {
|
||||
var url = Uri.parse(
|
||||
link,
|
||||
);
|
||||
var response = await http.post(
|
||||
url,
|
||||
body: payload,
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
'Authorization':
|
||||
'Basic ${base64Encode(utf8.encode(AppCredintials.basicAuthCredentials))}',
|
||||
},
|
||||
);
|
||||
if (response.statusCode == 200) {
|
||||
var jsonData = jsonDecode(response.body);
|
||||
if (jsonData['status'] == 'success') {
|
||||
Get.snackbar(
|
||||
jsonData['status'],
|
||||
jsonData['message'],
|
||||
);
|
||||
|
||||
return response.body;
|
||||
} else if (jsonData['status'] == 'success1') {
|
||||
print(jsonData['data']);
|
||||
return jsonData['data'];
|
||||
}
|
||||
}
|
||||
return (response.body);
|
||||
}
|
||||
|
||||
Future<dynamic> update({
|
||||
required String endpoint,
|
||||
required Map<String, dynamic> data,
|
||||
required String id,
|
||||
}) async {
|
||||
var url = Uri.parse('$endpoint/$id');
|
||||
var response = await http.put(
|
||||
url,
|
||||
body: json.encode(data),
|
||||
headers: {
|
||||
'Authorization':
|
||||
'Basic ${base64Encode(utf8.encode(AppCredintials.basicAuthCredentials))}',
|
||||
},
|
||||
);
|
||||
return json.decode(response.body);
|
||||
}
|
||||
|
||||
Future<dynamic> delete({
|
||||
required String endpoint,
|
||||
required String id,
|
||||
}) async {
|
||||
var url = Uri.parse('$endpoint/$id');
|
||||
var response = await http.delete(
|
||||
url,
|
||||
headers: {
|
||||
'Authorization':
|
||||
'Basic ${base64Encode(utf8.encode(AppCredintials.basicAuthCredentials))}',
|
||||
},
|
||||
);
|
||||
return json.decode(response.body);
|
||||
}
|
||||
}
|
||||
9
lib/controller/functions/launch.dart
Normal file
9
lib/controller/functions/launch.dart
Normal file
@@ -0,0 +1,9 @@
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
void launchUrl1(String url) async {
|
||||
if (await canLaunchUrl(Uri.parse(url))) {
|
||||
launchUrl(Uri.parse(url));
|
||||
} else {
|
||||
print('Could not launch $url');
|
||||
}
|
||||
}
|
||||
36
lib/controller/local/local_controller.dart
Normal file
36
lib/controller/local/local_controller.dart
Normal file
@@ -0,0 +1,36 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../constant/box_name.dart';
|
||||
import '../../main.dart';
|
||||
import '../themes/themes.dart';
|
||||
|
||||
class LocaleController extends GetxController {
|
||||
Locale? language;
|
||||
|
||||
ThemeData appTheme = themeEnglish;
|
||||
|
||||
changeLang(String langcode) {
|
||||
Locale locale = Locale(langcode);
|
||||
box.write(BoxName.lang, langcode);
|
||||
appTheme = langcode == "ar" ? themeArabic : themeEnglish;
|
||||
Get.changeTheme(appTheme);
|
||||
Get.updateLocale(locale);
|
||||
update();
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
if (box.read(BoxName.lang) == "ar") {
|
||||
language = const Locale("ar");
|
||||
appTheme = themeArabic;
|
||||
} else if (box.read(BoxName.lang) == "en") {
|
||||
language = const Locale("en");
|
||||
appTheme = themeEnglish;
|
||||
} else {
|
||||
language = Locale(Get.deviceLocale!.languageCode);
|
||||
appTheme = themeEnglish;
|
||||
}
|
||||
super.onInit();
|
||||
}
|
||||
}
|
||||
16
lib/controller/local/translations.dart
Normal file
16
lib/controller/local/translations.dart
Normal file
@@ -0,0 +1,16 @@
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class MyTranslation extends Translations {
|
||||
@override
|
||||
Map<String, Map<String, String>> get keys => {
|
||||
"ar": {
|
||||
"Choose Language": "اختر اللغة",
|
||||
},
|
||||
"en": {
|
||||
"Choose Language": "Choose Language",
|
||||
},
|
||||
"tr": {
|
||||
"Choose Language": "Dil seç",
|
||||
},
|
||||
};
|
||||
}
|
||||
49
lib/controller/themes/themes.dart
Normal file
49
lib/controller/themes/themes.dart
Normal file
@@ -0,0 +1,49 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../constant/colors.dart';
|
||||
|
||||
ThemeData themeEnglish = ThemeData(
|
||||
fontFamily: "PlayfairDisplay",
|
||||
textTheme: const TextTheme(
|
||||
displaySmall: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 24,
|
||||
color: AppColor.primaryColor),
|
||||
displayLarge: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 22,
|
||||
color: AppColor.primaryColor),
|
||||
displayMedium: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 26,
|
||||
color: AppColor.primaryColor),
|
||||
bodyLarge: TextStyle(
|
||||
height: 2,
|
||||
color: AppColor.accentColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 14),
|
||||
bodyMedium:
|
||||
TextStyle(height: 2, color: AppColor.accentColor, fontSize: 14)),
|
||||
primarySwatch: Colors.blue,
|
||||
);
|
||||
|
||||
ThemeData themeArabic = ThemeData(
|
||||
fontFamily: "Cairo",
|
||||
textTheme: const TextTheme(
|
||||
displayLarge: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 22,
|
||||
color: AppColor.primaryColor),
|
||||
displayMedium: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 26,
|
||||
color: AppColor.primaryColor),
|
||||
bodyLarge: TextStyle(
|
||||
height: 2,
|
||||
color: AppColor.accentColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 14),
|
||||
bodyMedium:
|
||||
TextStyle(height: 2, color: AppColor.accentColor, fontSize: 14)),
|
||||
primarySwatch: Colors.blue,
|
||||
);
|
||||
83
lib/firebase_options.dart
Normal file
83
lib/firebase_options.dart
Normal file
@@ -0,0 +1,83 @@
|
||||
// File generated by FlutterFire CLI.
|
||||
// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members
|
||||
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
|
||||
import 'package:flutter/foundation.dart'
|
||||
show defaultTargetPlatform, kIsWeb, TargetPlatform;
|
||||
|
||||
/// Default [FirebaseOptions] for use with your Firebase apps.
|
||||
///
|
||||
/// Example:
|
||||
/// ```dart
|
||||
/// import 'firebase_options.dart';
|
||||
/// // ...
|
||||
/// await Firebase.initializeApp(
|
||||
/// options: DefaultFirebaseOptions.currentPlatform,
|
||||
/// );
|
||||
/// ```
|
||||
class DefaultFirebaseOptions {
|
||||
static FirebaseOptions get currentPlatform {
|
||||
if (kIsWeb) {
|
||||
return web;
|
||||
}
|
||||
switch (defaultTargetPlatform) {
|
||||
case TargetPlatform.android:
|
||||
return android;
|
||||
case TargetPlatform.iOS:
|
||||
return ios;
|
||||
case TargetPlatform.macOS:
|
||||
return macos;
|
||||
case TargetPlatform.windows:
|
||||
throw UnsupportedError(
|
||||
'DefaultFirebaseOptions have not been configured for windows - '
|
||||
'you can reconfigure this by running the FlutterFire CLI again.',
|
||||
);
|
||||
case TargetPlatform.linux:
|
||||
throw UnsupportedError(
|
||||
'DefaultFirebaseOptions have not been configured for linux - '
|
||||
'you can reconfigure this by running the FlutterFire CLI again.',
|
||||
);
|
||||
default:
|
||||
throw UnsupportedError(
|
||||
'DefaultFirebaseOptions are not supported for this platform.',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
static const FirebaseOptions web = FirebaseOptions(
|
||||
apiKey: 'AIzaSyAVtyV7YVMeLbwA1UlNPxV9FhCzT0kjeAE',
|
||||
appId: '1:594687661098:web:8fe3c5b3cacb294c595f53',
|
||||
messagingSenderId: '594687661098',
|
||||
projectId: 'ride-b1bd8',
|
||||
authDomain: 'ride-b1bd8.firebaseapp.com',
|
||||
storageBucket: 'ride-b1bd8.appspot.com',
|
||||
measurementId: 'G-7YCWM2EHD9',
|
||||
);
|
||||
|
||||
static const FirebaseOptions android = FirebaseOptions(
|
||||
apiKey: 'AIzaSyCyfwRXTwSTLOFQSQgN5p7QZgGJVZnEKq0',
|
||||
appId: '1:594687661098:android:683982cbf71fa423595f53',
|
||||
messagingSenderId: '594687661098',
|
||||
projectId: 'ride-b1bd8',
|
||||
storageBucket: 'ride-b1bd8.appspot.com',
|
||||
);
|
||||
|
||||
static const FirebaseOptions ios = FirebaseOptions(
|
||||
apiKey: 'AIzaSyCf2mW2h0HD8ZYjwh4VOa2ladw6MJkCDTM',
|
||||
appId: '1:594687661098:ios:6f69eee1449be943595f53',
|
||||
messagingSenderId: '594687661098',
|
||||
projectId: 'ride-b1bd8',
|
||||
storageBucket: 'ride-b1bd8.appspot.com',
|
||||
iosClientId: '594687661098-8e26699cris2k3nj5msj1osi59it9kpf.apps.googleusercontent.com',
|
||||
iosBundleId: 'com.mobileapp.store.ride',
|
||||
);
|
||||
|
||||
static const FirebaseOptions macos = FirebaseOptions(
|
||||
apiKey: 'AIzaSyCf2mW2h0HD8ZYjwh4VOa2ladw6MJkCDTM',
|
||||
appId: '1:594687661098:ios:e8ca02ed508d4737595f53',
|
||||
messagingSenderId: '594687661098',
|
||||
projectId: 'ride-b1bd8',
|
||||
storageBucket: 'ride-b1bd8.appspot.com',
|
||||
iosClientId: '594687661098-od4d3lpsdba79shpjmala0a3lrps4spi.apps.googleusercontent.com',
|
||||
iosBundleId: 'com.mobileapp.store.ride.RunnerTests',
|
||||
);
|
||||
}
|
||||
45
lib/main.dart
Normal file
45
lib/main.dart
Normal file
@@ -0,0 +1,45 @@
|
||||
import 'package:firebase_core/firebase_core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:get_storage/get_storage.dart';
|
||||
import 'package:ride/views/lang/languages.dart';
|
||||
|
||||
import 'constant/box_name.dart';
|
||||
import 'controller/local/local_controller.dart';
|
||||
import 'controller/local/translations.dart';
|
||||
import 'firebase_options.dart';
|
||||
import 'views/home/auth/login_page.dart';
|
||||
|
||||
final box = GetStorage();
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await GetStorage.init();
|
||||
await Firebase.initializeApp(
|
||||
options: DefaultFirebaseOptions.currentPlatform,
|
||||
);
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
|
||||
// This widget is the root of your application.
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
LocaleController controller = Get.put(LocaleController());
|
||||
|
||||
return GetMaterialApp(
|
||||
title: 'Fleek-tech',
|
||||
translations: MyTranslation(),
|
||||
debugShowCheckedModeBanner: false,
|
||||
locale: controller.language,
|
||||
theme: controller.appTheme,
|
||||
key: UniqueKey(),
|
||||
// routes: {'/':const HomePage()},
|
||||
home: box.read(BoxName.lang).toString() != 'ar' &&
|
||||
box.read(BoxName.lang).toString() != 'en'
|
||||
? const Language()
|
||||
: LoginPage());
|
||||
}
|
||||
}
|
||||
59
lib/views/home/auth/login_page.dart
Normal file
59
lib/views/home/auth/login_page.dart
Normal file
@@ -0,0 +1,59 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../controller/auth/login_controller.dart';
|
||||
|
||||
class LoginPage extends StatelessWidget {
|
||||
final controller = Get.put(LoginController());
|
||||
|
||||
LoginPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Login'),
|
||||
),
|
||||
body: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(22),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
TextFormField(
|
||||
controller: controller.emailController,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Email',
|
||||
),
|
||||
),
|
||||
TextFormField(
|
||||
controller: controller.phoneController,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Phone',
|
||||
),
|
||||
),
|
||||
TextFormField(
|
||||
controller: controller.firstNameController,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'First Name',
|
||||
),
|
||||
),
|
||||
TextFormField(
|
||||
controller: controller.lastNameController,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Last Name',
|
||||
),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
controller.login();
|
||||
},
|
||||
child: Text('Login'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
26
lib/views/home/home_page.dart
Normal file
26
lib/views/home/home_page.dart
Normal file
@@ -0,0 +1,26 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:ride/constant/colors.dart';
|
||||
import 'package:ride/constant/style.dart';
|
||||
import 'package:ride/views/widgets/circle_container.dart';
|
||||
|
||||
class HomePage extends StatelessWidget {
|
||||
const HomePage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: AppColor.secondaryColor,
|
||||
appBar: AppBar(
|
||||
elevation: 0,
|
||||
backgroundColor: AppColor.secondaryColor,
|
||||
title: Text(
|
||||
'home',
|
||||
style: AppStyle.title,
|
||||
),
|
||||
),
|
||||
body: Center(
|
||||
child: CircleContainer(child: const Icon(Icons.clear)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
42
lib/views/lang/languages.dart
Normal file
42
lib/views/lang/languages.dart
Normal file
@@ -0,0 +1,42 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||
|
||||
import '../../controller/local/local_controller.dart';
|
||||
import '../home/home_page.dart';
|
||||
|
||||
class Language extends GetView<LocaleController> {
|
||||
const Language({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Center(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(15),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
Text("Choose Language".tr,
|
||||
style: Theme.of(context).textTheme.headlineLarge),
|
||||
const SizedBox(height: 20),
|
||||
MyElevatedButton(
|
||||
title: 'Ar',
|
||||
onPressed: () {
|
||||
controller.changeLang("ar");
|
||||
Get.offAll(() => HomePage());
|
||||
},
|
||||
),
|
||||
MyElevatedButton(
|
||||
title: "En",
|
||||
onPressed: () {
|
||||
controller.changeLang("en");
|
||||
Get.offAll(() => HomePage());
|
||||
},
|
||||
),
|
||||
],
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
62
lib/views/widgets/circle_container.dart
Normal file
62
lib/views/widgets/circle_container.dart
Normal file
@@ -0,0 +1,62 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/constant/colors.dart';
|
||||
|
||||
class CircleContainer extends StatelessWidget {
|
||||
final Widget child;
|
||||
final Color backgroundColor;
|
||||
final Color borderColor;
|
||||
|
||||
CircleContainer({
|
||||
Key? key,
|
||||
required this.child,
|
||||
this.backgroundColor = AppColor.secondaryColor,
|
||||
this.borderColor = AppColor.accentColor,
|
||||
}) : super(key: key);
|
||||
|
||||
final controller = Get.put(CircleController());
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<CircleController>(
|
||||
builder: ((controller) => GestureDetector(
|
||||
onTap: () {
|
||||
controller.changeColor();
|
||||
},
|
||||
child: AnimatedContainer(
|
||||
onEnd: () {
|
||||
controller.onEnd();
|
||||
},
|
||||
duration: const Duration(milliseconds: 300),
|
||||
width: controller.size,
|
||||
height: controller.size,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: controller.backgroundColor,
|
||||
border: Border.all(
|
||||
color: borderColor,
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: Center(child: child),
|
||||
),
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
||||
class CircleController extends GetxController {
|
||||
Color backgroundColor = AppColor.secondaryColor;
|
||||
double size = 40;
|
||||
void changeColor() {
|
||||
backgroundColor = backgroundColor == AppColor.secondaryColor
|
||||
? AppColor.accentColor
|
||||
: AppColor.secondaryColor;
|
||||
size = 60;
|
||||
update();
|
||||
}
|
||||
|
||||
void onEnd() {
|
||||
size = 40;
|
||||
update();
|
||||
}
|
||||
}
|
||||
28
lib/views/widgets/elevated_btn.dart
Normal file
28
lib/views/widgets/elevated_btn.dart
Normal file
@@ -0,0 +1,28 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../constant/colors.dart';
|
||||
|
||||
class MyElevatedButton extends StatelessWidget {
|
||||
final String title;
|
||||
final VoidCallback onPressed;
|
||||
|
||||
const MyElevatedButton({
|
||||
Key? key,
|
||||
required this.title,
|
||||
required this.onPressed,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ElevatedButton(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateProperty.all(AppColor.primaryColor),
|
||||
),
|
||||
onPressed: onPressed,
|
||||
child: Text(
|
||||
title,
|
||||
style: const TextStyle(color: AppColor.accentColor),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user