Merge branch with resolved conflicts - restructured features and added new modules
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:rasadyar_core/core.dart';
|
||||
|
||||
part 'app_model.g.dart';
|
||||
|
||||
|
||||
@HiveType(typeId: appModelTypeId)
|
||||
class AppModel extends HiveObject {
|
||||
@HiveField(0, defaultValue: true)
|
||||
@@ -16,7 +17,12 @@ class AppModel extends HiveObject {
|
||||
@HiveField(3)
|
||||
List<TargetPage>? targetPages;
|
||||
|
||||
AppModel({this.isFirstRun, this.isDarkMode, this.selectedModule, this.targetPages});
|
||||
AppModel({
|
||||
this.isFirstRun,
|
||||
this.isDarkMode,
|
||||
this.selectedModule,
|
||||
this.targetPages,
|
||||
});
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
# Generated by Hive CE
|
||||
# Manual modifications may be necessary for certain migrations
|
||||
# Check in to version control
|
||||
nextTypeId: 3
|
||||
types:
|
||||
AppModel:
|
||||
typeId: 0
|
||||
nextIndex: 4
|
||||
fields:
|
||||
isFirstRun:
|
||||
index: 0
|
||||
isDarkMode:
|
||||
index: 1
|
||||
selectedModule:
|
||||
index: 2
|
||||
targetPages:
|
||||
index: 3
|
||||
TargetPage:
|
||||
typeId: 1
|
||||
nextIndex: 4
|
||||
fields:
|
||||
route:
|
||||
index: 0
|
||||
functions:
|
||||
index: 1
|
||||
module:
|
||||
index: 2
|
||||
selectedRole:
|
||||
index: 3
|
||||
Module:
|
||||
typeId: 2
|
||||
nextIndex: 3
|
||||
fields:
|
||||
liveStocks:
|
||||
index: 0
|
||||
inspection:
|
||||
index: 1
|
||||
chicken:
|
||||
index: 2
|
||||
15
packages/core/lib/data/model/local/hive_adapters.dart
Normal file
15
packages/core/lib/data/model/local/hive_adapters.dart
Normal file
@@ -0,0 +1,15 @@
|
||||
import 'package:hive_ce_flutter/hive_flutter.dart';
|
||||
import 'package:rasadyar_core/data/model/local/app_model/app_model.dart';
|
||||
import 'package:rasadyar_core/data/model/local/user_local/user_local_model.dart';
|
||||
|
||||
|
||||
@GenerateAdapters([
|
||||
AdapterSpec<AppModel>(),
|
||||
AdapterSpec<TargetPage>(),
|
||||
AdapterSpec<UserLocalModel>(),
|
||||
AdapterSpec<Module>(),
|
||||
])
|
||||
part 'hive_adapters.g.dart';
|
||||
|
||||
|
||||
|
||||
185
packages/core/lib/data/model/local/hive_adapters.g.dart
Normal file
185
packages/core/lib/data/model/local/hive_adapters.g.dart
Normal file
@@ -0,0 +1,185 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'hive_adapters.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// AdaptersGenerator
|
||||
// **************************************************************************
|
||||
|
||||
class AppModelAdapter extends TypeAdapter<AppModel> {
|
||||
@override
|
||||
final typeId = 0;
|
||||
|
||||
@override
|
||||
AppModel read(BinaryReader reader) {
|
||||
final numOfFields = reader.readByte();
|
||||
final fields = <int, dynamic>{
|
||||
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||
};
|
||||
return AppModel(
|
||||
isFirstRun: fields[0] == null ? true : fields[0] as bool?,
|
||||
isDarkMode: fields[1] as bool?,
|
||||
selectedModule: fields[2] as Module?,
|
||||
targetPages: (fields[3] as List?)?.cast<TargetPage>(),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, AppModel obj) {
|
||||
writer
|
||||
..writeByte(4)
|
||||
..writeByte(0)
|
||||
..write(obj.isFirstRun)
|
||||
..writeByte(1)
|
||||
..write(obj.isDarkMode)
|
||||
..writeByte(2)
|
||||
..write(obj.selectedModule)
|
||||
..writeByte(3)
|
||||
..write(obj.targetPages);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => typeId.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is AppModelAdapter &&
|
||||
runtimeType == other.runtimeType &&
|
||||
typeId == other.typeId;
|
||||
}
|
||||
|
||||
class TargetPageAdapter extends TypeAdapter<TargetPage> {
|
||||
@override
|
||||
final typeId = 1;
|
||||
|
||||
@override
|
||||
TargetPage read(BinaryReader reader) {
|
||||
final numOfFields = reader.readByte();
|
||||
final fields = <int, dynamic>{
|
||||
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||
};
|
||||
return TargetPage(
|
||||
route: fields[0] as String?,
|
||||
functions: (fields[1] as List?)?.cast<String>(),
|
||||
module: fields[2] as Module?,
|
||||
)..selectedRole = fields[3] as String?;
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, TargetPage obj) {
|
||||
writer
|
||||
..writeByte(4)
|
||||
..writeByte(0)
|
||||
..write(obj.route)
|
||||
..writeByte(1)
|
||||
..write(obj.functions)
|
||||
..writeByte(2)
|
||||
..write(obj.module)
|
||||
..writeByte(3)
|
||||
..write(obj.selectedRole);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => typeId.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is TargetPageAdapter &&
|
||||
runtimeType == other.runtimeType &&
|
||||
typeId == other.typeId;
|
||||
}
|
||||
|
||||
class UserLocalModelAdapter extends TypeAdapter<UserLocalModel> {
|
||||
@override
|
||||
final typeId = 2;
|
||||
|
||||
@override
|
||||
UserLocalModel read(BinaryReader reader) {
|
||||
final numOfFields = reader.readByte();
|
||||
final fields = <int, dynamic>{
|
||||
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||
};
|
||||
return UserLocalModel(
|
||||
username: fields[0] as String?,
|
||||
password: fields[1] as String?,
|
||||
token: fields[2] as String?,
|
||||
refreshToken: fields[3] as String?,
|
||||
module: fields[4] as Module?,
|
||||
backend: fields[5] as String?,
|
||||
roles: (fields[6] as List?)?.cast<String>(),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, UserLocalModel obj) {
|
||||
writer
|
||||
..writeByte(7)
|
||||
..writeByte(0)
|
||||
..write(obj.username)
|
||||
..writeByte(1)
|
||||
..write(obj.password)
|
||||
..writeByte(2)
|
||||
..write(obj.token)
|
||||
..writeByte(3)
|
||||
..write(obj.refreshToken)
|
||||
..writeByte(4)
|
||||
..write(obj.module)
|
||||
..writeByte(5)
|
||||
..write(obj.backend)
|
||||
..writeByte(6)
|
||||
..write(obj.roles);
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => typeId.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is UserLocalModelAdapter &&
|
||||
runtimeType == other.runtimeType &&
|
||||
typeId == other.typeId;
|
||||
}
|
||||
|
||||
class ModuleAdapter extends TypeAdapter<Module> {
|
||||
@override
|
||||
final typeId = 3;
|
||||
|
||||
@override
|
||||
Module read(BinaryReader reader) {
|
||||
switch (reader.readByte()) {
|
||||
case 0:
|
||||
return Module.liveStocks;
|
||||
case 1:
|
||||
return Module.inspection;
|
||||
case 2:
|
||||
return Module.chicken;
|
||||
default:
|
||||
return Module.liveStocks;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void write(BinaryWriter writer, Module obj) {
|
||||
switch (obj) {
|
||||
case Module.liveStocks:
|
||||
writer.writeByte(0);
|
||||
case Module.inspection:
|
||||
writer.writeByte(1);
|
||||
case Module.chicken:
|
||||
writer.writeByte(2);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => typeId.hashCode;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is ModuleAdapter &&
|
||||
runtimeType == other.runtimeType &&
|
||||
typeId == other.typeId;
|
||||
}
|
||||
57
packages/core/lib/data/model/local/hive_adapters.g.yaml
Normal file
57
packages/core/lib/data/model/local/hive_adapters.g.yaml
Normal file
@@ -0,0 +1,57 @@
|
||||
# Generated by Hive CE
|
||||
# Manual modifications may be necessary for certain migrations
|
||||
# Check in to version control
|
||||
nextTypeId: 4
|
||||
types:
|
||||
AppModel:
|
||||
typeId: 0
|
||||
nextIndex: 4
|
||||
fields:
|
||||
isFirstRun:
|
||||
index: 0
|
||||
isDarkMode:
|
||||
index: 1
|
||||
selectedModule:
|
||||
index: 2
|
||||
targetPages:
|
||||
index: 3
|
||||
TargetPage:
|
||||
typeId: 1
|
||||
nextIndex: 4
|
||||
fields:
|
||||
route:
|
||||
index: 0
|
||||
functions:
|
||||
index: 1
|
||||
module:
|
||||
index: 2
|
||||
selectedRole:
|
||||
index: 3
|
||||
UserLocalModel:
|
||||
typeId: 2
|
||||
nextIndex: 7
|
||||
fields:
|
||||
username:
|
||||
index: 0
|
||||
password:
|
||||
index: 1
|
||||
token:
|
||||
index: 2
|
||||
refreshToken:
|
||||
index: 3
|
||||
module:
|
||||
index: 4
|
||||
backend:
|
||||
index: 5
|
||||
roles:
|
||||
index: 6
|
||||
Module:
|
||||
typeId: 3
|
||||
nextIndex: 3
|
||||
fields:
|
||||
liveStocks:
|
||||
index: 0
|
||||
inspection:
|
||||
index: 1
|
||||
chicken:
|
||||
index: 2
|
||||
@@ -9,8 +9,11 @@ import 'package:rasadyar_core/data/model/local/user_local/user_local_model.dart'
|
||||
extension HiveRegistrar on HiveInterface {
|
||||
void registerAdapters() {
|
||||
registerAdapter(AppModelAdapter());
|
||||
|
||||
registerAdapter(ModuleAdapter());
|
||||
|
||||
registerAdapter(TargetPageAdapter());
|
||||
|
||||
registerAdapter(UserLocalModelAdapter());
|
||||
}
|
||||
}
|
||||
@@ -18,8 +21,12 @@ extension HiveRegistrar on HiveInterface {
|
||||
extension IsolatedHiveRegistrar on IsolatedHiveInterface {
|
||||
void registerAdapters() {
|
||||
registerAdapter(AppModelAdapter());
|
||||
registerAdapter(AppModelAdapter());
|
||||
registerAdapter(ModuleAdapter());
|
||||
registerAdapter(ModuleAdapter());
|
||||
registerAdapter(TargetPageAdapter());
|
||||
registerAdapter(TargetPageAdapter());
|
||||
registerAdapter(UserLocalModelAdapter());
|
||||
registerAdapter(UserLocalModelAdapter());
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,8 @@ import 'package:rasadyar_core/core.dart';
|
||||
|
||||
part 'user_local_model.g.dart';
|
||||
|
||||
|
||||
|
||||
@HiveType(typeId: authUserLocalModelTypeId)
|
||||
class UserLocalModel extends HiveObject {
|
||||
@HiveField(0)
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
# Generated by Hive CE
|
||||
# Manual modifications may be necessary for certain migrations
|
||||
# Check in to version control
|
||||
nextTypeId: 1
|
||||
types:
|
||||
UserLocalModel:
|
||||
typeId: 0
|
||||
nextIndex: 7
|
||||
fields:
|
||||
username:
|
||||
index: 0
|
||||
password:
|
||||
index: 1
|
||||
token:
|
||||
index: 2
|
||||
refreshToken:
|
||||
index: 3
|
||||
module:
|
||||
index: 4
|
||||
backend:
|
||||
index: 5
|
||||
roles:
|
||||
index: 6
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
import 'package:rasadyar_core/hive_registrar.g.dart';
|
||||
import 'package:rasadyar_core/data/model/local/hive_registrar.g.dart';
|
||||
|
||||
|
||||
class GService extends GetxService {
|
||||
final String _boxName = "appBox";
|
||||
@@ -42,14 +43,18 @@ class GService extends GetxService {
|
||||
if (isFirstTime()) {
|
||||
return null;
|
||||
}
|
||||
var res = box.values.first.targetPages?.firstWhereOrNull((element) => element.module == module);
|
||||
var res = box.values.first.targetPages?.firstWhereOrNull(
|
||||
(element) => element.module == module,
|
||||
);
|
||||
return res;
|
||||
}
|
||||
|
||||
Future<void> saveRoute(Module module, String route) async {
|
||||
AppModel model = box.values.first;
|
||||
|
||||
TargetPage? targetPage = model.targetPages?.firstWhere((element) => element.module == module);
|
||||
TargetPage? targetPage = model.targetPages?.firstWhere(
|
||||
(element) => element.module == module,
|
||||
);
|
||||
if (targetPage != null) {
|
||||
targetPage.route = route;
|
||||
model.save();
|
||||
@@ -62,7 +67,9 @@ class GService extends GetxService {
|
||||
|
||||
Future<void> saveRole(Module module, String role) async {
|
||||
AppModel model = box.values.first;
|
||||
TargetPage? targetPage = model.targetPages?.firstWhere((element) => element.module == module);
|
||||
TargetPage? targetPage = model.targetPages?.firstWhere(
|
||||
(element) => element.module == module,
|
||||
);
|
||||
if (targetPage != null) {
|
||||
targetPage.selectedRole = role;
|
||||
model.save();
|
||||
|
||||
@@ -37,6 +37,7 @@ class DioRemote implements IHttpClient {
|
||||
PrettyDioLogger(
|
||||
request: true,
|
||||
enabled: true,
|
||||
|
||||
requestHeader: true,
|
||||
responseHeader: true,
|
||||
requestBody: true,
|
||||
|
||||
@@ -14,6 +14,8 @@ Future<void> setupAllCoreProvider() async {
|
||||
// await FMTCObjectBoxBackend().initialise();
|
||||
|
||||
await diCore.allReady();
|
||||
|
||||
|
||||
}
|
||||
|
||||
Future<void> _setupLocalStorage() async {
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
import 'package:camera/camera.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:rasadyar_core/utils/logger_utils.dart';
|
||||
|
||||
class RImagePickerController extends ChangeNotifier {
|
||||
List<CameraDescription> _cameras = [];
|
||||
|
||||
CameraController? cameraController;
|
||||
|
||||
bool isLoading = false;
|
||||
|
||||
bool isCameraReady = false;
|
||||
bool frontCamera = true;
|
||||
bool isCameraLoading = false;
|
||||
bool hasTwoCameras = false;
|
||||
|
||||
List<XFile> capturedImages = <XFile>[];
|
||||
|
||||
Future<void> getAvailableCameras() async {
|
||||
_cameras = await availableCameras();
|
||||
if (_cameras.length > 1) {
|
||||
hasTwoCameras = true;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> openCamera() async {
|
||||
try {
|
||||
isCameraLoading = true;
|
||||
await disposeCameraController();
|
||||
|
||||
await getAvailableCameras();
|
||||
|
||||
if (_cameras.isNotEmpty) {
|
||||
if (hasTwoCameras && frontCamera) {
|
||||
cameraController = CameraController(
|
||||
_cameras[0],
|
||||
ResolutionPreset.high,
|
||||
enableAudio: false,
|
||||
);
|
||||
}
|
||||
if (hasTwoCameras && !frontCamera) {
|
||||
cameraController = CameraController(
|
||||
_cameras[1],
|
||||
ResolutionPreset.high,
|
||||
enableAudio: false,
|
||||
);
|
||||
}
|
||||
|
||||
await cameraController?.initialize();
|
||||
|
||||
isCameraReady = true;
|
||||
isCameraLoading = false;
|
||||
notifyListeners();
|
||||
} else {
|
||||
isCameraReady = false;
|
||||
isCameraLoading = false;
|
||||
notifyListeners();
|
||||
}
|
||||
} catch (e) {
|
||||
isCameraReady = false;
|
||||
isCameraLoading = false;
|
||||
notifyListeners();
|
||||
eLog(e);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> takePicture() async {
|
||||
if (cameraController == null || !cameraController!.value.isInitialized) {
|
||||
return;
|
||||
}
|
||||
if (isLoading) return;
|
||||
|
||||
try {
|
||||
isLoading = true;
|
||||
notifyListeners();
|
||||
final image = await cameraController!.takePicture();
|
||||
|
||||
capturedImages.insert(0, image);
|
||||
|
||||
isLoading = false;
|
||||
} catch (e) {
|
||||
eLog(e);
|
||||
} finally {
|
||||
isLoading = false;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
void removeImage(int index) {
|
||||
if (index < capturedImages.length) {
|
||||
capturedImages.removeAt(index);
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> disposeCameraController() async {
|
||||
isCameraReady = false;
|
||||
notifyListeners();
|
||||
await cameraController?.dispose();
|
||||
cameraController = null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:camera/camera.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
class RImagePicker extends StatefulWidget {
|
||||
const RImagePicker({super.key, this.maxImages, required this.controller});
|
||||
final int? maxImages;
|
||||
final RImagePickerController controller;
|
||||
|
||||
@override
|
||||
State<RImagePicker> createState() => _RImagePickerState();
|
||||
}
|
||||
|
||||
class _RImagePickerState extends State<RImagePicker> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
widget.controller.openCamera();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
widget.controller.disposeCameraController();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.black,
|
||||
body: AnimatedBuilder(
|
||||
animation: widget.controller,
|
||||
builder: (context, child) {
|
||||
if (!widget.controller.isCameraReady) {
|
||||
return const Center(
|
||||
child: CoreLoadingIndicator(
|
||||
color: Colors.white,
|
||||
variant: CoreLoadingVariant.cupertino,
|
||||
size: CoreLoadingSize.medium,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return Stack(
|
||||
alignment: Alignment.center,
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
CameraPreview(widget.controller.cameraController!),
|
||||
|
||||
Positioned(
|
||||
top: 50,
|
||||
right: 10,
|
||||
child: GestureDetector(
|
||||
onTap: () => Get.back(),
|
||||
child: Container(
|
||||
width: 40.w,
|
||||
height: 40.h,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withAlpha(50),
|
||||
borderRadius: BorderRadius.circular(10.r),
|
||||
),
|
||||
child: Icon(
|
||||
CupertinoIcons.clear,
|
||||
color: Colors.white,
|
||||
size: 20,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Positioned(
|
||||
bottom: 40,
|
||||
right: 10,
|
||||
|
||||
child: RFab(
|
||||
onPressed: () => Get.back(),
|
||||
icon: Assets.vec.checkSvg.svg(),
|
||||
backgroundColor: AppColor.greenNormal,
|
||||
),
|
||||
),
|
||||
|
||||
if (widget.maxImages == null ||
|
||||
widget.controller.capturedImages.length <
|
||||
(widget.maxImages ?? 1000)) ...[
|
||||
Positioned(
|
||||
bottom: 40,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Center(
|
||||
child: FloatingActionButton(
|
||||
onPressed: widget.controller.isLoading
|
||||
? null
|
||||
: () async {
|
||||
await widget.controller.takePicture();
|
||||
},
|
||||
backgroundColor: Colors.white,
|
||||
child: widget.controller.isLoading
|
||||
? const SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
Colors.black,
|
||||
),
|
||||
),
|
||||
)
|
||||
: const Icon(Icons.camera_alt, color: Colors.black),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Positioned(
|
||||
bottom: 40,
|
||||
left: 10,
|
||||
|
||||
child: Center(
|
||||
child: FloatingActionButton(
|
||||
onPressed: widget.controller.isCameraLoading
|
||||
? null
|
||||
: () async {
|
||||
widget.controller.frontCamera =
|
||||
!widget.controller.frontCamera;
|
||||
|
||||
await widget.controller.openCamera();
|
||||
},
|
||||
backgroundColor: Colors.white,
|
||||
child: widget.controller.isCameraLoading
|
||||
? const SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
Colors.black,
|
||||
),
|
||||
),
|
||||
)
|
||||
: const Icon(Icons.cameraswitch, color: Colors.black),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
if (widget.controller.capturedImages.isNotEmpty) ...[
|
||||
Positioned(
|
||||
bottom: 120,
|
||||
left: 0,
|
||||
right: 0,
|
||||
height: 100.h,
|
||||
child: ListView.separated(
|
||||
itemCount: widget.controller.capturedImages.length,
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 20.w,
|
||||
vertical: 10.h,
|
||||
),
|
||||
scrollDirection: Axis.horizontal,
|
||||
separatorBuilder: (context, index) => SizedBox(width: 10.w),
|
||||
itemBuilder: (context, index) {
|
||||
final image = widget.controller.capturedImages[index];
|
||||
return Container(
|
||||
width: 100.w,
|
||||
height: 100.h,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.white, width: 2),
|
||||
borderRadius: BorderRadius.circular(8.r),
|
||||
image: DecorationImage(
|
||||
image: FileImage(File(image.path)),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
child: Stack(
|
||||
fit: StackFit.expand,
|
||||
children: [
|
||||
Positioned(
|
||||
top: 2,
|
||||
right: 2,
|
||||
child: GestureDetector(
|
||||
onTap: () =>
|
||||
widget.controller.removeImage(index),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(4),
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.red,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.close,
|
||||
size: 16,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,7 @@ class RTextField extends StatefulWidget {
|
||||
final BoxConstraints? boxConstraints;
|
||||
final RTextFieldVariant variant;
|
||||
final bool filled;
|
||||
final bool isFullHeight;
|
||||
final Color? filledColor;
|
||||
final Color? borderColor;
|
||||
final bool showCounter;
|
||||
@@ -92,6 +93,7 @@ class RTextField extends StatefulWidget {
|
||||
this.prefixIcon,
|
||||
this.suffix,
|
||||
this.boxConstraints,
|
||||
this.isFullHeight = false,
|
||||
|
||||
// 📐 Layout & appearance
|
||||
this.borderColor,
|
||||
@@ -201,8 +203,8 @@ class _RTextFieldState extends State<RTextField> {
|
||||
child: Padding(
|
||||
padding: widget.padding ?? EdgeInsets.zero,
|
||||
child: TextFormField(
|
||||
textAlignVertical: TextAlignVertical.center,
|
||||
controller: widget.controller,
|
||||
|
||||
focusNode: widget.focusNode,
|
||||
textAlign: widget.textAlign ?? TextAlign.start,
|
||||
readOnly: widget.readonly,
|
||||
@@ -229,7 +231,11 @@ class _RTextFieldState extends State<RTextField> {
|
||||
textInputAction: widget.textInputAction,
|
||||
autofillHints: widget.autofillHints,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: widget.isFullHeight ? widget.height / 3 : 0,
|
||||
),
|
||||
|
||||
errorStyle: widget.errorStyle,
|
||||
errorMaxLines: 1,
|
||||
isDense: widget.isDense,
|
||||
|
||||
@@ -50,3 +50,7 @@ export 'tabs/new_tab.dart';
|
||||
export 'tabs/r_segment.dart';
|
||||
export 'tabs/tab.dart';
|
||||
export 'vec_widget.dart';
|
||||
|
||||
//image picker
|
||||
export 'image_picker/image_picker_controller.dart';
|
||||
export 'image_picker/image_picker_widget.dart';
|
||||
|
||||
@@ -3,41 +3,37 @@ import 'package:logger/logger.dart';
|
||||
import 'package:rasadyar_core/injection/di.dart';
|
||||
|
||||
void iLog(dynamic message) {
|
||||
if(kDebugMode){
|
||||
if (kDebugMode) {
|
||||
diCore.get<Logger>().i(message.toString());
|
||||
}
|
||||
}
|
||||
|
||||
void wLog(dynamic message){
|
||||
if(kDebugMode){
|
||||
void wLog(dynamic message) {
|
||||
if (kDebugMode) {
|
||||
diCore.get<Logger>().w(message.toString());
|
||||
}
|
||||
}
|
||||
|
||||
void eLog(dynamic message) {
|
||||
if(kDebugMode){
|
||||
diCore.get<Logger>().e(message.toString());
|
||||
if (kDebugMode) {
|
||||
diCore.get<Logger>().e(message.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void dLog(dynamic message) {
|
||||
if(kDebugMode){
|
||||
diCore.get<Logger>().d(message.toString());
|
||||
if (kDebugMode) {
|
||||
diCore.get<Logger>().d(message.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void fLog(dynamic message){
|
||||
if(kDebugMode){
|
||||
diCore.get<Logger>().f(message.toString());
|
||||
void fLog(dynamic message) {
|
||||
if (kDebugMode) {
|
||||
diCore.get<Logger>().f(message.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void tLog(dynamic message) {
|
||||
if(kDebugMode){
|
||||
diCore.get<Logger>().t(message.toString());
|
||||
if (kDebugMode) {
|
||||
diCore.get<Logger>().t(message.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user