mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-10 22:18:55 +03:30
97 lines
2.9 KiB
Dart
Executable File
97 lines
2.9 KiB
Dart
Executable File
import '../../config/routes.dart';
|
|
import '../../models/label_models.dart';
|
|
import '../../providers/connectivity.dart';
|
|
import '../../providers/labels.dart';
|
|
import '../../widgets/Global/internet_error.dart';
|
|
import '../../widgets/LabelScreens/Detail/datas_box.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
class LabelDetailScreen extends StatefulWidget {
|
|
// static const route = '/LabelDetailScreen';
|
|
// final String testResultId;
|
|
|
|
// LabelDetailScreen({this.testResultId});
|
|
|
|
@override
|
|
_LabelDetailScreenState createState() => _LabelDetailScreenState();
|
|
}
|
|
|
|
class _LabelDetailScreenState extends State<LabelDetailScreen> {
|
|
bool isEmpty = false;
|
|
bool isInit = true;
|
|
LabelDetailsObject? datas;
|
|
|
|
@override
|
|
void didChangeDependencies() async {
|
|
if (isInit) {
|
|
var _id = ModalRoute.of(context)!.settings.arguments;
|
|
await Provider.of<LabelsProvider>(context, listen: false)
|
|
.showLabelResult(_id.toString())
|
|
.then(
|
|
(result) {
|
|
setState(
|
|
() {
|
|
if (result.id == 'null') {
|
|
isEmpty = true;
|
|
}
|
|
datas = result;
|
|
isInit = false;
|
|
},
|
|
);
|
|
},
|
|
);
|
|
// print(datas);
|
|
}
|
|
super.didChangeDependencies();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
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 SafeArea(
|
|
child: Scaffold(
|
|
appBar: AppBar(
|
|
titleSpacing: -10,
|
|
title: Text(
|
|
'Labels',
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
backgroundColor: Colors.black,
|
|
leading: IconButton(
|
|
icon: Icon(
|
|
Icons.keyboard_arrow_left,
|
|
color: Colors.white,
|
|
size: 35,
|
|
),
|
|
onPressed: () => Navigator.of(context).pop(),
|
|
),
|
|
),
|
|
body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) {
|
|
return connection.conStatus != 'offline'
|
|
? isInit
|
|
? Center(
|
|
child: CircularProgressIndicator(
|
|
color: Colors.black,
|
|
),
|
|
)
|
|
: isEmpty
|
|
? Center(
|
|
child: Text('This Label dos\'nt exists!'),
|
|
)
|
|
: LabelDetailsDataBox(
|
|
datas: datas!,
|
|
deviceBlockSize: _deviceBlockSize,
|
|
)
|
|
: ConnectionErrorBox();
|
|
}),
|
|
),
|
|
);
|
|
}
|
|
}
|