134 lines
4.2 KiB
Dart
134 lines
4.2 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 NoDataFound_shk8View extends StatefulWidget {
|
|
final Object? extra;
|
|
|
|
NoDataFound_shk8View({super.key, this.extra});
|
|
|
|
@override
|
|
State<NoDataFound_shk8View> createState() => _NoDataFound_shk8ViewState();
|
|
}
|
|
|
|
class _NoDataFound_shk8ViewState extends State<NoDataFound_shk8View> {
|
|
late NoDataFound_shk8Controller _view;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_view = NoDataFound_shk8Controller()..selectedIndex = widget.extra as int;
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ChangeNotifierProvider(
|
|
create: (context) => _view,
|
|
child: Consumer<NoDataFound_shk8Controller>(
|
|
builder: (context, view, child) => Scaffold(
|
|
backgroundColor: Color(0xffffffff),
|
|
body: Padding(
|
|
padding: EdgeInsets.all(16),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
///***If you have exported images you must have to copy those images in assets/images directory.
|
|
children: [
|
|
Image(
|
|
image: NetworkImage(
|
|
'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ8Q834-7f4pEXZbLNMllf9kfmCa98XH7r3KqlWuYvzb2MxQofQ0lEZV17zyaAZSGOMzmU&usqp=CAU',
|
|
),
|
|
height: 120,
|
|
width: 120,
|
|
fit: BoxFit.cover,
|
|
),
|
|
Padding(
|
|
padding: EdgeInsets.fromLTRB(0, 16, 0, 0),
|
|
child: Text(
|
|
Constants.oopsYouAreLost_,
|
|
textAlign: TextAlign.center,
|
|
overflow: TextOverflow.clip,
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.w700,
|
|
fontStyle: FontStyle.normal,
|
|
fontSize: 18,
|
|
color: Color(0xff000000),
|
|
),
|
|
),
|
|
),
|
|
Padding(
|
|
padding: EdgeInsets.fromLTRB(0, 16, 0, 30),
|
|
child: Text(
|
|
Constants.thePageYouAreLookingForC_,
|
|
textAlign: TextAlign.center,
|
|
overflow: TextOverflow.clip,
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.w400,
|
|
fontStyle: FontStyle.normal,
|
|
fontSize: 14,
|
|
color: Color(0xbe8a8989),
|
|
),
|
|
),
|
|
),
|
|
MaterialButton(
|
|
onPressed: () {
|
|
view._click();
|
|
},
|
|
color: const Color(0xFFFF5630),
|
|
elevation: 0,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(12.0),
|
|
),
|
|
padding: EdgeInsets.all(16),
|
|
child: Text(
|
|
Constants.goBack_,
|
|
style: TextStyle(
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w700,
|
|
fontStyle: FontStyle.normal,
|
|
),
|
|
),
|
|
textColor: Color(0xffffffff),
|
|
height: 50,
|
|
minWidth: MediaQuery.of(context).size.width,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class NoDataFound_shk8Controller 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 */
|
|
}
|
|
}
|