beta commit

This commit is contained in:
Odein
2023-10-26 15:04:34 +04:30
parent ddc5649b1c
commit 11f910bb1c
262 changed files with 31865 additions and 15718 deletions
@@ -1,320 +1,328 @@
import 'dart:async';
import 'dart:io';
import 'package:camera/camera.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'package:path_provider/path_provider.dart';
import 'package:provider/provider.dart';
import '../../../providers/test_results.dart';
class CaptureImage extends StatefulWidget {
@override
_CaptureImageState createState() {
return _CaptureImageState();
}
}
/// Returns a suitable camera icon for [direction].
IconData getCameraLensIcon(CameraLensDirection direction) {
switch (direction) {
case CameraLensDirection.back:
return Icons.camera_rear;
case CameraLensDirection.front:
return Icons.camera_front;
case CameraLensDirection.external:
return Icons.camera;
}
throw ArgumentError('Unknown lens direction');
}
void logError(String code, String message) =>
print('Error: $code\nError Message: $message');
class _CaptureImageState extends State<CaptureImage>
with WidgetsBindingObserver {
CameraController controller;
String imagePath;
// String videoPath;
VoidCallback videoPlayerListener;
bool isInit = true;
int curCamera = 0;
var cameras;
@override
void initState() {
super.initState();
WidgetsBinding.instance.addObserver(this);
}
@override
void didChangeDependencies() async {
if (isInit) {
cameras = await availableCameras();
onNewCameraSelected(cameras[curCamera]);
setState(() {
isInit = false;
});
}
super.didChangeDependencies();
}
@override
void dispose() {
WidgetsBinding.instance.removeObserver(this);
super.dispose();
}
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
// App state changed before we got the chance to initialize.
if (controller == null || !controller.value.isInitialized) {
return;
}
if (state == AppLifecycleState.inactive) {
controller?.dispose();
} else if (state == AppLifecycleState.resumed) {
if (controller != null) {
onNewCameraSelected(controller.description);
}
}
}
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
key: _scaffoldKey,
// appBar: AppBar(
// title: const Text('Take Picture'),
// ),
body: isInit
? Center(
child: CircularProgressIndicator(),
)
: Stack(children: <Widget>[
_cameraPreviewWidget(),
Positioned(
bottom: 100, left: 100, child: _captureControlRowWidget()),
Positioned(
bottom: 100,
right: 100,
child: InkWell(
onTap: () {
if (curCamera == 0) {
try {
onNewCameraSelected(cameras[1]);
setState(() {
curCamera = 1;
});
} catch (e) {}
} else {
onNewCameraSelected(cameras[0]);
setState(() {
curCamera = 0;
});
}
},
child: Icon(
curCamera == 0 ? Icons.camera_rear : Icons.camera_front,
size: 40,
color: Colors.white,
),
),
),
// _cameraTogglesRowWidget(cameras),
]),
),
);
}
/// Display the preview from the camera (or a message if the preview is not available).
Widget _cameraPreviewWidget() {
if (controller == null || !controller.value.isInitialized) {
return const Text(
'Tap a camera',
style: TextStyle(
color: Colors.white,
fontSize: 24.0,
fontWeight: FontWeight.w900,
),
);
} else {
return Container(
width: double.infinity,
child: CameraPreview(controller),
);
}
}
/// Toggle recording audio
/// Display the control bar with buttons to take pictures and record videos.
Widget _captureControlRowWidget() {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
IconButton(
icon: const Icon(
Icons.camera_alt,
size: 40,
color: Colors.white,
),
// color: Colors.blue,
onPressed: controller != null &&
controller.value.isInitialized &&
!controller.value.isRecordingVideo
? onTakePictureButtonPressed
: null,
),
],
);
}
getCameras() async {
return await availableCameras();
}
/// Display a row of toggle to select the camera (or a message if no camera is available).
// Widget _cameraTogglesRowWidget(var cameras) {
// final List<Widget> toggles = <Widget>[];
// if (cameras.isEmpty) {
// return const Text('No camera found');
// } else {
// for (CameraDescription cameraDescription in cameras) {
// print("${cameraDescription.name}");
// toggles.add(
// SizedBox(
// width: 90.0,
// child: RadioListTile<CameraDescription>(
// title: Icon(getCameraLensIcon(cameraDescription.lensDirection)),
// groupValue: controller?.description,
// value: cameraDescription,
// onChanged: controller != null && controller.value.isRecordingVideo
// ? null
// : onNewCameraSelected,
// ),
// ),
// );
// }
// }
// return Row(children: toggles);
// }
String timestamp() => DateTime.now().millisecondsSinceEpoch.toString();
void showInSnackBar(String message) {
_scaffoldKey.currentState.showSnackBar(SnackBar(content: Text(message)));
}
void onNewCameraSelected(CameraDescription cameraDescription) async {
print(cameraDescription.lensDirection.toString());
if (controller != null) {
await controller.dispose();
}
controller = CameraController(
cameraDescription,
ResolutionPreset.medium,
// enableAudio: enableAudio,
);
// If the controller is updated then update the UI.
controller.addListener(() {
if (mounted) setState(() {});
if (controller.value.hasError) {
showInSnackBar('Camera error ${controller.value.errorDescription}');
}
});
try {
await controller.initialize();
} on CameraException catch (e) {
_showCameraException(e);
}
if (mounted) {
setState(() {});
}
}
void onTakePictureButtonPressed() {
takePicture().then((String filePath) {
if (mounted) {
setState(() {
imagePath = filePath;
var profileProviderObject =
Provider.of<TestResultsProvider>(context, listen: false);
List<PlatformFile> files = profileProviderObject.catchImages;
print(imagePath);
files.add(PlatformFile(
name: 'test',
size: 0,
path: imagePath,
bytes: File(imagePath).readAsBytesSync()));
profileProviderObject.setCatchImages(files);
profileProviderObject.setImages();
print(imagePath);
});
if (filePath != null) {
Navigator.of(context).pop();
// showInSnackBar('Picture saved to $filePath');
}
}
});
}
Future<String> takePicture() async {
if (!controller.value.isInitialized) {
showInSnackBar('Error: select a camera first.');
return null;
}
final Directory extDir = await getApplicationDocumentsDirectory();
final String dirPath = '${extDir.path}/Pictures/flutter_test';
await Directory(dirPath).create(recursive: true);
final String filePath = '$dirPath/${timestamp()}.jpg';
if (controller.value.isTakingPicture) {
// A capture is already pending, do nothing.
return null;
}
try {
await controller.takePicture(filePath);
} on CameraException catch (e) {
_showCameraException(e);
return null;
}
return filePath;
}
void _showCameraException(CameraException e) {
logError(e.code, e.description);
showInSnackBar('Error: ${e.code}\n${e.description}');
}
}
// class CameraApp extends StatelessWidget {
// @override
// Widget build(BuildContext context) {
// return MaterialApp(
// home: CaptureImage(),
// );
// }
// }
// List<CameraDescription> cameras = [];
// Future<void> main() async {
// // Fetch the available cameras before initializing the app.
// try {
// WidgetsFlutterBinding.ensureInitialized();
// } on CameraException catch (e) {
// logError(e.code, e.description);
// }
// runApp(CameraApp());
// }
// ignore_for_file: dead_code
import 'dart:async';
import 'dart:io';
import 'package:camera/camera.dart';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'package:path_provider/path_provider.dart';
import 'package:provider/provider.dart';
import '../../../providers/test_results.dart';
class CaptureImage extends StatefulWidget {
@override
_CaptureImageState createState() {
return _CaptureImageState();
}
}
/// Returns a suitable camera icon for [direction].
IconData getCameraLensIcon(CameraLensDirection direction) {
switch (direction) {
case CameraLensDirection.back:
return Icons.camera_rear;
case CameraLensDirection.front:
return Icons.camera_front;
case CameraLensDirection.external:
return Icons.camera;
}
throw ArgumentError('Unknown lens direction');
}
void logError(String code, String message) =>
print('Error: $code\nError Message: $message');
class _CaptureImageState extends State<CaptureImage>
with WidgetsBindingObserver {
CameraController? controller;
String? imagePath;
// String videoPath;
VoidCallback? videoPlayerListener;
bool isInit = true;
int curCamera = 0;
var cameras;
@override
void initState() {
super.initState();
WidgetsBinding.instance.addObserver(this);
}
@override
void didChangeDependencies() async {
if (isInit) {
cameras = await availableCameras();
onNewCameraSelected(cameras[curCamera]);
setState(() {
isInit = false;
});
}
super.didChangeDependencies();
}
@override
void dispose() {
WidgetsBinding.instance.removeObserver(this);
super.dispose();
}
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
// App state changed before we got the chance to initialize.
if (controller == null || !controller!.value.isInitialized) {
return;
}
if (state == AppLifecycleState.inactive) {
controller?.dispose();
} else if (state == AppLifecycleState.resumed) {
if (controller != null) {
onNewCameraSelected(controller!.description);
}
}
}
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
key: _scaffoldKey,
// appBar: AppBar(
// title: const Text('Take Picture'),
// ),
body: isInit
? Center(
child: CircularProgressIndicator(
color: Colors.black,
),
)
: Stack(children: <Widget>[
_cameraPreviewWidget(),
Positioned(
bottom: 100, left: 100, child: _captureControlRowWidget()),
Positioned(
bottom: 100,
right: 100,
child: InkWell(
onTap: () {
if (curCamera == 0) {
try {
onNewCameraSelected(cameras[1]);
setState(() {
curCamera = 1;
});
} catch (e) {}
} else {
onNewCameraSelected(cameras[0]);
setState(() {
curCamera = 0;
});
}
},
child: Icon(
curCamera == 0 ? Icons.camera_rear : Icons.camera_front,
size: 40,
color: Colors.white,
),
),
),
// _cameraTogglesRowWidget(cameras),
]),
),
);
}
/// Display the preview from the camera (or a message if the preview is not available).
Widget _cameraPreviewWidget() {
if (controller == null || !controller!.value.isInitialized) {
return const Text(
'Tap a camera',
style: TextStyle(
color: Colors.white,
fontSize: 24.0,
fontWeight: FontWeight.w900,
),
);
} else {
return Container(
width: double.infinity,
child: CameraPreview(controller!),
);
}
}
/// Toggle recording audio
/// Display the control bar with buttons to take pictures and record videos.
Widget _captureControlRowWidget() {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
IconButton(
icon: const Icon(
Icons.camera_alt,
size: 40,
color: Colors.white,
),
// color: Colors.blue,
onPressed: controller != null &&
controller!.value.isInitialized &&
!controller!.value.isRecordingVideo
? onTakePictureButtonPressed
: null,
),
],
);
}
getCameras() async {
return await availableCameras();
}
/// Display a row of toggle to select the camera (or a message if no camera is available).
// Widget _cameraTogglesRowWidget(var cameras) {
// final List<Widget> toggles = <Widget>[];
// if (cameras.isEmpty) {
// return const Text('No camera found');
// } else {
// for (CameraDescription cameraDescription in cameras) {
// print("${cameraDescription.name}");
// toggles.add(
// SizedBox(
// width: 90.0,
// child: RadioListTile<CameraDescription>(
// title: Icon(getCameraLensIcon(cameraDescription.lensDirection)),
// groupValue: controller?.description,
// value: cameraDescription,
// onChanged: controller != null && controller.value.isRecordingVideo
// ? null
// : onNewCameraSelected,
// ),
// ),
// );
// }
// }
// return Row(children: toggles);
// }
String timestamp() => DateTime.now().millisecondsSinceEpoch.toString();
void showInSnackBar(String message) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(message),
),
);
}
void onNewCameraSelected(CameraDescription cameraDescription) async {
print(cameraDescription.lensDirection.toString());
if (controller != null) {
await controller!.dispose();
}
controller = CameraController(
cameraDescription,
ResolutionPreset.medium,
// enableAudio: enableAudio,
);
// If the controller is updated then update the UI.
controller!.addListener(() {
if (mounted) setState(() {});
if (controller!.value.hasError) {
showInSnackBar('Camera error ${controller!.value.errorDescription}');
}
});
try {
await controller!.initialize();
} on CameraException catch (e) {
_showCameraException(e);
}
if (mounted) {
setState(() {});
}
}
void onTakePictureButtonPressed() {
takePicture().then((String? filePath) {
if (mounted) {
setState(() {
imagePath = filePath;
var profileProviderObject =
Provider.of<TestResultsProvider>(context, listen: false);
List<PlatformFile> files = profileProviderObject.catchImages;
print(imagePath);
files.add(PlatformFile(
name: 'test',
size: 0,
path: imagePath,
bytes: File(imagePath!).readAsBytesSync()));
profileProviderObject.setCatchImages(files);
profileProviderObject.setImages();
print(imagePath);
});
if (filePath != null) {
Navigator.of(context).pop();
// showInSnackBar('Picture saved to $filePath');
}
}
});
}
Future<String?> takePicture() async {
if (!controller!.value.isInitialized) {
showInSnackBar('Error: select a camera first.');
return null;
}
final Directory extDir = await getApplicationDocumentsDirectory();
final String dirPath = '${extDir.path}/Pictures/flutter_test';
await Directory(dirPath).create(recursive: true);
final String filePath = '$dirPath/${timestamp()}.jpg';
if (controller!.value.isTakingPicture) {
// A capture is already pending, do nothing.
return null;
}
try {
await controller!.takePicture();
} on CameraException catch (e) {
_showCameraException(e);
return null;
}
return filePath;
}
void _showCameraException(CameraException e) {
logError(e.code, e.description!);
showInSnackBar('Error: ${e.code}\n${e.description}');
}
}
// class CameraApp extends StatelessWidget {
// @override
// Widget build(BuildContext context) {
// return MaterialApp(
// home: CaptureImage(),
// );
// }
// }
// List<CameraDescription> cameras = [];
// Future<void> main() async {
// // Fetch the available cameras before initializing the app.
// try {
// WidgetsFlutterBinding.ensureInitialized();
// } on CameraException catch (e) {
// logError(e.code, e.description);
// }
// runApp(CameraApp());
// }
File diff suppressed because it is too large Load Diff
@@ -1,57 +1,57 @@
import 'package:flutter/material.dart';
import '../../../config/routes.dart';
class TestResultAddSaveButton extends StatelessWidget {
const TestResultAddSaveButton({
Key key,
// @required GlobalKey<FormState> form,
// @required this.idCTRL,
@required double deviceBlockSize,
}) :
// _form = form,
_deviceBlockSize = deviceBlockSize,
super(key: key);
// final GlobalKey<FormState> _form;
// final TextEditingController idCTRL;
final double _deviceBlockSize;
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () {
// if (! _form.currentState.validate()) {
// return;
// }
Navigator.of(context).pushNamed(
Routes.labelDetailScreen,
// arguments: idCTRL.text,
);
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 5 * _deviceBlockSize,
vertical: 10,
),
margin: EdgeInsets.symmetric(horizontal: 20),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.blue, Colors.green],
),
borderRadius: BorderRadius.circular(7),
),
child: Align(
alignment: Alignment.center,
child: Text(
'GO!',
style: TextStyle(
color: Colors.white,
fontSize: 5 * _deviceBlockSize,
),
),
),
),
);
}
}
// import 'package:flutter/material.dart';
// import '../../../config/routes.dart';
// class TestResultAddSaveButton extends StatelessWidget {
// const TestResultAddSaveButton({
// Key? key,
// // @required GlobalKey<FormState> form,
// // @required this.idCTRL,
// required double deviceBlockSize,
// }) :
// // _form = form,
// _deviceBlockSize = deviceBlockSize,
// super(key: key);
// // final GlobalKey<FormState> _form;
// // final TextEditingController idCTRL;
// final double _deviceBlockSize;
// @override
// Widget build(BuildContext context) {
// return InkWell(
// onTap: () {
// // if (! _form.currentState.validate()) {
// // return;
// // }
// Navigator.of(context).pushNamed(
// Routes.labelDetailScreen,
// // arguments: idCTRL.text,
// );
// },
// child: Container(
// padding: EdgeInsets.symmetric(
// horizontal: 5 * _deviceBlockSize,
// vertical: 10,
// ),
// margin: EdgeInsets.symmetric(horizontal: 20),
// decoration: BoxDecoration(
// gradient: LinearGradient(
// colors: [Colors.blue, Colors.green],
// ),
// borderRadius: BorderRadius.circular(7),
// ),
// child: Align(
// alignment: Alignment.center,
// child: Text(
// 'GO!',
// style: TextStyle(
// color: Colors.white,
// fontSize: 5 * _deviceBlockSize,
// ),
// ),
// ),
// ),
// );
// }
// }
@@ -1,132 +1,137 @@
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
class TestResultAddSelectorBox extends StatefulWidget {
const TestResultAddSelectorBox({
Key key,
@required double deviceBlockSize,
@required this.dataCTRL,
@required this.dataVals,
@required String label,
}) : _deviceBlockSize = deviceBlockSize,
_label = label,
super(key: key);
final double _deviceBlockSize;
final TextEditingController dataCTRL;
final List<String> dataVals;
final String _label;
@override
_TestResultAddSelectorBoxState createState() =>
_TestResultAddSelectorBoxState();
}
class _TestResultAddSelectorBoxState extends State<TestResultAddSelectorBox> {
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.symmetric(vertical: 5),
// height: 65,
child: Row(
// width: double.infinity,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
FontAwesomeIcons.alignLeft,
color: Colors.grey,
size: 6 * widget._deviceBlockSize,
),
SizedBox(
width: 4 * widget._deviceBlockSize,
),
Expanded(
// width: MediaQuery.of(context).size.width - 70,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
Text(
widget._label,
style: TextStyle(
fontSize: 3 * widget._deviceBlockSize,
color: Colors.grey,
fontWeight: FontWeight.w100,
),
),
],
),
Container(
height: 40,
child: DropdownButtonFormField(
decoration: InputDecoration(
contentPadding: EdgeInsets.only(left: 0),
// border: InputBorder.none,
),
iconSize: 7 * widget._deviceBlockSize,
icon: Icon(
FontAwesomeIcons.angleDown,
color: Colors.black,
),
isExpanded: true,
hint: Container(
// width: 100,
height: 70,
padding: const EdgeInsets.symmetric(horizontal: 0),
child: Text(
widget.dataCTRL.text,
// textDirection: TextDirection.rtl,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.w700,
color: Colors.black,
fontSize: 3 * widget._deviceBlockSize,
),
),
// TextFormField(
// controller: widget.dataCTRL,
// decoration: InputDecoration(
// contentPadding: EdgeInsets.only(bottom: 15),
// isDense: true,
// ),
// style: TextStyle(
// fontWeight: FontWeight.w700,
// color: Colors.black,
// ),
// // minLines: 1,
// // maxLines: 3,
// ),
),
isDense: true,
items: widget.dataVals.map((val) {
return new DropdownMenuItem<String>(
value: val,
child: Container(
child: Text(
val,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.w700,
color: Colors.black,
fontSize: 3 * widget._deviceBlockSize,
),
),
),
);
}).toList(),
onChanged: (val) {
setState(() {
widget.dataCTRL.text = val;
});
},
),
),
]),
),
],
),
);
}
}
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
class TestResultAddSelectorBox extends StatefulWidget {
const TestResultAddSelectorBox({
Key? key,
required double deviceBlockSize,
required this.dataCTRL,
required this.dataVals,
required String label,
}) : _deviceBlockSize = deviceBlockSize,
_label = label,
super(key: key);
final double _deviceBlockSize;
final TextEditingController dataCTRL;
final List<String> dataVals;
final String _label;
@override
_TestResultAddSelectorBoxState createState() =>
_TestResultAddSelectorBoxState();
}
class _TestResultAddSelectorBoxState extends State<TestResultAddSelectorBox> {
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.symmetric(vertical: 5),
// height: 65,
child: Row(
// width: double.infinity,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
FontAwesomeIcons.alignLeft,
color: Colors.grey,
size: 6 * widget._deviceBlockSize,
),
SizedBox(
width: 4 * widget._deviceBlockSize,
),
Expanded(
// width: MediaQuery.of(context).size.width - 70,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
Text(
widget._label,
style: TextStyle(
fontSize: 3 * widget._deviceBlockSize,
color: Colors.grey,
fontWeight: FontWeight.w100,
),
),
],
),
Container(
height: 40,
child: DropdownButtonFormField(
decoration: InputDecoration(
contentPadding: EdgeInsets.only(left: 0),
// border: InputBorder.none,
),
iconSize: 7 * widget._deviceBlockSize,
icon: Icon(
FontAwesomeIcons.angleDown,
color: Colors.black,
),
isExpanded: true,
hint: Container(
// width: 100,
height: 70,
padding: const EdgeInsets.symmetric(horizontal: 0),
child: Text(
widget.dataCTRL.text,
// textDirection: TextDirection.rtl,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.w700,
color: Colors.black,
fontSize: 3 * widget._deviceBlockSize,
),
),
// TextFormField(
// controller: widget.dataCTRL,
// decoration: InputDecoration(
// contentPadding: EdgeInsets.only(bottom: 15),
// isDense: true,
// ),
// style: TextStyle(
// fontWeight: FontWeight.w700,
// color: Colors.black,
// ),
// // minLines: 1,
// // maxLines: 3,
// ),
),
isDense: true,
items: widget.dataVals.map(
(val) {
return new DropdownMenuItem<String>(
value: val,
child: Container(
child: Text(
val,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.w700,
color: Colors.black,
fontSize: 3 * widget._deviceBlockSize,
),
),
),
);
},
).toList(),
onChanged: (val) {
setState(
() {
widget.dataCTRL.text = val!;
},
);
},
),
),
],
),
),
],
),
);
}
}
@@ -1,259 +1,276 @@
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:url_launcher/url_launcher.dart';
class DatasBox extends StatelessWidget {
const DatasBox({
Key key,
@required this.datas,
@required double deviceBlockSize,
}) : _deviceBlockSize = deviceBlockSize,
super(key: key);
final Map<String, Object> datas;
final double _deviceBlockSize;
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.all(20),
child: ListView(
children: <Widget>[
Container(
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
color: Color.fromRGBO(230, 230, 230, 1),
border: Border(
left: BorderSide(
color: Colors.pink,
width: 2,
),
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
DateFormat.yMMMd().format(
DateTime.parse(
datas['date'],
),
),
style: TextStyle(
color: Colors.red,
),
),
Divider(),
Text(
datas['test_type_name'],
style: TextStyle(
color: Colors.red,
fontWeight: FontWeight.w700,
),
),
SizedBox(
height: 30,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Test Register ID',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas['id'].toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Autoclave ID',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas['auto_cleave_id'].toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Hospital',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas['hospital'].toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Date',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
DateFormat('d-M-y').format(
DateTime.parse(
datas['date'],
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Status',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas['accepted'] == 'Accepted'
? 'Accepted'
: 'Rejected',
style: TextStyle(
fontWeight: FontWeight.w700,
color: datas['accepted'] == 'Accepted'
? Colors.green
: Colors.red,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Description',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas['description'].toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
],
),
),
SizedBox(height: 20,),
InkWell(
onTap: () async=> await launch(
'https://cssd-doc.com/Show/TestResult/${datas['id'].toString()}',
// 'https://cssd-doc.com/api/TestResults/${datas['id'].toString()}',
// forceSafariVC: true,
// forceWebView: true,
// headers: <String, String>{'my_header_key': 'my_header_value'},
// child: Text('Show Full Details'),
),
child: Container(
padding: EdgeInsets.symmetric(vertical: 20),
width: double.infinity,
decoration: BoxDecoration(
color: Color.fromRGBO(230, 230, 230, 1),
borderRadius: BorderRadius.circular(25),
),
child: Center(
child: Text(
'Show More Details',
style: TextStyle(fontWeight: FontWeight.w700),
),
),
),
)
],
),
);
}
}
import 'package:cssd/config/colors.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:url_launcher/url_launcher.dart';
class DatasBox extends StatelessWidget {
const DatasBox({
Key? key,
required this.datas,
required double deviceBlockSize,
}) : _deviceBlockSize = deviceBlockSize,
super(key: key);
final Map<String, dynamic> datas;
final double _deviceBlockSize;
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.all(20),
child: ListView(
children: <Widget>[
SizedBox(
height: 10,
),
Text(
'Test Result Details',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
letterSpacing: 3,
),
),
SizedBox(
height: 10,
),
Container(
padding: EdgeInsets.all(10),
decoration: BoxDecoration(
color: Color.fromRGBO(230, 230, 230, 1),
border: Border(
left: BorderSide(
color: datas['accepted'] == 'Accepted' ? kLightBlue : kPink,
width: 2,
),
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
DateFormat.yMMMd().format(
DateTime.parse(
datas['date'],
),
),
style: TextStyle(
color: datas['accepted'] == 'Accepted' ? kLightBlue : kPink,
),
),
Divider(),
Text(
datas['test_type_name'],
style: TextStyle(
color: datas['accepted'] == 'Accepted' ? kLightBlue : kPink,
fontWeight: FontWeight.w700,
),
),
SizedBox(
height: 30,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Test Register ID',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas['id'].toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Autoclave ID',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas['auto_cleave_id'].toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Hospital',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas['hospital'].toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Date',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
DateFormat('d-M-y').format(
DateTime.parse(
datas['date'],
),
),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Status',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas['accepted'] == 'Accepted' ||
datas['verified'] == 'Verified'
? 'Accepted'
: 'Rejected',
style: TextStyle(
fontWeight: FontWeight.w700,
color: datas['accepted'] == 'Accepted'
? kLightBlue
: kPink,
),
overflow: TextOverflow.clip,
),
),
],
),
Divider(),
SizedBox(
height: 5,
),
Row(
children: <Widget>[
Container(
width: 35 * _deviceBlockSize,
child: Text(
'Description',
style: TextStyle(
color: Colors.grey,
),
),
),
Container(
width: 45 * _deviceBlockSize,
child: Text(
datas['description'].toString(),
style: TextStyle(
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.clip,
),
),
],
),
],
),
),
SizedBox(
height: 20,
),
InkWell(
onTap: () async => await launch(
'https://cssd-doc.com/Show/TestResult/${datas['id'].toString()}',
// 'https://cssd-doc.com/api/TestResults/${datas['id'].toString()}',
// forceSafariVC: true,
// forceWebView: true,
// headers: <String, String>{'my_header_key': 'my_header_value'},
// child: Text('Show Full Details'),
),
child: Container(
padding: EdgeInsets.symmetric(vertical: 20),
width: double.infinity,
decoration: BoxDecoration(
color: Color.fromRGBO(230, 230, 230, 1),
borderRadius: BorderRadius.circular(25),
),
child: Center(
child: Text(
'Show More Details',
style: TextStyle(fontWeight: FontWeight.w700),
),
),
),
)
],
),
);
}
}
@@ -1,74 +1,76 @@
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:intl/intl.dart' as DateEditor;
class TestResultFilterDatePicker extends StatefulWidget {
TestResultFilterDatePicker({
Key key,
@required this.dateCTRL,
@required double deviceBlockSize,
@required String label,
}) : _deviceBlockSize = deviceBlockSize,
_label = label,
super(key: key);
final TextEditingController dateCTRL;
final double _deviceBlockSize;
final String _label;
@override
_TestResultFilterDatePickerState createState() => _TestResultFilterDatePickerState();
}
class _TestResultFilterDatePickerState extends State<TestResultFilterDatePicker> {
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () async {
var res = await showDatePicker(
context: context,
initialDate: DateTime.now(),
firstDate: DateTime(2010, 1),
lastDate: DateTime(2101),
);
if (res != null) {
setState(
() {
widget.dateCTRL.text = DateEditor.DateFormat('y-M-d').format(res);
// sDateValue =
// DateEditor.DateFormat('y-M-d').format(
// dateTimeS,
// ); // baraye tavize makane gharar giri baraye api
},
);
}
},
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Expanded(
child: TextField(
enabled: false,
controller: widget.dateCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.calendarAlt,
size: 7 * widget._deviceBlockSize,
),
labelText: widget._label,
isDense: true,
contentPadding: EdgeInsets.only(bottom: 12, right: 3, left: 3),
// border: InputBorder.none,
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * widget._deviceBlockSize,
),
),
),
Icon(FontAwesomeIcons.angleDown)
],
),
);
}
}
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:intl/intl.dart' as DateEditor;
class TestResultFilterDatePicker extends StatefulWidget {
TestResultFilterDatePicker({
Key? key,
required this.dateCTRL,
required double deviceBlockSize,
required String label,
}) : _deviceBlockSize = deviceBlockSize,
_label = label,
super(key: key);
final TextEditingController dateCTRL;
final double _deviceBlockSize;
final String _label;
@override
_TestResultFilterDatePickerState createState() =>
_TestResultFilterDatePickerState();
}
class _TestResultFilterDatePickerState
extends State<TestResultFilterDatePicker> {
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () async {
var res = await showDatePicker(
context: context,
initialDate: DateTime.now(),
firstDate: DateTime(2010, 1),
lastDate: DateTime(2101),
);
if (res != null) {
setState(
() {
widget.dateCTRL.text = DateEditor.DateFormat('y-M-d').format(res);
// sDateValue =
// DateEditor.DateFormat('y-M-d').format(
// dateTimeS,
// ); // baraye tavize makane gharar giri baraye api
},
);
}
},
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Expanded(
child: TextField(
enabled: false,
controller: widget.dateCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.calendarAlt,
size: 7 * widget._deviceBlockSize,
),
labelText: widget._label,
isDense: true,
contentPadding: EdgeInsets.only(bottom: 12, right: 3, left: 3),
// border: InputBorder.none,
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * widget._deviceBlockSize,
),
),
),
Icon(FontAwesomeIcons.angleDown)
],
),
);
}
}
@@ -1,88 +1,87 @@
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
class DropDownBox extends StatefulWidget {
DropDownBox({
Key key,
@required this.values,
}) : super(key: key);
final List<String> values;
@override
_DropDownBoxState createState() => _DropDownBoxState();
}
class _DropDownBoxState extends State<DropDownBox> {
String _curValue;
@override
void initState() {
_curValue = widget.values[0];
super.initState();
}
@override
Widget build(BuildContext context) {
// _curValue = widget.values[0];
// final ThemeData _theme = Theme.of(context);
// final Color _mainFontColor = _theme.textSelectionColor;
final _media = MediaQuery.of(context);
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100;
return Row(
// width: double.infinity,
children: <Widget>[
Icon(
FontAwesomeIcons.sortNumericDown,
color: Colors.grey,
size: 4 * _deviceBlockSize,
),
SizedBox(
width: _deviceBlockSize,
),
Expanded(
// width: MediaQuery.of(context).size.width - 70,
child: DropdownButton(
focusColor: Colors.red,
icon: Icon(FontAwesomeIcons.angleDown),
isExpanded: true,
hint: Padding(
padding: const EdgeInsets.symmetric(horizontal: 4),
child: Text(
_curValue,
style: TextStyle(
fontWeight: FontWeight.w700,
color: Colors.black,
// color: _mainFontColor,
fontSize: 3.5 * _deviceBlockSize,
),
),
),
isDense: true,
items: widget.values.map((String value) {
return new DropdownMenuItem<String>(
value: value,
child: Container(
child: Text(
value,
style: TextStyle(
// color: _mainFontColor,
fontSize: 4 * _deviceBlockSize,
),
),
),
);
}).toList(),
onChanged: (val) {
setState(() {
_curValue = val;
});
},
),
),
]);
}
}
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
class DropDownBox extends StatefulWidget {
DropDownBox({
Key? key,
required this.values,
}) : super(key: key);
final List<String> values;
@override
_DropDownBoxState createState() => _DropDownBoxState();
}
class _DropDownBoxState extends State<DropDownBox> {
String? _curValue;
@override
void initState() {
_curValue = widget.values[0];
super.initState();
}
@override
Widget build(BuildContext context) {
// _curValue = widget.values[0];
// final ThemeData _theme = Theme.of(context);
// final Color _mainFontColor = _theme.textSelectionColor;
final _media = MediaQuery.of(context);
// final double _pixelRatio = (_media.size.height / _media.size.width * 7 / 5);
final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100;
return Row(
// width: double.infinity,
children: <Widget>[
Icon(
FontAwesomeIcons.sortNumericDown,
color: Colors.grey,
size: 4 * _deviceBlockSize,
),
SizedBox(
width: _deviceBlockSize,
),
Expanded(
// width: MediaQuery.of(context).size.width - 70,
child: DropdownButton(
focusColor: Colors.red,
icon: Icon(FontAwesomeIcons.angleDown),
isExpanded: true,
hint: Padding(
padding: const EdgeInsets.symmetric(horizontal: 4),
child: Text(
_curValue!,
style: TextStyle(
fontWeight: FontWeight.w700,
color: Colors.black,
// color: _mainFontColor,
fontSize: 3.5 * _deviceBlockSize,
),
),
),
isDense: true,
items: widget.values.map((String value) {
return new DropdownMenuItem<String>(
value: value,
child: Container(
child: Text(
value,
style: TextStyle(
// color: _mainFontColor,
fontSize: 4 * _deviceBlockSize,
),
),
),
);
}).toList(),
onChanged: (val) {
setState(() {
_curValue = val;
});
},
),
),
]);
}
}
@@ -1,130 +1,130 @@
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
class TestResultFilterSelectorBox extends StatefulWidget {
const TestResultFilterSelectorBox({
Key key,
@required double deviceBlockSize,
@required this.dataCTRL,
@required this.dataVals,
@required String label,
}) : _deviceBlockSize = deviceBlockSize,
_label = label,
super(key: key);
final double _deviceBlockSize;
final TextEditingController dataCTRL;
final List<String> dataVals;
final String _label;
@override
_TestResultFilterSelectorBoxState createState() =>
_TestResultFilterSelectorBoxState();
}
class _TestResultFilterSelectorBoxState
extends State<TestResultFilterSelectorBox> {
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.symmetric(vertical: 5),
// height: 65,
child: Row(
// width: double.infinity,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
FontAwesomeIcons.alignLeft,
color: Colors.grey,
size: 7 * widget._deviceBlockSize,
),
SizedBox(
width: 4 * widget._deviceBlockSize,
),
Expanded(
// width: MediaQuery.of(context).size.width - 70,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
Text(
widget._label,
style: TextStyle(
fontSize: 3.5 * widget._deviceBlockSize,
color: Colors.grey,
fontWeight: FontWeight.w100,
),
),
],
),
Container(
// height: 30,
child: DropdownButtonFormField(
decoration: InputDecoration(
contentPadding: EdgeInsets.only(left: 0),
// border: InputBorder.none,
),
iconSize: 7 * widget._deviceBlockSize,
icon: Icon(
FontAwesomeIcons.angleDown,
color: Colors.black,
),
isExpanded: true,
hint: Container(
// width: 100,
height: 70,
padding: const EdgeInsets.symmetric(horizontal: 0),
child: Text(
widget.dataCTRL.text,
// textDirection: TextDirection.rtl,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.w700,
color: Colors.black,
fontSize: 5 * widget._deviceBlockSize),
),
// TextFormField(
// controller: widget.dataCTRL,
// decoration: InputDecoration(
// contentPadding: EdgeInsets.only(bottom: 15),
// isDense: true,
// ),
// style: TextStyle(
// fontWeight: FontWeight.w700,
// color: Colors.black,
// ),
// // minLines: 1,
// // maxLines: 3,
// ),
),
isDense: true,
items: widget.dataVals.map((val) {
return new DropdownMenuItem<String>(
value: val,
child: Container(
child: Text(
val,
style: TextStyle(
// color: _mainFontColor,
fontSize: 4 * widget._deviceBlockSize,
),
),
),
);
}).toList(),
onChanged: (val) {
setState(() {
widget.dataCTRL.text = val;
});
},
),
),
]),
),
],
),
);
}
}
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
class TestResultFilterSelectorBox extends StatefulWidget {
const TestResultFilterSelectorBox({
Key? key,
required double deviceBlockSize,
required this.dataCTRL,
required this.dataVals,
required String label,
}) : _deviceBlockSize = deviceBlockSize,
_label = label,
super(key: key);
final double _deviceBlockSize;
final TextEditingController dataCTRL;
final List<String> dataVals;
final String _label;
@override
_TestResultFilterSelectorBoxState createState() =>
_TestResultFilterSelectorBoxState();
}
class _TestResultFilterSelectorBoxState
extends State<TestResultFilterSelectorBox> {
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.symmetric(vertical: 5),
// height: 65,
child: Row(
// width: double.infinity,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
FontAwesomeIcons.alignLeft,
color: Colors.grey,
size: 7 * widget._deviceBlockSize,
),
SizedBox(
width: 4 * widget._deviceBlockSize,
),
Expanded(
// width: MediaQuery.of(context).size.width - 70,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
Text(
widget._label,
style: TextStyle(
fontSize: 3.5 * widget._deviceBlockSize,
color: Colors.grey,
fontWeight: FontWeight.w100,
),
),
],
),
Container(
// height: 30,
child: DropdownButtonFormField(
decoration: InputDecoration(
contentPadding: EdgeInsets.only(left: 0),
// border: InputBorder.none,
),
iconSize: 7 * widget._deviceBlockSize,
icon: Icon(
FontAwesomeIcons.angleDown,
color: Colors.black,
),
isExpanded: true,
hint: Container(
// width: 100,
height: 70,
padding: const EdgeInsets.symmetric(horizontal: 0),
child: Text(
widget.dataCTRL.text,
// textDirection: TextDirection.rtl,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontWeight: FontWeight.w700,
color: Colors.black,
fontSize: 5 * widget._deviceBlockSize),
),
// TextFormField(
// controller: widget.dataCTRL,
// decoration: InputDecoration(
// contentPadding: EdgeInsets.only(bottom: 15),
// isDense: true,
// ),
// style: TextStyle(
// fontWeight: FontWeight.w700,
// color: Colors.black,
// ),
// // minLines: 1,
// // maxLines: 3,
// ),
),
isDense: true,
items: widget.dataVals.map((val) {
return new DropdownMenuItem<String>(
value: val,
child: Container(
child: Text(
val,
style: TextStyle(
// color: _mainFontColor,
fontSize: 4 * widget._deviceBlockSize,
),
),
),
);
}).toList(),
onChanged: (val) {
setState(() {
widget.dataCTRL.text = val!;
});
},
),
),
]),
),
],
),
);
}
}
@@ -1,35 +1,35 @@
import 'package:flutter/material.dart';
import '../../../config/routes.dart';
class TestResultAddButton extends StatelessWidget {
const TestResultAddButton({
Key key,
@required double deviceBlockSize,
}) : _deviceBlockSize = deviceBlockSize,
super(key: key);
final double _deviceBlockSize;
@override
Widget build(BuildContext context) {
return InkWell(
customBorder: CircleBorder(),
onTap: () {
Navigator.of(context).pushNamed(Routes.testResultAddScreen);
},
child: Container(
padding: EdgeInsets.all(5),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.redAccent,
),
child: Icon(
Icons.add,
size: 10 * _deviceBlockSize,
color: Colors.white,
),
),
);
}
}
import 'package:flutter/material.dart';
import '../../../config/routes.dart';
class TestResultAddButton extends StatelessWidget {
const TestResultAddButton({
Key? key,
required double deviceBlockSize,
}) : _deviceBlockSize = deviceBlockSize,
super(key: key);
final double _deviceBlockSize;
@override
Widget build(BuildContext context) {
return InkWell(
customBorder: CircleBorder(),
onTap: () {
Navigator.of(context).pushNamed(Routes.testResultAddScreen);
},
child: Container(
padding: EdgeInsets.all(5),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.redAccent,
),
child: Icon(
Icons.add,
size: 10 * _deviceBlockSize,
color: Colors.white,
),
),
);
}
}
@@ -1,76 +1,77 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../../providers/test_results.dart';
class TestResultChip extends StatelessWidget {
const TestResultChip({
Key key,
@required double deviceBlockSize,
@required String label,
@required String id,
@required String labelID,
@required String testType,
@required String hospital,
@required String username,
@required String fDate,
@required String uDate,
}) : _deviceBlockSize = deviceBlockSize,
_id = id,
_labelID = labelID,
_testType = testType,
_hispotal = hospital,
_label = label,
_username = username,
_fDate = fDate,
_uDate = uDate,
super(key: key);
final double _deviceBlockSize;
final String _id;
final String _labelID;
final String _testType;
final String _hispotal;
final String _label;
final String _username;
final String _fDate;
final String _uDate;
@override
Widget build(BuildContext context) {
return Row(children: <Widget>[
SizedBox(
width: _deviceBlockSize,
),
Chip(
backgroundColor: Colors.black,
label: Text(
_label,
style: TextStyle(
color: Colors.white,
),
),
deleteIcon: Icon(
Icons.close,
color: Colors.white,
),
onDeleted: () {
var labelProviderObject = Provider.of<TestResultsProvider>(context);
labelProviderObject.setFilters(
_id,
_labelID,
_username,
_testType,
_hispotal,
_fDate,
_uDate,
);
labelProviderObject.setLoading();
labelProviderObject.getTestResults().then((_) {
labelProviderObject.resetLoading();
});
},
),
]);
}
}
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../../providers/test_results.dart';
class TestResultChip extends StatelessWidget {
const TestResultChip({
Key? key,
required double deviceBlockSize,
required String label,
required String id,
required String labelID,
required String testType,
required String hospital,
required String username,
required String fDate,
required String uDate,
}) : _deviceBlockSize = deviceBlockSize,
_id = id,
_labelID = labelID,
_testType = testType,
_hispotal = hospital,
_label = label,
_username = username,
_fDate = fDate,
_uDate = uDate,
super(key: key);
final double _deviceBlockSize;
final String _id;
final String _labelID;
final String _testType;
final String _hispotal;
final String _label;
final String _username;
final String _fDate;
final String _uDate;
@override
Widget build(BuildContext context) {
return Row(children: <Widget>[
SizedBox(
width: _deviceBlockSize,
),
Chip(
backgroundColor: Colors.black,
label: Text(
_label,
style: TextStyle(
color: Colors.white,
),
),
deleteIcon: Icon(
Icons.close,
color: Colors.white,
),
onDeleted: () {
var labelProviderObject =
Provider.of<TestResultsProvider>(context, listen: false);
labelProviderObject.setFilters(
_id,
_labelID,
_username,
_testType,
_hispotal,
_fDate,
_uDate,
);
labelProviderObject.setLoading();
labelProviderObject.getTestResults().then((_) {
labelProviderObject.resetLoading();
});
},
),
]);
}
}
@@ -1,93 +1,63 @@
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import '../../../config/routes.dart';
// class TestResultFloatingButton extends StatelessWidget {
// const TestResultFloatingButton({
// Key key,
// @required double deviceBlockSize,
// }) : _deviceBlockSize = deviceBlockSize,
// super(key: key);
// final double _deviceBlockSize;
// @override
// Widget build(BuildContext context) {
// return InkWell(
// onTap: () {
// Navigator.of(context).popAndPushNamed(Routes.testResultAddScreen);
// },
// child: Container(
// padding: EdgeInsets.all(5),
// decoration: BoxDecoration(
// shape: BoxShape.circle,
// color: Color.fromRGBO(0, 190, 190, 1),
// ),
// child: Icon(
// Icons.add,
// size: 10 * _deviceBlockSize,
// color: Colors.white,
// ),
// ),
// );
// }
// }
class TestResultFloatingButton extends StatelessWidget {
const TestResultFloatingButton({
Key key,
@required double deviceBlockSize,
}) : _deviceBlockSize = deviceBlockSize,
super(key: key);
final double _deviceBlockSize;
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
InkWell(
customBorder: CircleBorder(),
onTap: () {
Navigator.of(context).pushNamed(Routes.testScanScreen);
},
child: Container(
padding: EdgeInsets.all(2.5 * _deviceBlockSize),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
FontAwesomeIcons.barcode,
size: 7.1 * _deviceBlockSize,
color: Colors.white,
),
),
),
SizedBox(
width: 2 * _deviceBlockSize,
),
InkWell(
customBorder: CircleBorder(),
onTap: () {
Navigator.of(context).pushReplacementNamed(Routes.testResultAddScreen);
},
child: Container(
padding: EdgeInsets.all(_deviceBlockSize),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Color.fromRGBO(0, 190, 190, 1),
),
child: Icon(
Icons.add,
size: 10 * _deviceBlockSize,
color: Colors.white,
),
),
),
],
);
}
}
import 'package:cssd/config/colors.dart';
import 'package:flutter/material.dart';
import '../../../config/routes.dart';
class TestResultFloatingButton extends StatelessWidget {
const TestResultFloatingButton({
Key? key,
required double deviceBlockSize,
}) : _deviceBlockSize = deviceBlockSize,
super(key: key);
final double _deviceBlockSize;
@override
Widget build(BuildContext context) {
return Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
InkWell(
customBorder: CircleBorder(),
onTap: () {
Navigator.of(context).pushNamed(Routes.testScanScreen);
},
child: Container(
padding: EdgeInsets.all(2.5 * _deviceBlockSize),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.black,
),
child: Icon(
Icons.qr_code_scanner,
size: 7.1 * _deviceBlockSize,
color: Colors.white,
),
),
),
SizedBox(
width: 2 * _deviceBlockSize,
),
InkWell(
customBorder: CircleBorder(),
onTap: () {
Navigator.of(context)
.pushReplacementNamed(Routes.testResultAddScreen);
},
child: Container(
padding: EdgeInsets.all(_deviceBlockSize),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: kLightBlue,
),
child: Icon(
Icons.add,
size: 10 * _deviceBlockSize,
color: Colors.white,
),
),
),
],
);
}
}
@@ -1,48 +1,48 @@
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
import '../../../providers/test_results.dart';
class TestResultSearchBox extends StatelessWidget {
const TestResultSearchBox({
Key key,
@required this.searchCTRL,
@required double deviceBlockSize,
}) : _deviceBlockSize = deviceBlockSize,
super(key: key);
final TextEditingController searchCTRL;
final double _deviceBlockSize;
@override
Widget build(BuildContext context) {
return TextField(
onEditingComplete: () {
FocusScope.of(context).unfocus();
},
onChanged: (value) {
Provider.of<TestResultsProvider>(context, listen: false).search(value);
},
controller: searchCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.search,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Search by test name',
isDense: true,
contentPadding: EdgeInsets.symmetric(vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.visiblePassword,
);
}
}
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
import '../../../providers/test_results.dart';
class TestResultSearchBox extends StatelessWidget {
const TestResultSearchBox({
Key? key,
required this.searchCTRL,
required double deviceBlockSize,
}) : _deviceBlockSize = deviceBlockSize,
super(key: key);
final TextEditingController searchCTRL;
final double _deviceBlockSize;
@override
Widget build(BuildContext context) {
return TextField(
onEditingComplete: () {
FocusScope.of(context).unfocus();
},
onChanged: (value) {
Provider.of<TestResultsProvider>(context, listen: false).search(value);
},
controller: searchCTRL,
decoration: InputDecoration(
icon: Icon(
FontAwesomeIcons.search,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Search by test name',
isDense: true,
contentPadding: EdgeInsets.symmetric(vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.visiblePassword,
);
}
}