mirror of
https://git.meshkee.com/applications/cssd.git
synced 2026-10-10 19:28:56 +03:30
97 lines
2.9 KiB
Dart
Executable File
97 lines
2.9 KiB
Dart
Executable File
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
import '../../config/routes.dart';
|
|
import '../../models/cycles_models.dart';
|
|
import '../../providers/connectivity.dart';
|
|
import '../../providers/cycles.dart';
|
|
import '../../widgets/CycleScreens/Details/datas_box.dart';
|
|
import '../../widgets/Global/internet_error.dart';
|
|
|
|
class CycleDetailScreen extends StatefulWidget {
|
|
// static const route = '/CycleDetailScreen';
|
|
final String? testResultId;
|
|
|
|
CycleDetailScreen({this.testResultId});
|
|
|
|
@override
|
|
_CycleDetailScreenState createState() => _CycleDetailScreenState();
|
|
}
|
|
|
|
class _CycleDetailScreenState extends State<CycleDetailScreen> {
|
|
bool isInit = true;
|
|
bool isEmpty = false;
|
|
CycleDetailObject? datas;
|
|
|
|
@override
|
|
void didChangeDependencies() async {
|
|
if (isInit) {
|
|
var _id = ModalRoute.of(context)!.settings.arguments;
|
|
await Provider.of<CyclesProvider>(context, listen: false)
|
|
.showCycleResult(_id.toString())
|
|
.then(
|
|
(result) {
|
|
setState(
|
|
() {
|
|
if (result.id == 'null') {
|
|
isEmpty = true;
|
|
}
|
|
datas = result;
|
|
isInit = false;
|
|
},
|
|
);
|
|
},
|
|
);
|
|
}
|
|
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(
|
|
'Cycles',
|
|
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 Cycle doesnt exists!'),
|
|
)
|
|
: CycleDetailsDataBox(
|
|
datas: datas!,
|
|
deviceBlockSize: _deviceBlockSize,
|
|
)
|
|
: ConnectionErrorBox();
|
|
}),
|
|
),
|
|
);
|
|
}
|
|
}
|