generated from josiadmin/flutter-template-getx-provider
Initial commit
This commit is contained in:
32
lib/controllers/home_controller.dart
Normal file
32
lib/controllers/home_controller.dart
Normal file
@@ -0,0 +1,32 @@
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../pages/login/login_view.dart';
|
||||
import '../services/appwrite_service.dart';
|
||||
|
||||
class HomeController extends GetxController {
|
||||
final szHeaderHome = 'Home Page'.obs;
|
||||
late AppWriteProvider appwriteProvider;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
appwriteProvider = AppWriteProvider();
|
||||
super.onInit();
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {}
|
||||
|
||||
@override
|
||||
void onClose() {}
|
||||
|
||||
void goToLoginPage() async {
|
||||
if (await appwriteProvider.logout()) {
|
||||
Get.snackbar(
|
||||
'Logout Successful',
|
||||
'You have been logged out successfully.',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
await Get.offAllNamed(LoginPage.namedRoute);
|
||||
}
|
||||
}
|
||||
}
|
||||
153
lib/controllers/login_controller.dart
Normal file
153
lib/controllers/login_controller.dart
Normal file
@@ -0,0 +1,153 @@
|
||||
import 'package:appwrite/models.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../pages/home/home_view.dart';
|
||||
import '../services/appwrite_service.dart';
|
||||
|
||||
class LoginController extends GetxController {
|
||||
final szHeaderLogin = 'Login Page'.obs;
|
||||
final szHeaderSignin = 'Signin Page'.obs;
|
||||
final loginFormKey = GlobalKey<FormState>();
|
||||
final isLoginScreen = true.obs;
|
||||
late TextEditingController emailController;
|
||||
late TextEditingController passwordController;
|
||||
late TextEditingController nameController;
|
||||
late AppWriteProvider appWriteProvider;
|
||||
Session? _session;
|
||||
User? _signedUser;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
appWriteProvider = AppWriteProvider();
|
||||
emailController = TextEditingController();
|
||||
passwordController = TextEditingController();
|
||||
nameController = TextEditingController();
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
emailController.dispose();
|
||||
passwordController.dispose();
|
||||
nameController.dispose();
|
||||
}
|
||||
|
||||
switchScreen() {
|
||||
_clearFields();
|
||||
isLoginScreen.value = !isLoginScreen.value;
|
||||
update();
|
||||
}
|
||||
|
||||
void _clearFields() {
|
||||
emailController.clear();
|
||||
passwordController.clear();
|
||||
nameController.clear();
|
||||
}
|
||||
|
||||
void logOrSignIn() async {
|
||||
_checkInputValueOfFormFields();
|
||||
loginFormKey.currentState?.save();
|
||||
if (isLoginScreen.value) {
|
||||
// Perform login action
|
||||
String email = emailController.text;
|
||||
String password = passwordController.text;
|
||||
// Add your login logic here
|
||||
print('Logging in with Email: $email, Password: $password');
|
||||
_session = await appWriteProvider.login({
|
||||
'email': email,
|
||||
'password': password,
|
||||
});
|
||||
if (_session!.current) {
|
||||
Get.snackbar(
|
||||
'Login Successful',
|
||||
'You have been logged in successfully.',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
// Navigate to home or another page if needed
|
||||
_goToHomePage();
|
||||
} else {
|
||||
Get.snackbar(
|
||||
'Login Failed',
|
||||
'Invalid email or password.',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// Perform signin action
|
||||
String name = nameController.text;
|
||||
String email = emailController.text;
|
||||
String password = passwordController.text;
|
||||
// Add your signin logic here
|
||||
print('Signing in with Name: $name, Email: $email, Password: $password');
|
||||
_signedUser = await appWriteProvider.signup({
|
||||
'email': email,
|
||||
'password': password,
|
||||
'name': name,
|
||||
});
|
||||
if (_signedUser != null) {
|
||||
Get.snackbar(
|
||||
'Signin Successful',
|
||||
'Your account has been created successfully.',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
} else {
|
||||
Get.snackbar(
|
||||
'Signin Failed',
|
||||
'An error occurred during account creation.',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
}
|
||||
}
|
||||
_clearFields();
|
||||
}
|
||||
|
||||
bool _checkInputValueOfFormFields() {
|
||||
bool isValid = true;
|
||||
if (!isLoginScreen.value) {
|
||||
if (nameController.text == '') {
|
||||
isValid = false;
|
||||
}
|
||||
}
|
||||
if (emailController.text == '') {
|
||||
isValid = false;
|
||||
}
|
||||
if (passwordController.text.isEmpty) {
|
||||
isValid = false;
|
||||
}
|
||||
if (isValid == false) {
|
||||
Get.snackbar(
|
||||
'Invalid Input',
|
||||
'Please fill in all required(*) fields.',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
}
|
||||
return isValid;
|
||||
}
|
||||
|
||||
Future<bool> logout() async {
|
||||
bool isLoggedOut = false;
|
||||
isLoggedOut = await appWriteProvider.logout();
|
||||
if (isLoggedOut) {
|
||||
Get.snackbar(
|
||||
'Logout Successful',
|
||||
'You have been logged out successfully.',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
} else {
|
||||
Get.snackbar(
|
||||
'Logout Failed',
|
||||
'An error occurred during logout.',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
}
|
||||
return isLoggedOut;
|
||||
}
|
||||
|
||||
void _goToHomePage() async {
|
||||
await Get.offAllNamed(HomePage.namedRoute);
|
||||
}
|
||||
}
|
||||
16
lib/helpers/sample_bindings.dart
Normal file
16
lib/helpers/sample_bindings.dart
Normal file
@@ -0,0 +1,16 @@
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../controllers/home_controller.dart';
|
||||
import '../controllers/login_controller.dart';
|
||||
|
||||
|
||||
|
||||
class SampleBindings extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
// Define your dependencies here no permanent Binding
|
||||
Get.lazyPut<LoginController>(() => LoginController());
|
||||
Get.lazyPut<HomeController>(() => HomeController());
|
||||
}
|
||||
|
||||
}
|
||||
25
lib/helpers/sample_routes.dart
Normal file
25
lib/helpers/sample_routes.dart
Normal file
@@ -0,0 +1,25 @@
|
||||
import 'package:get/get.dart';
|
||||
import '../pages/home/home_view.dart';
|
||||
import '../pages/login/login_view.dart';
|
||||
import './sample_bindings.dart';
|
||||
|
||||
|
||||
|
||||
|
||||
class SampleRouts {
|
||||
static final sampleBindings = SampleBindings();
|
||||
static List<GetPage<dynamic>> samplePages = [
|
||||
GetPage(
|
||||
name: LoginPage.namedRoute,
|
||||
page: () => const LoginPage(),
|
||||
binding: sampleBindings,
|
||||
),
|
||||
GetPage(
|
||||
name: HomePage.namedRoute,
|
||||
page: () => const HomePage(),
|
||||
binding: sampleBindings,
|
||||
),
|
||||
|
||||
];
|
||||
|
||||
}
|
||||
30
lib/main.dart
Normal file
30
lib/main.dart
Normal file
@@ -0,0 +1,30 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'helpers/sample_bindings.dart';
|
||||
import './helpers/sample_routes.dart';
|
||||
import './pages/login/login_view.dart';
|
||||
|
||||
void main() async {
|
||||
await dotenv.load(fileName: ".env");
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetMaterialApp(
|
||||
debugShowCheckedModeBanner: false,
|
||||
title: 'Flutter Demo',
|
||||
theme: ThemeData(
|
||||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
|
||||
),
|
||||
initialBinding: SampleBindings(),
|
||||
initialRoute: LoginPage.namedRoute,
|
||||
getPages: SampleRouts.samplePages,
|
||||
);
|
||||
}
|
||||
}
|
||||
0
lib/models/home_model.dart
Normal file
0
lib/models/home_model.dart
Normal file
0
lib/models/login_model.dart
Normal file
0
lib/models/login_model.dart
Normal file
49
lib/pages/home/home_view.dart
Normal file
49
lib/pages/home/home_view.dart
Normal file
@@ -0,0 +1,49 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../../controllers/home_controller.dart';
|
||||
|
||||
class HomePage extends GetView<HomeController> {
|
||||
static const String namedRoute = '/home';
|
||||
const HomePage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var homeCtrl = controller;
|
||||
return PopScope(
|
||||
canPop: false,
|
||||
child: SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.grey.shade500,
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.arrow_back, color: Colors.grey.shade200),
|
||||
onPressed: () {
|
||||
// Verhindert das Zurücknavigieren
|
||||
homeCtrl.goToLoginPage();
|
||||
},
|
||||
),
|
||||
title: Text(
|
||||
homeCtrl.szHeaderHome.value,
|
||||
style: TextStyle(color: Colors.grey.shade200),
|
||||
),
|
||||
centerTitle: true,
|
||||
),
|
||||
body: Container(
|
||||
decoration: BoxDecoration(color: Colors.grey.shade400),
|
||||
padding: EdgeInsets.all(20),
|
||||
child: Center(
|
||||
child: Text(
|
||||
'You are on the Home Page...\nPress the back arrow to logout.\nThis is a Template to use...',
|
||||
style: TextStyle(
|
||||
color: Colors.grey.shade800,
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
234
lib/pages/login/login_view.dart
Normal file
234
lib/pages/login/login_view.dart
Normal file
@@ -0,0 +1,234 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../../controllers/login_controller.dart';
|
||||
|
||||
class LoginPage extends GetView<LoginController> {
|
||||
static const String namedRoute = '/login';
|
||||
const LoginPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var loginCtrl = controller;
|
||||
|
||||
// LayoutBuilder ermöglicht dynamische Anpassung an verschiedene Bildschirmgrößen.
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
body: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final bool isSmall = constraints.maxWidth < 600;
|
||||
final double cardWidth = isSmall
|
||||
? constraints.maxWidth * 0.92
|
||||
: (constraints.maxWidth * 0.6).clamp(0, 900);
|
||||
return Stack(
|
||||
children: [
|
||||
// Hintergrundbild skaliert responsiv mit BoxFit.cover
|
||||
Positioned.fill(
|
||||
child: Image.asset(
|
||||
'img/backgroundLogoInternorm.jpg',
|
||||
fit: BoxFit.cover,
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
),
|
||||
// halbtransparente Ebene; Opazität an Bildschirmgröße anpassen
|
||||
Positioned.fill(
|
||||
child: Container(
|
||||
color: Colors.black.withAlpha(isSmall ? 50 : 100),
|
||||
),
|
||||
),
|
||||
Center(
|
||||
child: PopScope(
|
||||
canPop: false,
|
||||
child: SingleChildScrollView(
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 250),
|
||||
width: cardWidth,
|
||||
padding: const EdgeInsets.all(40.0),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: const Color.fromARGB(223, 189, 189, 189),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withAlpha(200),
|
||||
borderRadius: BorderRadius.circular(100),
|
||||
),
|
||||
child: Obx(
|
||||
() => loginCtrl.isLoginScreen.value
|
||||
? IconButton(
|
||||
onPressed: () => loginCtrl.logout(),
|
||||
icon: const Icon(Icons.login, size: 80),
|
||||
color: const Color.fromARGB(
|
||||
255,
|
||||
255,
|
||||
0,
|
||||
0,
|
||||
),
|
||||
)
|
||||
: IconButton(
|
||||
onPressed: () => loginCtrl.logout(),
|
||||
icon: const Icon(
|
||||
Icons.app_registration,
|
||||
size: 80,
|
||||
),
|
||||
color: const Color.fromARGB(
|
||||
255,
|
||||
255,
|
||||
0,
|
||||
0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 80),
|
||||
Obx(
|
||||
() => loginCtrl.isLoginScreen.value
|
||||
? Text(
|
||||
loginCtrl.szHeaderLogin.value,
|
||||
style: Theme.of(
|
||||
context,
|
||||
).textTheme.headlineMedium,
|
||||
)
|
||||
: Text(
|
||||
loginCtrl.szHeaderSignin.value,
|
||||
style: Theme.of(
|
||||
context,
|
||||
).textTheme.headlineMedium,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 40),
|
||||
Form(
|
||||
key: loginCtrl.loginFormKey,
|
||||
child: Column(
|
||||
children: [
|
||||
Obx(
|
||||
() => loginCtrl.isLoginScreen.value
|
||||
? const SizedBox.shrink()
|
||||
: _nameFormField(loginCtrl),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
_emailFormField(loginCtrl),
|
||||
const SizedBox(height: 20),
|
||||
_passwdFormField(loginCtrl),
|
||||
const SizedBox(height: 40),
|
||||
_logOrSignInButton(loginCtrl),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Obx(
|
||||
() => loginCtrl.isLoginScreen.value
|
||||
? TextButton(
|
||||
child: Text(
|
||||
'To Signin',
|
||||
style: TextStyle(
|
||||
color: Colors.blue.shade800,
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
loginCtrl.switchScreen();
|
||||
},
|
||||
)
|
||||
: TextButton(
|
||||
child: Text(
|
||||
'To Login',
|
||||
style: TextStyle(
|
||||
color: Colors.blue.shade800,
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
loginCtrl.switchScreen();
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// Email Form Field
|
||||
TextFormField _emailFormField(LoginController loginCtrl) {
|
||||
return TextFormField(
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
controller: loginCtrl.emailController,
|
||||
decoration: _formFieldDecoration('Email*'),
|
||||
);
|
||||
}
|
||||
|
||||
// Password Form Field
|
||||
TextFormField _passwdFormField(LoginController loginCtrl) {
|
||||
return TextFormField(
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
controller: loginCtrl.passwordController,
|
||||
decoration: _formFieldDecoration('Password*'),
|
||||
obscureText: true,
|
||||
);
|
||||
}
|
||||
|
||||
// Name Form Field
|
||||
TextFormField _nameFormField(LoginController loginCtrl) {
|
||||
return TextFormField(
|
||||
keyboardType: TextInputType.name,
|
||||
controller: loginCtrl.nameController,
|
||||
decoration: _formFieldDecoration('Name*'),
|
||||
);
|
||||
}
|
||||
|
||||
//Form Field Decoration
|
||||
InputDecoration _formFieldDecoration(String labelText) {
|
||||
return InputDecoration(
|
||||
labelText: labelText,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: const Color.fromARGB(255, 255, 0, 0)),
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: const Color.fromARGB(255, 255, 0, 0)),
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
ElevatedButton _logOrSignInButton(LoginController loginCtrl) {
|
||||
return ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: const Color.fromARGB(255, 255, 0, 0),
|
||||
minimumSize: const Size(double.infinity, 50),
|
||||
),
|
||||
onPressed: () {
|
||||
// Handle login or signin action
|
||||
loginCtrl.logOrSignIn();
|
||||
},
|
||||
child: Obx(
|
||||
() => loginCtrl.isLoginScreen.value
|
||||
? const Text(
|
||||
'Login',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
)
|
||||
: const Text(
|
||||
'Signin',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
158
lib/services/appwrite_service.dart
Normal file
158
lib/services/appwrite_service.dart
Normal file
@@ -0,0 +1,158 @@
|
||||
|
||||
|
||||
import 'package:appwrite/appwrite.dart';
|
||||
import 'package:appwrite/models.dart' as models;
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
|
||||
class AppWriteProvider {
|
||||
final szEndpoint = dotenv.env['APPWRITE_ENDPOINT_URL'] ?? '';
|
||||
final szProjectID = dotenv.env['APPWRITE_PROJECT_ID'] ?? '';
|
||||
final szDatabaseID = dotenv.env['APPWRITE_DATABASE_ID'] ?? '';
|
||||
final szCollectionID = dotenv.env['APPWRITE_COLLECTION_ID'] ?? '';
|
||||
final bSelfSignd = dotenv.env['APPWRITE_SELF_SIGNED'] == 'true';
|
||||
|
||||
|
||||
|
||||
Client client = Client();
|
||||
Account? account;
|
||||
Storage? storage;
|
||||
Databases? database;
|
||||
|
||||
AppWriteProvider() {
|
||||
client
|
||||
..setEndpoint(szEndpoint) // Set your Appwrite endpoint
|
||||
..setProject(szProjectID)
|
||||
..setSelfSigned(status: bSelfSignd);
|
||||
account = Account(client); // Set your Appwrite project ID
|
||||
storage = Storage(client);
|
||||
database = Databases(client);
|
||||
}
|
||||
|
||||
Future<models.Session> login(Map map) async {
|
||||
final response = await account!.createEmailPasswordSession(
|
||||
email: map['email'],
|
||||
password: map['password'],
|
||||
);
|
||||
return response;
|
||||
}
|
||||
|
||||
Future<models.User> signup(Map map) async {
|
||||
final response = await account!.create(
|
||||
userId: ID.unique(),
|
||||
email: map['email'],
|
||||
password: map['password'],
|
||||
name: map['name'],
|
||||
);
|
||||
return response;
|
||||
}
|
||||
|
||||
Future<bool> logout() async {
|
||||
try {
|
||||
await account!.deleteSession(sessionId: 'current');
|
||||
return true;
|
||||
} catch (e) {
|
||||
print('Fehler beim Ausloggen: $e');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// // Tank Stop Image Upload
|
||||
// Future<models.File> uploadTankStopImage(String imagePath) async {
|
||||
// String fileName =
|
||||
// '${DateTime.now().millisecondsSinceEpoch}_${imagePath.split('.').last}';
|
||||
|
||||
// final response = await storage!.createFile(
|
||||
// bucketId: kAppWriteBucket,
|
||||
// fileId: ID.unique(),
|
||||
// file: InputFile.fromPath(path: fileName, filename: fileName),
|
||||
// );
|
||||
// return response;
|
||||
// }
|
||||
|
||||
// // Tank Stop Image get by fileID
|
||||
// Future<models.File> getTankStopImage(String fileID) async {
|
||||
// final response = await storage!.getFile(
|
||||
// bucketId: kAppWriteBucket,
|
||||
// fileId: fileID,
|
||||
// );
|
||||
// return response;
|
||||
// }
|
||||
|
||||
// // Tank Stop Image delete by fileID
|
||||
// Future<dynamic> deleteTankStopImage(String fileID) async {
|
||||
// final response = await storage!.deleteFile(
|
||||
// bucketId: kAppWriteBucket,
|
||||
// fileId: fileID,
|
||||
// );
|
||||
// return response;
|
||||
// }
|
||||
|
||||
// Tank Stop CRUD operations
|
||||
// Create, Update, Get, List Tank Stops
|
||||
// Future<models.Document> createTankStop(Map map) async {
|
||||
// final response = await database!.createDocument(
|
||||
// databaseId: kAppWriteDatabaseID,
|
||||
// collectionId: kAppWriteCollectionID,
|
||||
// documentId: ID.unique(),
|
||||
// data: map,
|
||||
// );
|
||||
// return response;
|
||||
// }
|
||||
|
||||
// Future<models.Document> updateTankStop(String documentId, Map map) async {
|
||||
// final response = await database!.updateDocument(
|
||||
// databaseId: kAppWriteDatabaseID,
|
||||
// collectionId: kAppWriteCollectionID,
|
||||
// documentId: documentId,
|
||||
// data: map,
|
||||
// );
|
||||
// return response;
|
||||
// }
|
||||
|
||||
// Future<models.Document> getTankStopById(String documentId) async {
|
||||
// final response = await database!.getDocument(
|
||||
// databaseId: kAppWriteDatabaseID,
|
||||
// collectionId: kAppWriteCollectionID,
|
||||
// documentId: documentId,
|
||||
// );
|
||||
// return response;
|
||||
// }
|
||||
|
||||
// Future<models.DocumentList> listTankStops(String userId) async {
|
||||
// final response = await database!.listDocuments(
|
||||
// databaseId: kAppWriteDatabaseID,
|
||||
// collectionId: kAppWriteCollectionID,
|
||||
// queries: [Query.equal('userId', userId)],
|
||||
// );
|
||||
// return response;
|
||||
// }
|
||||
|
||||
// Future<models.Document> deleteTankStop(String documentId) async {
|
||||
// final response = await database!.deleteDocument(
|
||||
// databaseId: kAppWriteDatabaseID,
|
||||
// collectionId: kAppWriteCollectionID,
|
||||
// documentId: documentId,
|
||||
// );
|
||||
// return response;
|
||||
// }
|
||||
|
||||
// Future<models.Document> createTrackPoint(map) async {
|
||||
// final response = await database!.createDocument(
|
||||
// databaseId: kAppWriteDatabaseID,
|
||||
// collectionId: kAppWriteTrackPointsCollectionID,
|
||||
// documentId: ID.unique(),
|
||||
// data: map,
|
||||
// );
|
||||
// return response;
|
||||
// }
|
||||
|
||||
// Future<models.Document> saveFullTrack(map) async {
|
||||
// final response = await database!.createDocument(
|
||||
// databaseId: kAppWriteDatabaseID,
|
||||
// collectionId: kAppWriteTracksCollectionId,
|
||||
// documentId: ID.unique(),
|
||||
// data: map,
|
||||
// );
|
||||
// return response;
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user