Compare commits
4 Commits
main
...
Vaibhav_Lo
Author | SHA1 | Date | |
---|---|---|---|
350fe3d9ce | |||
b9e2f72d11 | |||
d6043eb38c | |||
3d28cf9e09 |
1
.gitignore
vendored
@ -9,6 +9,7 @@
|
|||||||
.history
|
.history
|
||||||
.svn/
|
.svn/
|
||||||
migrate_working_dir/
|
migrate_working_dir/
|
||||||
|
android/app/.cxx/
|
||||||
|
|
||||||
# IntelliJ related
|
# IntelliJ related
|
||||||
*.iml
|
*.iml
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# marco
|
# maxdash
|
||||||
|
|
||||||
A new Flutter project.
|
A new Flutter project.
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
namespace = "com.example.marco"
|
namespace = "com.example.maxdash"
|
||||||
compileSdk = flutter.compileSdkVersion
|
compileSdk = flutter.compileSdkVersion
|
||||||
ndkVersion = flutter.ndkVersion
|
ndkVersion = flutter.ndkVersion
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ android {
|
|||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||||
applicationId = "com.example.marco"
|
applicationId = "com.example.maxdash"
|
||||||
// You can update the following values to match your application needs.
|
// You can update the following values to match your application needs.
|
||||||
// For more information, see: https://flutter.dev/to/review-gradle-config.
|
// For more information, see: https://flutter.dev/to/review-gradle-config.
|
||||||
minSdk = flutter.minSdkVersion
|
minSdk = flutter.minSdkVersion
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<application
|
<application
|
||||||
android:label="marco"
|
android:label="Marco"
|
||||||
android:name="${applicationName}"
|
android:name="${applicationName}"
|
||||||
android:icon="@mipmap/ic_launcher">
|
android:icon="@mipmap/ic_launcher">
|
||||||
<activity
|
<activity
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package com.example.marco
|
package com.example.maxdash
|
||||||
|
|
||||||
import io.flutter.embedding.android.FlutterActivity
|
import io.flutter.embedding.android.FlutterActivity
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!-- Modify this file to customize your launch splash screen -->
|
<!-- Modify this file to customize your launch splash screen -->
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item android:drawable="?android:colorBackground" />
|
<!-- <item android:drawable="?android:colorBackground" /> -->
|
||||||
|
|
||||||
<!-- You can insert your own image assets here -->
|
<!-- You can insert your own image assets here -->
|
||||||
<!-- <item>
|
<!-- <item>
|
||||||
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 2.5 KiB |
@ -18,7 +18,7 @@ pluginManagement {
|
|||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
|
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
|
||||||
id "com.android.application" version "8.1.0" apply false
|
id "com.android.application" version "8.2.1" apply false
|
||||||
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
|
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BIN
assets/logo/logo.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 11 KiB |
@ -368,7 +368,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.marco;
|
PRODUCT_BUNDLE_IDENTIFIER = com.example.maxdash;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
@ -384,7 +384,7 @@
|
|||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.0;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.marco.RunnerTests;
|
PRODUCT_BUNDLE_IDENTIFIER = com.example.maxdash.RunnerTests;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
@ -401,7 +401,7 @@
|
|||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.0;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.marco.RunnerTests;
|
PRODUCT_BUNDLE_IDENTIFIER = com.example.maxdash.RunnerTests;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
|
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
|
||||||
@ -416,7 +416,7 @@
|
|||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.0;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.marco.RunnerTests;
|
PRODUCT_BUNDLE_IDENTIFIER = com.example.maxdash.RunnerTests;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
|
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner";
|
||||||
@ -547,7 +547,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.marco;
|
PRODUCT_BUNDLE_IDENTIFIER = com.example.maxdash;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
@ -569,7 +569,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.example.marco;
|
PRODUCT_BUNDLE_IDENTIFIER = com.example.maxdash;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 295 B |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 406 B |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 450 B |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 282 B |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 462 B |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 704 B |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 406 B |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 586 B |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 862 B |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 862 B |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 762 B |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 1.4 KiB |
@ -5,7 +5,7 @@
|
|||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||||
<key>CFBundleDisplayName</key>
|
<key>CFBundleDisplayName</key>
|
||||||
<string>Marco</string>
|
<string>Maxdash</string>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>$(EXECUTABLE_NAME)</string>
|
<string>$(EXECUTABLE_NAME)</string>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
@ -13,7 +13,7 @@
|
|||||||
<key>CFBundleInfoDictionaryVersion</key>
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
<string>6.0</string>
|
<string>6.0</string>
|
||||||
<key>CFBundleName</key>
|
<key>CFBundleName</key>
|
||||||
<string>marco</string>
|
<string>maxdash</string>
|
||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>APPL</string>
|
<string>APPL</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
|
28
lib/api/api_client.dart
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
|
class ApiClient {
|
||||||
|
static final ApiClient instance = ApiClient('http://10.0.2.2:5032/api');
|
||||||
|
final String _baseUrl;
|
||||||
|
|
||||||
|
ApiClient(this._baseUrl);
|
||||||
|
|
||||||
|
Future<http.Response> get(String endpoint) async {
|
||||||
|
final prefs = await SharedPreferences.getInstance();
|
||||||
|
final token = prefs.getString('auth_token');
|
||||||
|
|
||||||
|
if (token == null) {
|
||||||
|
throw Exception('No token found. User might not be logged in.');
|
||||||
|
}
|
||||||
|
|
||||||
|
final url = '$_baseUrl/$endpoint';
|
||||||
|
print("Url received: $url");
|
||||||
|
final headers = {
|
||||||
|
'Authorization': 'Bearer $token',
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
};
|
||||||
|
|
||||||
|
return await http.get(Uri.parse(url), headers: headers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
22
lib/api/api_service.dart
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
import 'package:maxdash/api/api_client.dart';
|
||||||
|
|
||||||
|
class ApiService {
|
||||||
|
final ApiClient _apiClient = ApiClient.instance;
|
||||||
|
|
||||||
|
Future<dynamic> getProjectSummaries() async {
|
||||||
|
try {
|
||||||
|
final response = await _apiClient.get('project/list');
|
||||||
|
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
// print('Response body: ${response.body}'); // Parsed JSON
|
||||||
|
return jsonDecode(response.body);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
throw Exception('Failed to load project summaries: ${response.statusCode}');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
throw Exception('Error in getProjectSummaries: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -8,5 +8,5 @@ class AppConstant {
|
|||||||
static int iOSAppVersion = 1;
|
static int iOSAppVersion = 1;
|
||||||
static String version = "1.0.0";
|
static String version = "1.0.0";
|
||||||
|
|
||||||
static String get appName => 'Marco';
|
static String get appName => 'MaxDash';
|
||||||
}
|
}
|
||||||
|
118
lib/controller/apps/calendar_controller.dart
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
|
import 'package:syncfusion_flutter_calendar/calendar.dart';
|
||||||
|
|
||||||
|
class CalendarController extends MyController {
|
||||||
|
late DataSource events;
|
||||||
|
final List<CalendarView> allowedViews = <CalendarView>[CalendarView.day, CalendarView.week, CalendarView.workWeek, CalendarView.month, CalendarView.schedule];
|
||||||
|
List<Appointment> appointmentCollection = <Appointment>[];
|
||||||
|
DateTime? selectedDate;
|
||||||
|
late Color selectedColor = Colors.red;
|
||||||
|
late TextEditingController titleTE, descriptionTE, locationTE;
|
||||||
|
List<Color> colorCollection = [
|
||||||
|
Colors.red,
|
||||||
|
Colors.blue,
|
||||||
|
Colors.green,
|
||||||
|
Colors.yellow,
|
||||||
|
Colors.pink,
|
||||||
|
Colors.purple,
|
||||||
|
Colors.brown,
|
||||||
|
Colors.orange,
|
||||||
|
Colors.teal,
|
||||||
|
Colors.indigo,
|
||||||
|
];
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
events = addAppointments();
|
||||||
|
selectedColor = colorCollection[0];
|
||||||
|
titleTE = TextEditingController(text: 'Title');
|
||||||
|
descriptionTE = TextEditingController(text: 'Description');
|
||||||
|
locationTE = TextEditingController(text: 'Location');
|
||||||
|
super.onInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void onSelectedColor(value) {
|
||||||
|
selectedColor = value;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
DataSource addAppointments() {
|
||||||
|
final DateTime today = DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day, DateTime.now().hour);
|
||||||
|
|
||||||
|
appointmentCollection
|
||||||
|
.add(Appointment(startTime: today.add(Duration(hours: 2)), endTime: today.add(Duration(hours: 3)), subject: 'Team Sync', color: Colors.blue));
|
||||||
|
|
||||||
|
appointmentCollection.add(Appointment(
|
||||||
|
startTime: today.add(Duration(days: 1, hours: 4)), endTime: today.add(Duration(days: 1, hours: 5)), subject: 'Product Demo', color: Colors.orange));
|
||||||
|
|
||||||
|
appointmentCollection.add(Appointment(
|
||||||
|
startTime: today.add(Duration(days: 2, hours: 6)),
|
||||||
|
endTime: today.add(Duration(days: 2, hours: 7)),
|
||||||
|
subject: 'Conference Call',
|
||||||
|
color: Colors.blueAccent));
|
||||||
|
|
||||||
|
appointmentCollection.add(Appointment(
|
||||||
|
startTime: today.add(Duration(days: 3, hours: 1)), endTime: today.add(Duration(days: 3, hours: 2)), subject: 'Workshop', color: Colors.yellow));
|
||||||
|
|
||||||
|
appointmentCollection.add(Appointment(
|
||||||
|
startTime: today.add(Duration(days: 4, hours: 9)),
|
||||||
|
endTime: today.add(Duration(days: 4, hours: 10)),
|
||||||
|
subject: 'Strategic Planning',
|
||||||
|
color: Colors.purpleAccent));
|
||||||
|
|
||||||
|
return DataSource(appointmentCollection);
|
||||||
|
}
|
||||||
|
|
||||||
|
void dragEnd(AppointmentDragEndDetails appointmentDragEndDetails) {
|
||||||
|
Appointment detail = appointmentDragEndDetails.appointment as Appointment;
|
||||||
|
Duration duration = detail.endTime.difference(detail.startTime);
|
||||||
|
|
||||||
|
DateTime start = DateTime(appointmentDragEndDetails.droppingTime!.year, appointmentDragEndDetails.droppingTime!.month,
|
||||||
|
appointmentDragEndDetails.droppingTime!.day, appointmentDragEndDetails.droppingTime!.hour, 0, 0);
|
||||||
|
|
||||||
|
final List<Appointment> appointment = <Appointment>[];
|
||||||
|
events.appointments!.remove(appointmentDragEndDetails.appointment);
|
||||||
|
|
||||||
|
events.notifyListeners(CalendarDataSourceAction.remove, <dynamic>[appointmentDragEndDetails.appointment]);
|
||||||
|
|
||||||
|
Appointment app = Appointment(
|
||||||
|
subject: detail.subject,
|
||||||
|
color: detail.color,
|
||||||
|
startTime: start,
|
||||||
|
endTime: start.add(duration),
|
||||||
|
);
|
||||||
|
|
||||||
|
appointment.add(app);
|
||||||
|
|
||||||
|
events.appointments!.add(appointment[0]);
|
||||||
|
|
||||||
|
events.notifyListeners(CalendarDataSourceAction.add, appointment);
|
||||||
|
}
|
||||||
|
|
||||||
|
void addEvent() {
|
||||||
|
final DateTime today = selectedDate ?? DateTime.now();
|
||||||
|
Appointment appointment = Appointment(
|
||||||
|
startTime: today,
|
||||||
|
endTime: today.add(Duration(hours: 1)),
|
||||||
|
color: selectedColor,
|
||||||
|
subject: descriptionTE.text,
|
||||||
|
);
|
||||||
|
appointmentCollection.add(appointment);
|
||||||
|
titleTE.clear();
|
||||||
|
descriptionTE.clear();
|
||||||
|
locationTE.clear();
|
||||||
|
events = DataSource(appointmentCollection);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void onSelectDate(CalendarSelectionDetails calendarSelectionDetails) {
|
||||||
|
selectedDate = calendarSelectionDetails.date;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class DataSource extends CalendarDataSource {
|
||||||
|
DataSource(List<Appointment> source) {
|
||||||
|
appointments = source;
|
||||||
|
}
|
||||||
|
}
|
53
lib/controller/apps/chat_controller.dart
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
|
import 'package:maxdash/model/chat_model.dart';
|
||||||
|
|
||||||
|
class ChatController extends MyController {
|
||||||
|
List<ChatModel> chat = [];
|
||||||
|
List<ChatModel> searchChat = [];
|
||||||
|
ChatModel? selectChat;
|
||||||
|
TextEditingController messageController = TextEditingController();
|
||||||
|
ScrollController? scrollController;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
ChatModel.dummyList.then((value) {
|
||||||
|
chat = value;
|
||||||
|
searchChat = value;
|
||||||
|
selectChat = chat[0];
|
||||||
|
update();
|
||||||
|
});
|
||||||
|
scrollController = ScrollController();
|
||||||
|
super.onInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void onChangeChat(ChatModel selectSingleChat) {
|
||||||
|
selectChat = selectSingleChat;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void onSearchChat(String query) {
|
||||||
|
final input = query.toLowerCase();
|
||||||
|
searchChat = chat.where((chat) => chat.firstName.toLowerCase().contains(input) || chat.messages.lastOrNull!.message.toLowerCase().contains(input)).toList();
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void sendMessage() {
|
||||||
|
if (messageController.value.text.isNotEmpty && selectChat != null) {
|
||||||
|
selectChat!.messages.add(ChatMessageModel(-1, messageController.text, DateTime.now(), true, ""));
|
||||||
|
messageController.clear();
|
||||||
|
scrollToBottom(isDelayed: true);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
scrollToBottom({bool isDelayed = false}) {
|
||||||
|
final int delay = isDelayed ? 400 : 0;
|
||||||
|
Future.delayed(Duration(milliseconds: delay), () {
|
||||||
|
scrollController!
|
||||||
|
.animateTo(scrollController!.position.maxScrollExtent, duration: const Duration(milliseconds: 500), curve: Curves.easeInOutCubicEmphasized);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
86
lib/controller/apps/ecommerce/add_product_controller.dart
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
import 'package:file_picker/file_picker.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
|
import 'package:maxdash/helpers/widgets/my_form_validator.dart';
|
||||||
|
|
||||||
|
enum Status {
|
||||||
|
online,
|
||||||
|
offline,
|
||||||
|
draft;
|
||||||
|
|
||||||
|
const Status();
|
||||||
|
}
|
||||||
|
|
||||||
|
enum Category {
|
||||||
|
fashion,
|
||||||
|
grocery,
|
||||||
|
vegetables,
|
||||||
|
fruits,
|
||||||
|
electronics,
|
||||||
|
kids;
|
||||||
|
|
||||||
|
const Category();
|
||||||
|
}
|
||||||
|
|
||||||
|
class AddProductController extends MyController {
|
||||||
|
List<PlatformFile> files = [];
|
||||||
|
MyFormValidator basicValidator = MyFormValidator();
|
||||||
|
Status selectedGender = Status.online;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
super.onInit();
|
||||||
|
basicValidator.addField(
|
||||||
|
'name',
|
||||||
|
label: "Product Name",
|
||||||
|
required: true,
|
||||||
|
controller: TextEditingController(),
|
||||||
|
);
|
||||||
|
basicValidator.addField(
|
||||||
|
'shop_name',
|
||||||
|
label: "shop_name",
|
||||||
|
required: true,
|
||||||
|
controller: TextEditingController(),
|
||||||
|
);
|
||||||
|
basicValidator.addField(
|
||||||
|
'description',
|
||||||
|
label: "description",
|
||||||
|
required: true,
|
||||||
|
controller: TextEditingController(),
|
||||||
|
);
|
||||||
|
basicValidator.addField(
|
||||||
|
'tags',
|
||||||
|
label: "Tags",
|
||||||
|
required: true,
|
||||||
|
controller: TextEditingController(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool showOnline = true;
|
||||||
|
|
||||||
|
void setOnlineType(bool value) {
|
||||||
|
showOnline = value;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
final List<String> categories = [];
|
||||||
|
|
||||||
|
void onChangeGender(Status? value) {
|
||||||
|
selectedGender = value ?? selectedGender;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> pickFile() async {
|
||||||
|
var result = await FilePicker.platform.pickFiles();
|
||||||
|
if (result?.files[0] != null) {
|
||||||
|
files.add(result!.files[0]);
|
||||||
|
}
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void removeFile(PlatformFile file) {
|
||||||
|
files.remove(file);
|
||||||
|
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
20
lib/controller/apps/ecommerce/customer_controller.dart
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
|
import 'package:maxdash/model/customer.dart';
|
||||||
|
|
||||||
|
class CustomerController extends MyController {
|
||||||
|
List<Customer> customers = [];
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
super.onInit();
|
||||||
|
Customer.dummyList.then((value) {
|
||||||
|
customers = value;
|
||||||
|
update();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void goToDashboard() {
|
||||||
|
Get.toNamed('/dashboard/ecommerce');
|
||||||
|
}
|
||||||
|
}
|
20
lib/controller/apps/ecommerce/product_controller.dart
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import 'package:get/get.dart';
|
||||||
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
|
import 'package:maxdash/model/product_model.dart';
|
||||||
|
|
||||||
|
class ProductController extends MyController {
|
||||||
|
List<Product> product = [];
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
Product.dummyList.then((value) {
|
||||||
|
product = value;
|
||||||
|
update();
|
||||||
|
});
|
||||||
|
super.onInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void createProduct() {
|
||||||
|
Get.toNamed('/app/ecommerce/add_product');
|
||||||
|
}
|
||||||
|
}
|
79
lib/controller/apps/ecommerce/product_detail_controller.dart
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
|
|
||||||
|
class ProductDetailController extends MyController {
|
||||||
|
String selectedImage = "assets/dummy/single_product/single_product_1.png";
|
||||||
|
|
||||||
|
final Map<String, dynamic> product = {
|
||||||
|
"product_id": "12345",
|
||||||
|
"name": "Slim Fit Denim Jacket",
|
||||||
|
"description": "A stylish slim fit denim jacket for men. Perfect for casual outings and layering.",
|
||||||
|
"category": "Jackets",
|
||||||
|
"brand": "DenimCo",
|
||||||
|
"size": [
|
||||||
|
"S",
|
||||||
|
"M",
|
||||||
|
"L",
|
||||||
|
"XL",
|
||||||
|
],
|
||||||
|
"color": [
|
||||||
|
"Blue",
|
||||||
|
"Black",
|
||||||
|
"Grey",
|
||||||
|
],
|
||||||
|
"material": "Denim (100% Cotton)",
|
||||||
|
"price": 59.99,
|
||||||
|
"currency": "USD",
|
||||||
|
"available_stock": {
|
||||||
|
"S": 15,
|
||||||
|
"M": 20,
|
||||||
|
"L": 10,
|
||||||
|
"XL": 5,
|
||||||
|
},
|
||||||
|
"images": [
|
||||||
|
"assets/dummy/single_product/single_product_1.png",
|
||||||
|
"assets/dummy/single_product/single_product_2.png",
|
||||||
|
"assets/dummy/single_product/single_product_3.png",
|
||||||
|
"assets/dummy/single_product/single_product_4.png",
|
||||||
|
"assets/dummy/single_product/single_product_5.png",
|
||||||
|
"assets/dummy/single_product/single_product_6.png",
|
||||||
|
],
|
||||||
|
"rating": 4.5,
|
||||||
|
"reviews": [
|
||||||
|
{
|
||||||
|
"user": "john_doe",
|
||||||
|
"rating": 5,
|
||||||
|
"comment": "Great fit and quality! Really happy with this jacket.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"user": "jane_smith",
|
||||||
|
"rating": 4,
|
||||||
|
"comment": "Good jacket but I wish it came in a larger size.",
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"release_date": "2024-09-15",
|
||||||
|
"shipping_details": {
|
||||||
|
"weight": "1.2 kg",
|
||||||
|
"dimensions": "40 x 30 x 5 cm",
|
||||||
|
"shipping_cost": 4.99,
|
||||||
|
"delivery_time": "3-5 business days",
|
||||||
|
},
|
||||||
|
"discounts": {
|
||||||
|
"current_discount": 10,
|
||||||
|
"discount_type": "percentage",
|
||||||
|
"start_date": "2024-11-01",
|
||||||
|
"end_date": "2024-11-30",
|
||||||
|
},
|
||||||
|
"tags": [
|
||||||
|
"Casual",
|
||||||
|
"Men",
|
||||||
|
"Slim Fit",
|
||||||
|
"Denim",
|
||||||
|
"Jacket",
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
void onChangeImage(String image) {
|
||||||
|
selectedImage = image;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
19
lib/controller/apps/file_manager_controller.dart
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import 'package:flutter_lucide/flutter_lucide.dart';
|
||||||
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
|
|
||||||
|
class FileManagerController extends MyController {
|
||||||
|
List<Map<String, dynamic>> indexFiles = [
|
||||||
|
{"name": "Documents", "icon": LucideIcons.folder},
|
||||||
|
{"name": "Photos", "icon": LucideIcons.image},
|
||||||
|
{"name": "Videos", "icon": LucideIcons.video},
|
||||||
|
{"name": "Shared", "icon": LucideIcons.users},
|
||||||
|
{"name": "Downloads", "icon": LucideIcons.download},
|
||||||
|
{"name": "Trash", "icon": LucideIcons.trash_2},
|
||||||
|
{"name": "Music", "icon": LucideIcons.music},
|
||||||
|
{"name": "Projects", "icon": LucideIcons.briefcase},
|
||||||
|
{"name": "Archives", "icon": LucideIcons.archive},
|
||||||
|
{"name": "Receipts", "icon": LucideIcons.file_text},
|
||||||
|
{"name": "Favorites", "icon": LucideIcons.star},
|
||||||
|
{"name": "Notes", "icon": LucideIcons.file_text}
|
||||||
|
];
|
||||||
|
}
|
75
lib/controller/apps/kan_ban_board_cotnroller.dart
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
import 'package:appflowy_board/appflowy_board.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
|
import 'package:maxdash/images.dart';
|
||||||
|
|
||||||
|
class KanBanBoardController extends MyController {
|
||||||
|
final AppFlowyBoardController boardData = AppFlowyBoardController(
|
||||||
|
onMoveGroup: (fromGroupId, fromIndex, toGroupId, toIndex) {
|
||||||
|
debugPrint('Move item from $fromIndex to $toIndex');
|
||||||
|
},
|
||||||
|
onMoveGroupItem: (groupId, fromIndex, toIndex) {
|
||||||
|
debugPrint('Move $groupId:$fromIndex to $groupId:$toIndex');
|
||||||
|
},
|
||||||
|
onMoveGroupItemToGroup: (fromGroupId, fromIndex, toGroupId, toIndex) {
|
||||||
|
debugPrint('Move $fromGroupId:$fromIndex to $toGroupId:$toIndex');
|
||||||
|
},
|
||||||
|
);
|
||||||
|
late AppFlowyBoardScrollController boardController;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void onInit() {
|
||||||
|
super.onInit();
|
||||||
|
final group1 = AppFlowyGroupData(
|
||||||
|
id: "Pending",
|
||||||
|
items: [
|
||||||
|
TextItem("10 Oct 2024", "Update Home Page UI", "Alice", Images.avatars[0]),
|
||||||
|
TextItem("12 Oct 2024", "Create Product Feature List", "Bob", Images.avatars[1]),
|
||||||
|
TextItem("15 Oct 2024", "Design Login Flow", "Clara", Images.avatars[2]),
|
||||||
|
],
|
||||||
|
name: 'Pending',
|
||||||
|
);
|
||||||
|
|
||||||
|
final group2 = AppFlowyGroupData(
|
||||||
|
id: "Ongoing",
|
||||||
|
items: [
|
||||||
|
TextItem("5 Nov 2024", "Refactor API Endpoints", "Daniel", Images.avatars[3]),
|
||||||
|
TextItem("10 Nov 2024", "Implement Push Notifications", "Eva", Images.avatars[4]),
|
||||||
|
],
|
||||||
|
name: 'Ongoing',
|
||||||
|
);
|
||||||
|
|
||||||
|
final group3 = AppFlowyGroupData(
|
||||||
|
id: "Completed",
|
||||||
|
items: [
|
||||||
|
TextItem("3 Oct 2024", "Develop Admin Dashboard", "Felix", Images.avatars[5]),
|
||||||
|
TextItem("8 Oct 2024", "Setup Continuous Integration", "Grace", Images.avatars[6]),
|
||||||
|
TextItem("14 Oct 2024", "Design Mobile App Icons", "Harry", Images.avatars[7]),
|
||||||
|
TextItem("18 Oct 2024", "Create User Guide", "Ivy", Images.avatars[8]),
|
||||||
|
],
|
||||||
|
name: 'Completed',
|
||||||
|
);
|
||||||
|
|
||||||
|
final group4 = AppFlowyGroupData(
|
||||||
|
id: "On Hold",
|
||||||
|
items: [
|
||||||
|
TextItem("1 Nov 2024", "Design Marketing Website", "Jack", Images.avatars[9]),
|
||||||
|
],
|
||||||
|
name: 'On Hold',
|
||||||
|
);
|
||||||
|
|
||||||
|
boardData.addGroup(group1);
|
||||||
|
boardData.addGroup(group2);
|
||||||
|
boardData.addGroup(group3);
|
||||||
|
boardData.addGroup(group4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class TextItem extends AppFlowyGroupItem {
|
||||||
|
final String date, title, name, image;
|
||||||
|
|
||||||
|
TextItem(this.date, this.title, this.name, this.image);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String get id => title;
|
||||||
|
}
|
@ -1,9 +1,9 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:marco/controller/my_controller.dart';
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
import 'package:marco/helpers/services/auth_service.dart';
|
import 'package:maxdash/helpers/services/auth_service.dart';
|
||||||
import 'package:marco/helpers/widgets/my_form_validator.dart';
|
import 'package:maxdash/helpers/widgets/my_form_validator.dart';
|
||||||
import 'package:marco/helpers/widgets/my_validators.dart';
|
import 'package:maxdash/helpers/widgets/my_validators.dart';
|
||||||
|
|
||||||
class ForgotPasswordController extends MyController {
|
class ForgotPasswordController extends MyController {
|
||||||
MyFormValidator basicValidator = MyFormValidator();
|
MyFormValidator basicValidator = MyFormValidator();
|
||||||
|
@ -1,54 +1,24 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:marco/controller/my_controller.dart';
|
import 'package:maxdash/helpers/services/auth_service.dart';
|
||||||
import 'package:marco/helpers/services/auth_service.dart';
|
import 'package:maxdash/helpers/widgets/my_form_validator.dart';
|
||||||
import 'package:marco/helpers/widgets/my_form_validator.dart';
|
|
||||||
import 'package:marco/helpers/widgets/my_validators.dart';
|
|
||||||
|
|
||||||
class LoginController extends MyController {
|
class LoginController extends GetxController {
|
||||||
MyFormValidator basicValidator = MyFormValidator();
|
MyFormValidator basicValidator = MyFormValidator();
|
||||||
|
|
||||||
bool showPassword = false, isChecked = false;
|
bool showPassword = false;
|
||||||
|
|
||||||
final String _dummyEmail = "demo@example.com";
|
|
||||||
final String _dummyPassword = "1234567";
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
basicValidator.addField('email', required: true, label: "Email", validators: [MyEmailValidator()], controller: TextEditingController(text: _dummyEmail));
|
basicValidator.addField('username', required: true, label: "Username", controller: TextEditingController());
|
||||||
|
basicValidator.addField('password', required: true, label: "Password", controller: TextEditingController());
|
||||||
basicValidator.addField('password',
|
|
||||||
required: true, label: "Password", validators: [MyLengthValidator(min: 6, max: 10)], controller: TextEditingController(text: _dummyPassword));
|
|
||||||
|
|
||||||
super.onInit();
|
super.onInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onChangeCheckBox(bool? value) {
|
|
||||||
isChecked = value ?? isChecked;
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void onChangeShowPassword() {
|
void onChangeShowPassword() {
|
||||||
showPassword = !showPassword;
|
showPassword = !showPassword;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> onLogin() async {
|
|
||||||
if (basicValidator.validateForm()) {
|
|
||||||
update();
|
|
||||||
var errors = await AuthService.loginUser(basicValidator.getData());
|
|
||||||
if (errors != null) {
|
|
||||||
basicValidator.addErrors(errors);
|
|
||||||
basicValidator.validateForm();
|
|
||||||
basicValidator.clearErrors();
|
|
||||||
} else {
|
|
||||||
String nextUrl = Uri.parse(ModalRoute.of(Get.context!)?.settings.name ?? "").queryParameters['next'] ?? "/home";
|
|
||||||
Get.toNamed(nextUrl);
|
|
||||||
}
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void goToForgotPassword() {
|
void goToForgotPassword() {
|
||||||
Get.toNamed('/auth/forgot_password');
|
Get.toNamed('/auth/forgot_password');
|
||||||
}
|
}
|
||||||
@ -56,4 +26,47 @@ class LoginController extends MyController {
|
|||||||
void gotoRegister() {
|
void gotoRegister() {
|
||||||
Get.offAndToNamed('/auth/register_account');
|
Get.offAndToNamed('/auth/register_account');
|
||||||
}
|
}
|
||||||
|
Future<void> onLogin() async {
|
||||||
|
if (basicValidator.validateForm()) {
|
||||||
|
final data = basicValidator.getData();
|
||||||
|
|
||||||
|
// Log the data being sent
|
||||||
|
print('Sending login request with data: $data');
|
||||||
|
|
||||||
|
// Show a loading dialog
|
||||||
|
Get.dialog(
|
||||||
|
Center(child: CircularProgressIndicator()),
|
||||||
|
barrierDismissible: false,
|
||||||
|
);
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Call the AuthService to perform the login
|
||||||
|
final errors = await AuthService.loginUser(data);
|
||||||
|
print('Login errors: $errors');
|
||||||
|
|
||||||
|
// Close the loading dialog
|
||||||
|
Get.back();
|
||||||
|
|
||||||
|
if (errors != null) {
|
||||||
|
// Display errors if login fails
|
||||||
|
print('Login failed with errors: $errors');
|
||||||
|
basicValidator.addErrors(errors);
|
||||||
|
basicValidator.validateForm();
|
||||||
|
basicValidator.clearErrors();
|
||||||
|
} else {
|
||||||
|
// Navigate to the home screen on successful login
|
||||||
|
print('Login successful. Navigating to home...');
|
||||||
|
Get.offAllNamed('/home');
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// Close the loading dialog in case of an exception
|
||||||
|
Get.back();
|
||||||
|
|
||||||
|
// Show a generic error message
|
||||||
|
print('Unexpected error: $e');
|
||||||
|
Get.snackbar('Error', 'An unexpected error occurred. Please try again.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
@ -1,10 +1,10 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:marco/controller/my_controller.dart';
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
import 'package:marco/helpers/widgets/my_form_validator.dart';
|
import 'package:maxdash/helpers/widgets/my_form_validator.dart';
|
||||||
import 'package:marco/helpers/widgets/my_validators.dart';
|
import 'package:maxdash/helpers/widgets/my_validators.dart';
|
||||||
|
|
||||||
import 'package:marco/helpers/services/auth_service.dart';
|
import 'package:maxdash/helpers/services/auth_service.dart';
|
||||||
|
|
||||||
class RegisterAccountController extends MyController {
|
class RegisterAccountController extends MyController {
|
||||||
MyFormValidator basicValidator = MyFormValidator();
|
MyFormValidator basicValidator = MyFormValidator();
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:marco/controller/my_controller.dart';
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
import 'package:marco/helpers/services/auth_service.dart';
|
import 'package:maxdash/helpers/services/auth_service.dart';
|
||||||
import 'package:marco/helpers/widgets/my_form_validator.dart';
|
import 'package:maxdash/helpers/widgets/my_form_validator.dart';
|
||||||
import 'package:marco/helpers/widgets/my_validators.dart';
|
import 'package:maxdash/helpers/widgets/my_validators.dart';
|
||||||
|
|
||||||
class ResetPasswordController extends MyController {
|
class ResetPasswordController extends MyController {
|
||||||
MyFormValidator basicValidator = MyFormValidator();
|
MyFormValidator basicValidator = MyFormValidator();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import 'package:marco/controller/my_controller.dart';
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
import 'package:marco/model/chart_model.dart';
|
import 'package:maxdash/model/chart_model.dart';
|
||||||
import 'package:marco/model/visitor_by_channels_model.dart';
|
import 'package:maxdash/model/visitor_by_channels_model.dart';
|
||||||
import 'package:syncfusion_flutter_charts/charts.dart';
|
import 'package:syncfusion_flutter_charts/charts.dart';
|
||||||
|
|
||||||
class AnalyticsController extends MyController {
|
class AnalyticsController extends MyController {
|
||||||
|
@ -1,42 +0,0 @@
|
|||||||
import 'package:marco/controller/my_controller.dart';
|
|
||||||
import 'package:marco/helpers/widgets/my_text_utils.dart';
|
|
||||||
import 'package:marco/model/chart_model.dart';
|
|
||||||
import 'package:marco/model/job_recent_application_model.dart';
|
|
||||||
import 'package:syncfusion_flutter_charts/charts.dart';
|
|
||||||
|
|
||||||
class AttendanceController extends MyController {
|
|
||||||
int isSelectedListingPerformanceTime = 0;
|
|
||||||
List<ChartSampleData>? chartData;
|
|
||||||
TooltipBehavior? columnToolTip;
|
|
||||||
List<JobRecentApplicationModel> recentApplication = [];
|
|
||||||
List<String> dummyTexts = List.generate(12, (index) => MyTextUtils.getDummyText(60));
|
|
||||||
|
|
||||||
@override
|
|
||||||
void onInit() {
|
|
||||||
chartData = <ChartSampleData>[
|
|
||||||
ChartSampleData(x: 'Jan', y: 4, secondSeriesYValue: 8),
|
|
||||||
ChartSampleData(x: 'Feb', y: 9, secondSeriesYValue: 7),
|
|
||||||
ChartSampleData(x: 'Mar', y: 6, secondSeriesYValue: 5),
|
|
||||||
ChartSampleData(x: 'Apr', y: 8, secondSeriesYValue: 3),
|
|
||||||
ChartSampleData(x: 'May', y: 7, secondSeriesYValue: 9),
|
|
||||||
ChartSampleData(x: 'Jun', y: 10, secondSeriesYValue: 6),
|
|
||||||
ChartSampleData(x: 'Jul', y: 5, secondSeriesYValue: 4),
|
|
||||||
ChartSampleData(x: 'Aug', y: 3, secondSeriesYValue: 2),
|
|
||||||
ChartSampleData(x: 'Sep', y: 6, secondSeriesYValue: 10),
|
|
||||||
ChartSampleData(x: 'Oct', y: 4, secondSeriesYValue: 8),
|
|
||||||
ChartSampleData(x: 'Nov', y: 9, secondSeriesYValue: 6),
|
|
||||||
ChartSampleData(x: 'Dec', y: 7, secondSeriesYValue: 5),
|
|
||||||
];
|
|
||||||
columnToolTip = TooltipBehavior(enable: true);
|
|
||||||
JobRecentApplicationModel.dummyList.then((value) {
|
|
||||||
recentApplication = value.sublist(0, 5);
|
|
||||||
update();
|
|
||||||
});
|
|
||||||
super.onInit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void onSelectListingPerformanceTimeToggle(index) {
|
|
||||||
isSelectedListingPerformanceTime = index;
|
|
||||||
update();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,6 @@
|
|||||||
import 'package:marco/controller/my_controller.dart';
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
import 'package:marco/model/chart_model.dart';
|
import 'package:maxdash/model/chart_model.dart';
|
||||||
import 'package:marco/model/lead_report_model.dart';
|
import 'package:maxdash/model/lead_report_model.dart';
|
||||||
import 'package:syncfusion_flutter_charts/charts.dart';
|
import 'package:syncfusion_flutter_charts/charts.dart';
|
||||||
|
|
||||||
class CrmController extends MyController {
|
class CrmController extends MyController {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import 'package:marco/controller/my_controller.dart';
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
import 'package:marco/model/chart_model.dart';
|
import 'package:maxdash/model/chart_model.dart';
|
||||||
import 'package:marco/model/coin_growth_model.dart';
|
import 'package:maxdash/model/coin_growth_model.dart';
|
||||||
import 'package:syncfusion_flutter_charts/charts.dart';
|
import 'package:syncfusion_flutter_charts/charts.dart';
|
||||||
|
|
||||||
class CryptoController extends MyController {
|
class CryptoController extends MyController {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:marco/controller/my_controller.dart';
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
import 'package:marco/model/chart_model.dart';
|
import 'package:maxdash/model/chart_model.dart';
|
||||||
import 'package:marco/model/product_order_modal.dart';
|
import 'package:maxdash/model/product_order_modal.dart';
|
||||||
import 'package:syncfusion_flutter_charts/charts.dart';
|
import 'package:syncfusion_flutter_charts/charts.dart';
|
||||||
|
|
||||||
class EcommerceController extends MyController {
|
class EcommerceController extends MyController {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'package:marco/controller/my_controller.dart';
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
import 'package:marco/helpers/widgets/my_text_utils.dart';
|
import 'package:maxdash/helpers/widgets/my_text_utils.dart';
|
||||||
import 'package:marco/model/chart_model.dart';
|
import 'package:maxdash/model/chart_model.dart';
|
||||||
import 'package:marco/model/job_recent_application_model.dart';
|
import 'package:maxdash/model/job_recent_application_model.dart';
|
||||||
import 'package:syncfusion_flutter_charts/charts.dart';
|
import 'package:syncfusion_flutter_charts/charts.dart';
|
||||||
|
|
||||||
class JobController extends MyController {
|
class JobController extends MyController {
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
import 'package:marco/controller/my_controller.dart';
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
import 'package:marco/model/chart_model.dart';
|
import 'package:maxdash/model/chart_model.dart';
|
||||||
import 'package:marco/model/project_summary_model.dart';
|
import 'package:maxdash/model/project_summary_model.dart';
|
||||||
import 'package:marco/model/task_list_model.dart';
|
import 'package:maxdash/model/task_list_model.dart';
|
||||||
|
import 'package:maxdash/model/ProjectSummaryApiModel.dart';
|
||||||
|
import 'package:maxdash/api/api_service.dart';
|
||||||
import 'package:syncfusion_flutter_charts/charts.dart';
|
import 'package:syncfusion_flutter_charts/charts.dart';
|
||||||
|
|
||||||
class ProjectController extends MyController {
|
class ProjectController extends MyController {
|
||||||
TooltipBehavior? tooltipBehavior;
|
TooltipBehavior? tooltipBehavior;
|
||||||
List<TaskListModel> task = [];
|
List<TaskListModel> task = [];
|
||||||
List<ProjectSummaryModel> projectSummary = [];
|
List<ProjectSummaryModel> projectSummary = []; // Dummy data (local)
|
||||||
|
List<ProjectSummaryApiModel> projectSummaryApiList = []; // API data
|
||||||
List<ChartSampleData>? chartData;
|
List<ChartSampleData>? chartData;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -20,6 +23,11 @@ class ProjectController extends MyController {
|
|||||||
projectSummary = value.sublist(0, 5);
|
projectSummary = value.sublist(0, 5);
|
||||||
update();
|
update();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Fetch project summary from API
|
||||||
|
fetchProjectSummariesFromApi();
|
||||||
|
|
||||||
|
// Dummy chart data
|
||||||
chartData = <ChartSampleData>[
|
chartData = <ChartSampleData>[
|
||||||
ChartSampleData(x: 'Jan', y: 10, secondSeriesYValue: 8, thirdSeriesYValue: 12),
|
ChartSampleData(x: 'Jan', y: 10, secondSeriesYValue: 8, thirdSeriesYValue: 12),
|
||||||
ChartSampleData(x: 'Feb', y: 5, secondSeriesYValue: 6, thirdSeriesYValue: 7),
|
ChartSampleData(x: 'Feb', y: 5, secondSeriesYValue: 6, thirdSeriesYValue: 7),
|
||||||
@ -43,4 +51,19 @@ class ProjectController extends MyController {
|
|||||||
task.isSelectTask = !task.isSelectTask;
|
task.isSelectTask = !task.isSelectTask;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> fetchProjectSummariesFromApi() async {
|
||||||
|
try {
|
||||||
|
final response = await ApiService().getProjectSummaries();
|
||||||
|
|
||||||
|
if (response != null && response is List) {
|
||||||
|
projectSummaryApiList = response
|
||||||
|
.map<ProjectSummaryApiModel>((json) => ProjectSummaryApiModel.fromJson(json))
|
||||||
|
.toList();
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
print('Error loading API project summaries: $e');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import 'package:marco/controller/my_controller.dart';
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
import 'package:marco/model/chart_model.dart';
|
import 'package:maxdash/model/chart_model.dart';
|
||||||
import 'package:marco/model/recent_order_model.dart';
|
import 'package:maxdash/model/recent_order_model.dart';
|
||||||
import 'package:syncfusion_flutter_charts/charts.dart';
|
import 'package:syncfusion_flutter_charts/charts.dart';
|
||||||
|
|
||||||
class SalesController extends MyController {
|
class SalesController extends MyController {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:marco/controller/my_controller.dart';
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
|
|
||||||
class ComingSoonController extends MyController {
|
class ComingSoonController extends MyController {
|
||||||
Timer? countdownTimer;
|
Timer? countdownTimer;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:marco/controller/my_controller.dart';
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
|
|
||||||
class Error404Controller extends MyController {
|
class Error404Controller extends MyController {
|
||||||
void goToDashboardScreen() {
|
void goToDashboardScreen() {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:marco/controller/my_controller.dart';
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
|
|
||||||
class Error500Controller extends MyController {
|
class Error500Controller extends MyController {
|
||||||
void goToDashboardScreen() {
|
void goToDashboardScreen() {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import 'package:marco/controller/my_controller.dart';
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
import 'package:marco/helpers/widgets/my_text_utils.dart';
|
import 'package:maxdash/helpers/widgets/my_text_utils.dart';
|
||||||
|
|
||||||
class FaqsController extends MyController {
|
class FaqsController extends MyController {
|
||||||
final List<bool> dataExpansionPanel = [true, false, false, false, false, false];
|
final List<bool> dataExpansionPanel = [true, false, false, false, false, false];
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import 'package:marco/controller/my_controller.dart';
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
|
|
||||||
class PricingController extends MyController {
|
class PricingController extends MyController {
|
||||||
bool isMonth = false;
|
bool isMonth = false;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import 'package:marco/controller/my_controller.dart';
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
import 'package:marco/helpers/widgets/my_text_utils.dart';
|
import 'package:maxdash/helpers/widgets/my_text_utils.dart';
|
||||||
import 'package:marco/model/time_line.dart';
|
import 'package:maxdash/model/time_line.dart';
|
||||||
|
|
||||||
class TimeLineController extends MyController {
|
class TimeLineController extends MyController {
|
||||||
List<TimeLineModel> timeline = [];
|
List<TimeLineModel> timeline = [];
|
||||||
|
157
lib/controller/forms/basic_input_controller.dart
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
|
import 'package:maxdash/helpers/extensions/date_time_extension.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
enum Gender {
|
||||||
|
male,
|
||||||
|
female,
|
||||||
|
none;
|
||||||
|
|
||||||
|
const Gender();
|
||||||
|
}
|
||||||
|
|
||||||
|
enum TextFieldBorderType { outline, underline, none }
|
||||||
|
|
||||||
|
class BasicInputController extends MyController {
|
||||||
|
bool filled = false;
|
||||||
|
bool disabled = true;
|
||||||
|
bool readOnly = false;
|
||||||
|
bool helperText = false;
|
||||||
|
bool pilled = false;
|
||||||
|
bool inlineText = false;
|
||||||
|
bool prefixIcon = false;
|
||||||
|
bool suffixIcon = false;
|
||||||
|
|
||||||
|
FloatingLabelBehavior floatingLabelBehavior = FloatingLabelBehavior.always;
|
||||||
|
TextFieldBorderType borderType = TextFieldBorderType.outline;
|
||||||
|
|
||||||
|
DateTime? selectedDate;
|
||||||
|
TimeOfDay? selectedTime;
|
||||||
|
DateTimeRange? selectedDateTimeRange;
|
||||||
|
DateTime? selectedDateTime;
|
||||||
|
|
||||||
|
Gender selectedGender = Gender.male;
|
||||||
|
|
||||||
|
void onChangeLabelType(FloatingLabelBehavior value) {
|
||||||
|
floatingLabelBehavior = value;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
OutlineInputBorder? get inputBorder {
|
||||||
|
if (borderType == TextFieldBorderType.underline) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (borderType == TextFieldBorderType.none) {
|
||||||
|
return OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(pilled ? 30 : 8)),
|
||||||
|
borderSide: BorderSide.none);
|
||||||
|
}
|
||||||
|
return OutlineInputBorder(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(pilled ? 30 : 8)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void onChangedFilledChecked(bool? value) {
|
||||||
|
filled = value ?? filled;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void onChangedDisabledChecked(bool? value) {
|
||||||
|
disabled = value ?? disabled;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void onChangedReadOnlyChecked(bool? value) {
|
||||||
|
readOnly = value ?? readOnly;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void onChangedHelperTextChecked(bool? value) {
|
||||||
|
helperText = value ?? helperText;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void onChangedPilledChecked(bool? value) {
|
||||||
|
pilled = value ?? pilled;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void onChangedInlineTextChecked(bool? value) {
|
||||||
|
inlineText = value ?? inlineText;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void onChangedPrefixIconChecked(bool? value) {
|
||||||
|
prefixIcon = value ?? prefixIcon;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void onChangedSuffixIconChecked(bool? value) {
|
||||||
|
suffixIcon = value ?? suffixIcon;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void onChangeBorderType(TextFieldBorderType value) {
|
||||||
|
borderType = value;
|
||||||
|
if (borderType == TextFieldBorderType.none) {
|
||||||
|
filled = true;
|
||||||
|
}
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> pickDate() async {
|
||||||
|
final DateTime? picked = await showDatePicker(
|
||||||
|
context: Get.context!,
|
||||||
|
initialDate: selectedDate ?? DateTime.now(),
|
||||||
|
firstDate: DateTime(2015, 8),
|
||||||
|
lastDate: DateTime(2101));
|
||||||
|
if (picked != null && picked != selectedDate) {
|
||||||
|
selectedDate = picked;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> pickTime() async {
|
||||||
|
final TimeOfDay? picked = await showTimePicker(
|
||||||
|
context: Get.context!, initialTime: selectedTime ?? TimeOfDay.now());
|
||||||
|
if (picked != null && picked != selectedTime) {
|
||||||
|
selectedTime = picked;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> pickDateRange() async {
|
||||||
|
final DateTimeRange? picked = await showDateRangePicker(
|
||||||
|
context: Get.context!,
|
||||||
|
initialEntryMode: DatePickerEntryMode.input,
|
||||||
|
firstDate: DateTime(2015, 8),
|
||||||
|
lastDate: DateTime(2101));
|
||||||
|
if (picked != null && picked != selectedDateTimeRange) {
|
||||||
|
selectedDateTimeRange = picked;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> pickDateTime() async {
|
||||||
|
final DateTime? pickedDate = await showDatePicker(
|
||||||
|
context: Get.context!,
|
||||||
|
initialDate: selectedDate ?? DateTime.now(),
|
||||||
|
firstDate: DateTime(2015, 8),
|
||||||
|
lastDate: DateTime(2101));
|
||||||
|
if (pickedDate != null) {
|
||||||
|
final TimeOfDay? pickedTime = await showTimePicker(
|
||||||
|
context: Get.context!, initialTime: selectedTime ?? TimeOfDay.now());
|
||||||
|
if (pickedTime != null) {
|
||||||
|
selectedDateTime = pickedDate.applied(pickedTime);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void onChangeGender(Gender? value) {
|
||||||
|
selectedGender = value ?? selectedGender;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
39
lib/controller/forms/custom_option_controller.dart
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
|
import 'package:maxdash/helpers/widgets/my_text_utils.dart';
|
||||||
|
|
||||||
|
enum Gender {
|
||||||
|
male,
|
||||||
|
female,
|
||||||
|
none;
|
||||||
|
|
||||||
|
const Gender();
|
||||||
|
}
|
||||||
|
|
||||||
|
class CustomOptionController extends MyController {
|
||||||
|
int selectRadioButton = 0;
|
||||||
|
int customRadioButton = 0;
|
||||||
|
int customImageRadioButton = 0;
|
||||||
|
Gender selectedGender = Gender.male;
|
||||||
|
List<String> dummyTexts = List.generate(
|
||||||
|
12, (index) => MyTextUtils.getDummyText(60, withEmoji: true));
|
||||||
|
|
||||||
|
void onChangeCustomButton(id) {
|
||||||
|
customRadioButton = id ?? customRadioButton;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void onChangeCustomImageRadioButton(id) {
|
||||||
|
customImageRadioButton = id ?? customImageRadioButton;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void onSelectButton(id) {
|
||||||
|
selectRadioButton = id ?? selectRadioButton;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void onChangeGender(Gender? value) {
|
||||||
|
selectedGender = value ?? selectedGender;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
6
lib/controller/forms/editor_controller.dart
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import 'package:flutter_quill/flutter_quill.dart';
|
||||||
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
|
|
||||||
|
class EditorController extends MyController {
|
||||||
|
QuillController quillController = QuillController.basic();
|
||||||
|
}
|
27
lib/controller/forms/file_upload_controller.dart
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import 'package:file_picker/file_picker.dart';
|
||||||
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
|
|
||||||
|
class FileUploadController extends MyController {
|
||||||
|
List<PlatformFile> files = [];
|
||||||
|
List<PlatformFile> multipleFiles = [];
|
||||||
|
bool selectMultipleFile = false;
|
||||||
|
FileType type = FileType.any;
|
||||||
|
|
||||||
|
Future<void> pickFiles() async {
|
||||||
|
var result = await FilePicker.platform.pickFiles(allowMultiple: selectMultipleFile, type: type);
|
||||||
|
if (result?.files.isNotEmpty ?? false) {
|
||||||
|
files.addAll(result!.files);
|
||||||
|
}
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void onSelectMultipleFile(value) {
|
||||||
|
selectMultipleFile = value ?? selectMultipleFile;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void removeFile(PlatformFile file) {
|
||||||
|
files.remove(file);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
3
lib/controller/forms/mask_controller.dart
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
|
|
||||||
|
class MaskController extends MyController {}
|
13
lib/controller/forms/slider_controller.dart
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
|
|
||||||
|
class SliderController extends MyController {
|
||||||
|
double labelSliderValue = 50;
|
||||||
|
double tickSliderValue = 0;
|
||||||
|
double dividerSliderValue = 50;
|
||||||
|
|
||||||
|
DateTime yearValue = DateTime(2017, 01, 01);
|
||||||
|
DateTime hourValue = DateTime(2020, 01, 01, 13, 00, 00);
|
||||||
|
|
||||||
|
DateTime dateValue = DateTime(2016, 1, 01);
|
||||||
|
double stepSliderValue = 0;
|
||||||
|
}
|
51
lib/controller/forms/validation_controller.dart
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
import 'package:maxdash/controller/forms/basic_input_controller.dart';
|
||||||
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
|
import 'package:maxdash/helpers/widgets/my_field_validator.dart';
|
||||||
|
import 'package:maxdash/helpers/widgets/my_form_validator.dart';
|
||||||
|
import 'package:maxdash/helpers/widgets/my_validators.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class GenderValidator extends MyFieldValidatorRule<Gender> {
|
||||||
|
@override
|
||||||
|
String? validate(Gender? value, bool required, Map<String, dynamic> data) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ValidationController extends MyController {
|
||||||
|
MyFormValidator basicValidator = MyFormValidator();
|
||||||
|
|
||||||
|
ValidationController() {
|
||||||
|
basicValidator.addField('full_name',
|
||||||
|
required: true,
|
||||||
|
label: "Full Name",
|
||||||
|
controller: TextEditingController());
|
||||||
|
|
||||||
|
basicValidator.addField('email',
|
||||||
|
required: true,
|
||||||
|
label: "Email",
|
||||||
|
validators: [MyEmailValidator()],
|
||||||
|
controller: TextEditingController());
|
||||||
|
|
||||||
|
basicValidator.addField('password',
|
||||||
|
required: true,
|
||||||
|
label: "Password",
|
||||||
|
validators: [MyLengthValidator(min: 6, max: 10)],
|
||||||
|
controller: TextEditingController());
|
||||||
|
|
||||||
|
basicValidator.addField(
|
||||||
|
'gender',
|
||||||
|
required: true,
|
||||||
|
label: "Gender",
|
||||||
|
validators: [GenderValidator()],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void onSubmitBasicForm() {
|
||||||
|
basicValidator.validateForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
void onResetBasicForm() {
|
||||||
|
basicValidator.resetForm();
|
||||||
|
}
|
||||||
|
}
|
@ -1,3 +1,3 @@
|
|||||||
import 'package:marco/controller/my_controller.dart';
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
|
|
||||||
class AuthLayout2Controller extends MyController {}
|
class AuthLayout2Controller extends MyController {}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:marco/controller/my_controller.dart';
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
import 'package:marco/helpers/widgets/my_text_utils.dart';
|
import 'package:maxdash/helpers/widgets/my_text_utils.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class AuthLayoutController extends MyController {
|
class AuthLayoutController extends MyController {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import 'package:marco/helpers/theme/theme_customizer.dart';
|
import 'package:maxdash/helpers/theme/theme_customizer.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import 'package:get/get_state_manager/get_state_manager.dart';
|
import 'package:get/get_state_manager/get_state_manager.dart';
|
||||||
import 'package:marco/helpers/theme/theme_customizer.dart';
|
import 'package:maxdash/helpers/theme/theme_customizer.dart';
|
||||||
|
|
||||||
abstract class MyController extends GetxController {
|
abstract class MyController extends GetxController {
|
||||||
@override
|
@override
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:marco/controller/my_controller.dart';
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
import 'package:marco/helpers/extensions/string.dart';
|
import 'package:maxdash/helpers/extensions/string.dart';
|
||||||
import 'package:marco/helpers/widgets/my_text_utils.dart';
|
import 'package:maxdash/helpers/widgets/my_text_utils.dart';
|
||||||
import 'package:marco/model/visitor_by_channels_model.dart';
|
import 'package:maxdash/model/visitor_by_channels_model.dart';
|
||||||
import 'package:marco/view/other/basic_table_screen.dart';
|
import 'package:maxdash/view/other/basic_table_screen.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class BasicTableController extends MyController {
|
class BasicTableController extends MyController {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||||
import 'package:marco/controller/my_controller.dart';
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
|
|
||||||
class GoogleMapScreenController extends MyController {
|
class GoogleMapScreenController extends MyController {
|
||||||
late GoogleMapController mapController;
|
late GoogleMapController mapController;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:marco/controller/my_controller.dart';
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:syncfusion_flutter_maps/maps.dart';
|
import 'package:syncfusion_flutter_maps/maps.dart';
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:marco/controller/my_controller.dart';
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
import 'package:marco/model/chart_model.dart';
|
import 'package:maxdash/model/chart_model.dart';
|
||||||
import 'package:syncfusion_flutter_charts/charts.dart';
|
import 'package:syncfusion_flutter_charts/charts.dart';
|
||||||
import 'dart:ui' as ui;
|
import 'dart:ui' as ui;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import 'package:marco/controller/my_controller.dart';
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
|
|
||||||
class ButtonsController extends MyController {
|
class ButtonsController extends MyController {
|
||||||
List<bool> selected = List.filled(3, false);
|
List<bool> selected = List.filled(3, false);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:carousel_slider/carousel_controller.dart';
|
import 'package:carousel_slider/carousel_controller.dart';
|
||||||
import 'package:marco/controller/my_controller.dart';
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class CarouselsController extends MyController {
|
class CarouselsController extends MyController {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import 'package:marco/controller/my_controller.dart';
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
import 'package:marco/helpers/widgets/my_text_utils.dart';
|
import 'package:maxdash/helpers/widgets/my_text_utils.dart';
|
||||||
|
|
||||||
class DialogsController extends MyController {
|
class DialogsController extends MyController {
|
||||||
List<String> dummyTexts =
|
List<String> dummyTexts =
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'package:marco/controller/my_controller.dart';
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
import 'package:marco/helpers/widgets/my_text_utils.dart';
|
import 'package:maxdash/helpers/widgets/my_text_utils.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:marco/model/drag_n_drop_model.dart';
|
import 'package:maxdash/model/drag_n_drop_model.dart';
|
||||||
|
|
||||||
class DragNDropController extends MyController {
|
class DragNDropController extends MyController {
|
||||||
List<DragNDropModel> dragNDrop = [];
|
List<DragNDropModel> dragNDrop = [];
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
import 'package:marco/controller/my_controller.dart';
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
|
|
||||||
class LoadersController extends MyController {}
|
class LoadersController extends MyController {}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import 'package:marco/controller/my_controller.dart';
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
import 'package:marco/helpers/widgets/my_text_utils.dart';
|
import 'package:maxdash/helpers/widgets/my_text_utils.dart';
|
||||||
import 'package:flutter/animation.dart';
|
import 'package:flutter/animation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'package:marco/controller/my_controller.dart';
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
import 'package:marco/helpers/extensions/string.dart';
|
import 'package:maxdash/helpers/extensions/string.dart';
|
||||||
import 'package:marco/helpers/theme/admin_theme.dart';
|
import 'package:maxdash/helpers/theme/admin_theme.dart';
|
||||||
import 'package:marco/helpers/widgets/my_button.dart';
|
import 'package:maxdash/helpers/widgets/my_button.dart';
|
||||||
import 'package:marco/helpers/widgets/my_spacing.dart';
|
import 'package:maxdash/helpers/widgets/my_spacing.dart';
|
||||||
import 'package:marco/helpers/widgets/my_text.dart';
|
import 'package:maxdash/helpers/widgets/my_text.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:flutter_lucide/flutter_lucide.dart';
|
import 'package:flutter_lucide/flutter_lucide.dart';
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import 'package:marco/controller/my_controller.dart';
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
import 'package:marco/helpers/widgets/my_text_utils.dart';
|
import 'package:maxdash/helpers/widgets/my_text_utils.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class TabsController extends MyController {
|
class TabsController extends MyController {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import 'package:marco/controller/my_controller.dart';
|
import 'package:maxdash/controller/my_controller.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class ToastMessageController extends MyController {
|
class ToastMessageController extends MyController {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import 'package:marco/helpers/services/localizations/language.dart';
|
import 'package:maxdash/helpers/services/localizations/language.dart';
|
||||||
import 'package:marco/helpers/theme/app_notifier.dart';
|
import 'package:maxdash/helpers/theme/app_notifier.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
import 'package:marco/helpers/services/localizations/translator.dart';
|
import 'package:maxdash/helpers/services/localizations/translator.dart';
|
||||||
|
|
||||||
extension StringUtil on String {
|
extension StringUtil on String {
|
||||||
Color get toColor {
|
Color get toColor {
|
||||||
|
@ -1,22 +1,46 @@
|
|||||||
import 'package:marco/helpers/services/storage/local_storage.dart';
|
import 'dart:convert';
|
||||||
import 'package:marco/model/user.dart';
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
class AuthService {
|
class AuthService {
|
||||||
|
static const String baseUrl = 'https://api.marcoaiot.com/api';
|
||||||
|
|
||||||
static bool isLoggedIn = false;
|
static bool isLoggedIn = false;
|
||||||
|
|
||||||
static User get dummyUser => User(-1, "demo@example.com", "Denish", "Navadiya");
|
static Future<Map<String, String>?> loginUser(Map<String, dynamic> data) async {
|
||||||
|
try {
|
||||||
|
print('Sending login request with data: $data');
|
||||||
|
|
||||||
static Future<Map<String, String>?> loginUser(
|
// Make the API call
|
||||||
Map<String, dynamic> data) async {
|
final response = await http.post(
|
||||||
await Future.delayed(Duration(seconds: 1));
|
Uri.parse('$baseUrl/Auth/login'),
|
||||||
if (data['email'] != dummyUser.email) {
|
headers: {'Content-Type': 'application/json'},
|
||||||
return {"email": "This email is not registered"};
|
body: jsonEncode(data),
|
||||||
} else if (data['password'] != "1234567") {
|
);
|
||||||
return {"password": "Password is incorrect"};
|
|
||||||
|
print('Response received: ${response.body}');
|
||||||
|
|
||||||
|
if (response.statusCode == 200) {
|
||||||
|
final responseData = jsonDecode(response.body);
|
||||||
|
|
||||||
|
// Extract the token from the "data" field
|
||||||
|
final token = responseData['data']?['token']; // Adjust based on your API response
|
||||||
|
if (token != null) {
|
||||||
|
// Save the token locally
|
||||||
|
final prefs = await SharedPreferences.getInstance();
|
||||||
|
await prefs.setString('auth_token', token);
|
||||||
|
isLoggedIn = true;
|
||||||
|
return null; // No errors
|
||||||
|
} else {
|
||||||
|
return {'error': 'Token not found in response'};
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
final responseData = jsonDecode(response.body);
|
||||||
|
return {'error': responseData['message'] ?? 'Invalid response from server'};
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
print('Unexpected error: $e');
|
||||||
|
return {'error': 'Unexpected error: $e'};
|
||||||
}
|
}
|
||||||
|
|
||||||
isLoggedIn = true;
|
|
||||||
await LocalStorage.setLoggedInUser(true);
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
import 'package:marco/helpers/services/storage/local_storage.dart';
|
import 'package:maxdash/helpers/services/storage/local_storage.dart';
|
||||||
import 'package:marco/helpers/theme/theme_customizer.dart';
|
import 'package:maxdash/helpers/theme/theme_customizer.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class Language {
|
class Language {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:developer';
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:marco/helpers/services/localizations/language.dart';
|
import 'package:maxdash/helpers/services/localizations/language.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:get/get_utils/src/extensions/string_extensions.dart';
|
import 'package:get/get_utils/src/extensions/string_extensions.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import 'package:marco/helpers/services/auth_service.dart';
|
import 'package:maxdash/helpers/services/auth_service.dart';
|
||||||
import 'package:marco/helpers/services/localizations/language.dart';
|
import 'package:maxdash/helpers/services/localizations/language.dart';
|
||||||
import 'package:marco/helpers/theme/theme_customizer.dart';
|
import 'package:maxdash/helpers/theme/theme_customizer.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
class LocalStorage {
|
class LocalStorage {
|
||||||
|
@ -11,6 +11,6 @@ class UrlService {
|
|||||||
|
|
||||||
static getCurrentUrl() {
|
static getCurrentUrl() {
|
||||||
var path = Uri.base.path;
|
var path = Uri.base.path;
|
||||||
return path.replaceAll('marco/web/', '');
|
return path.replaceAll('maxdash/web/', '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:marco/helpers/theme/theme_customizer.dart';
|
import 'package:maxdash/helpers/theme/theme_customizer.dart';
|
||||||
|
|
||||||
enum LeftBarThemeType { light, dark }
|
enum LeftBarThemeType { light, dark }
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import 'package:marco/helpers/services/localizations/language.dart';
|
import 'package:maxdash/helpers/services/localizations/language.dart';
|
||||||
import 'package:marco/helpers/services/storage/local_storage.dart';
|
import 'package:maxdash/helpers/services/storage/local_storage.dart';
|
||||||
import 'package:marco/helpers/theme/app_theme.dart';
|
import 'package:maxdash/helpers/theme/app_theme.dart';
|
||||||
import 'package:marco/helpers/theme/theme_customizer.dart';
|
import 'package:maxdash/helpers/theme/theme_customizer.dart';
|
||||||
import 'package:marco/helpers/widgets/my.dart';
|
import 'package:maxdash/helpers/widgets/my.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
|
@ -6,13 +6,13 @@
|
|||||||
* */
|
* */
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
import 'package:marco/helpers/theme/admin_theme.dart';
|
import 'package:maxdash/helpers/theme/admin_theme.dart';
|
||||||
import 'package:marco/helpers/theme/theme_customizer.dart';
|
import 'package:maxdash/helpers/theme/theme_customizer.dart';
|
||||||
import 'package:marco/helpers/widgets/my.dart';
|
import 'package:maxdash/helpers/widgets/my.dart';
|
||||||
import 'package:marco/helpers/widgets/my_breadcrumb_item.dart';
|
import 'package:maxdash/helpers/widgets/my_breadcrumb_item.dart';
|
||||||
import 'package:marco/helpers/widgets/my_constant.dart';
|
import 'package:maxdash/helpers/widgets/my_constant.dart';
|
||||||
import 'package:marco/helpers/widgets/my_screen_media.dart';
|
import 'package:maxdash/helpers/widgets/my_screen_media.dart';
|
||||||
import 'package:marco/helpers/widgets/my_text_style.dart';
|
import 'package:maxdash/helpers/widgets/my_text_style.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ class AppStyle {
|
|||||||
containerRadius: AppStyle.containerRadius.medium,
|
containerRadius: AppStyle.containerRadius.medium,
|
||||||
cardRadius: AppStyle.cardRadius.medium,
|
cardRadius: AppStyle.cardRadius.medium,
|
||||||
buttonRadius: AppStyle.buttonRadius.medium,
|
buttonRadius: AppStyle.buttonRadius.medium,
|
||||||
defaultBreadCrumbItem: MyBreadcrumbItem(name: 'Marco', route: '/client/home'),
|
defaultBreadCrumbItem: MyBreadcrumbItem(name: 'MaxDash', route: '/client/home'),
|
||||||
));
|
));
|
||||||
bool isMobile = true;
|
bool isMobile = true;
|
||||||
try {
|
try {
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:marco/helpers/services/json_decoder.dart';
|
import 'package:maxdash/helpers/services/json_decoder.dart';
|
||||||
import 'package:marco/helpers/services/localizations/language.dart';
|
import 'package:maxdash/helpers/services/localizations/language.dart';
|
||||||
import 'package:marco/helpers/services/localizations/translator.dart';
|
import 'package:maxdash/helpers/services/localizations/translator.dart';
|
||||||
import 'package:marco/helpers/services/navigation_services.dart';
|
import 'package:maxdash/helpers/services/navigation_services.dart';
|
||||||
import 'package:marco/helpers/theme/admin_theme.dart';
|
import 'package:maxdash/helpers/theme/admin_theme.dart';
|
||||||
import 'package:marco/helpers/theme/app_notifier.dart';
|
import 'package:maxdash/helpers/theme/app_notifier.dart';
|
||||||
import 'package:marco/helpers/theme/app_theme.dart';
|
import 'package:maxdash/helpers/theme/app_theme.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'package:marco/helpers/theme/admin_theme.dart';
|
import 'package:maxdash/helpers/theme/admin_theme.dart';
|
||||||
import 'package:marco/helpers/theme/app_theme.dart';
|
import 'package:maxdash/helpers/theme/app_theme.dart';
|
||||||
import 'package:marco/helpers/widgets/my_dashed_divider.dart';
|
import 'package:maxdash/helpers/widgets/my_dashed_divider.dart';
|
||||||
import 'package:marco/helpers/widgets/my_navigation_mixin.dart';
|
import 'package:maxdash/helpers/widgets/my_navigation_mixin.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
mixin UIMixin {
|
mixin UIMixin {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import 'package:marco/helpers/extensions/date_time_extension.dart';
|
import 'package:maxdash/helpers/extensions/date_time_extension.dart';
|
||||||
|
|
||||||
class Utils {
|
class Utils {
|
||||||
static getDateStringFromDateTime(DateTime dateTime,
|
static getDateStringFromDateTime(DateTime dateTime,
|
||||||
|