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

252 lines
9.1 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 Labels_sxueView extends StatefulWidget {
final Object? extra;
Labels_sxueView({super.key, this.extra});
@override
State<Labels_sxueView> createState() => _Labels_sxueViewState();
}
class _Labels_sxueViewState extends State<Labels_sxueView> {
late Labels_sxueController _view;
@override
void initState() {
super.initState();
_view = Labels_sxueController()..selectedIndex = widget.extra as int;
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return ChangeNotifierProvider(
create: (context) => _view,
child: Consumer<Labels_sxueController>(
builder: (context, view, child) => Scaffold(
backgroundColor: Color(0xffffffff),
appBar: AppBar682_1czg(
Icons.dashboard,
Icons.search,
Constants.labels_,
),
body: GridView(
padding: EdgeInsets.all(16),
shrinkWrap: false,
scrollDirection: Axis.vertical,
physics: ClampingScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 16,
mainAxisSpacing: 16,
childAspectRatio: 1.3,
),
children: [
Container676_u4q2(Constants.k1Item_, Constants.ideas_),
Container(
alignment: Alignment.center,
margin: EdgeInsets.all(0),
padding: EdgeInsets.all(0),
decoration: BoxDecoration(
color: Color(0xffffffff),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(12.0),
border: Border.all(color: Color(0x4d9e9e9e), width: 1),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Text(
Constants.uX_,
textAlign: TextAlign.start,
overflow: TextOverflow.clip,
style: TextStyle(
fontWeight: FontWeight.w700,
fontStyle: FontStyle.normal,
fontSize: 20,
color: Color(0xffff9200),
),
),
Padding(
padding: EdgeInsets.fromLTRB(0, 8, 0, 0),
child: Text(
Constants.k2Items_,
textAlign: TextAlign.start,
overflow: TextOverflow.clip,
style: TextStyle(
fontWeight: FontWeight.w400,
fontStyle: FontStyle.normal,
fontSize: 16,
color: Color(0xff4c4c4c),
),
),
),
],
),
),
Container(
alignment: Alignment.center,
margin: EdgeInsets.all(0),
padding: EdgeInsets.all(0),
decoration: BoxDecoration(
color: Color(0xffffffff),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(12.0),
border: Border.all(color: Color(0x4d9e9e9e), width: 1),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Text(
Constants.story_,
textAlign: TextAlign.start,
overflow: TextOverflow.clip,
style: TextStyle(
fontWeight: FontWeight.w700,
fontStyle: FontStyle.normal,
fontSize: 20,
color: Color(0xffff5600),
),
),
Padding(
padding: EdgeInsets.fromLTRB(0, 8, 0, 0),
child: Text(
Constants.k1Item_,
textAlign: TextAlign.start,
overflow: TextOverflow.clip,
style: TextStyle(
fontWeight: FontWeight.w400,
fontStyle: FontStyle.normal,
fontSize: 16,
color: Color(0xff4c4c4c),
),
),
),
],
),
),
Container(
alignment: Alignment.center,
margin: EdgeInsets.all(0),
padding: EdgeInsets.all(0),
decoration: BoxDecoration(
color: Color(0xffffffff),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(12.0),
border: Border.all(color: Color(0x4d9e9e9e), width: 1),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Text(
Constants.xD_,
textAlign: TextAlign.start,
overflow: TextOverflow.clip,
style: TextStyle(
fontWeight: FontWeight.w700,
fontStyle: FontStyle.normal,
fontSize: 20,
color: Color(0xff169b81),
),
),
Padding(
padding: EdgeInsets.fromLTRB(0, 8, 0, 0),
child: Text(
Constants.k2Items_,
textAlign: TextAlign.start,
overflow: TextOverflow.clip,
style: TextStyle(
fontWeight: FontWeight.w400,
fontStyle: FontStyle.normal,
fontSize: 16,
color: Color(0xff4c4c4c),
),
),
),
],
),
),
Container(
alignment: Alignment.center,
margin: EdgeInsets.all(0),
padding: EdgeInsets.all(0),
decoration: BoxDecoration(
color: Color(0xffffffff),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(12.0),
border: Border.all(color: Color(0x4d9e9e9e), width: 1),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Text(
Constants.lorem_,
textAlign: TextAlign.start,
overflow: TextOverflow.clip,
style: TextStyle(
fontWeight: FontWeight.w700,
fontStyle: FontStyle.normal,
fontSize: 20,
color: Color(0xffaf1d86),
),
),
Padding(
padding: EdgeInsets.fromLTRB(0, 8, 0, 0),
child: Text(
Constants.k1Item_,
textAlign: TextAlign.start,
overflow: TextOverflow.clip,
style: TextStyle(
fontWeight: FontWeight.w400,
fontStyle: FontStyle.normal,
fontSize: 16,
color: Color(0xff4c4c4c),
),
),
),
],
),
),
],
),
),
),
);
}
}
class Labels_sxueController with ChangeNotifier {
int? selectedIndex;
dynamic getModel(Dao repository) {
final items = repository.getAll();
return (selectedIndex == null || selectedIndex! >= items.length)
? repository.create()
: items[selectedIndex!];
}
}