mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-11 02:28:54 +03:30
87 lines
2.6 KiB
Dart
Executable File
87 lines
2.6 KiB
Dart
Executable File
import '../../config/routes.dart';
|
|
import '../../providers/connectivity.dart';
|
|
import '../../providers/test_results.dart';
|
|
import '../../widgets/Global/internet_error.dart';
|
|
import '../../widgets/TestResultScreens/Details/datas_box.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
class TestDetailsScreen extends StatefulWidget {
|
|
// static const route = '/TestDetailsScreen';
|
|
final String? testResultId;
|
|
|
|
TestDetailsScreen({this.testResultId});
|
|
|
|
@override
|
|
_TestDetailsScreenState createState() => _TestDetailsScreenState();
|
|
}
|
|
|
|
class _TestDetailsScreenState extends State<TestDetailsScreen> {
|
|
bool isInit = true;
|
|
Map<String, Object>? datas;
|
|
|
|
@override
|
|
void didChangeDependencies() async {
|
|
if (isInit) {
|
|
var _id = ModalRoute.of(context)!.settings.arguments;
|
|
await Provider.of<TestResultsProvider>(context, listen: false)
|
|
.showTestResult(_id.toString())
|
|
.then((result) {
|
|
setState(() {
|
|
datas = result.cast<String, Object>();
|
|
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;
|
|
// print(datas);
|
|
return SafeArea(
|
|
child: Scaffold(
|
|
appBar: AppBar(
|
|
titleSpacing: -10,
|
|
title: Text(
|
|
'Test Results',
|
|
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,
|
|
),
|
|
)
|
|
: DatasBox(
|
|
datas: datas!,
|
|
deviceBlockSize: _deviceBlockSize,
|
|
)
|
|
: ConnectionErrorBox();
|
|
},
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|