second/lib/src/ui/views/data_not_found_f1qf.dart

148 lines
5.0 KiB
Dart

import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:provider/provider.dart';
//import 'package:collection/collection.dart';
import 'dart:math';
import '../../app.dart';
import '../../common/constants.dart';
import '../../common/utils.dart';
import '../../data/repository/_dao.dart';
import '../../data/models/_models.dart';
import '../components/_components.dart';
class DataNotFound_f1qfView extends StatefulWidget {
final Object? extra;
DataNotFound_f1qfView({super.key, this.extra});
@override
State<DataNotFound_f1qfView> createState() => _DataNotFound_f1qfViewState();
}
class _DataNotFound_f1qfViewState extends State<DataNotFound_f1qfView> {
late DataNotFound_f1qfController _view;
@override
void initState() {
super.initState();
_view = DataNotFound_f1qfController()..selectedIndex = widget.extra as int;
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return ChangeNotifierProvider(
create: (context) => _view,
child: Consumer<DataNotFound_f1qfController>(
builder: (context, view, child) => Scaffold(
body: Stack(
alignment: Alignment.topLeft,
children: [
///***If you have exported images you must have to copy those images in assets/images directory.
Image(
image: NetworkImage(
'https://i.ibb.co/g7pKbhg/old-black-background-grunge-texture-dark-wallpaper-blackboard-chalkboard-room-wall-1258-28312.jpg',
),
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
fit: BoxFit.cover,
),
Padding(
padding: EdgeInsets.all(16),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: [
Text(
Constants.noInternet_,
textAlign: TextAlign.start,
overflow: TextOverflow.clip,
style: TextStyle(
fontWeight: FontWeight.w400,
fontStyle: FontStyle.normal,
fontSize: 24,
color: Color(0xffbbbaba),
),
),
Padding(
padding: EdgeInsets.fromLTRB(0, 0, 0, 8),
child: Text(
Constants.connection_,
textAlign: TextAlign.start,
overflow: TextOverflow.clip,
style: TextStyle(
fontWeight: FontWeight.w700,
fontStyle: FontStyle.normal,
fontSize: 26,
color: Color(0xffffffff),
),
),
),
Padding(
padding: EdgeInsets.fromLTRB(0, 16, 0, 30),
child: Text(
Constants.pleaseCheckYourInternetCon_,
textAlign: TextAlign.start,
overflow: TextOverflow.clip,
style: TextStyle(
fontWeight: FontWeight.w400,
fontStyle: FontStyle.normal,
fontSize: 14,
color: Color(0xffbbbaba),
),
),
),
MaterialButton(
onPressed: () {
view._click();
},
color: Color(0xffffffff),
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(24.0),
),
padding: EdgeInsets.all(16),
child: Text(
Constants.tRYAGAIN_,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w400,
fontStyle: FontStyle.normal,
),
),
textColor: Color(0xff000000),
height: 40,
minWidth: 140,
),
],
),
),
],
),
),
),
);
}
}
class DataNotFound_f1qfController with ChangeNotifier {
int? selectedIndex;
dynamic getModel(Dao repository) {
final items = repository.getAll();
return (selectedIndex == null || selectedIndex! >= items.length)
? repository.create()
: items[selectedIndex!];
}
void _click() {
/* TODO */
}
}