86 lines
3.3 KiB
Dart
86 lines
3.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:unit2/screens/unit2/homepage.dart/module-screen.dart';
|
|
import 'package:unit2/theme-data.dart/box_shadow.dart';
|
|
import 'package:unit2/theme-data.dart/colors.dart';
|
|
import 'package:unit2/utils/global.dart';
|
|
|
|
class DashBoard extends StatelessWidget {
|
|
final List<Module> roles;
|
|
const DashBoard({super.key, required this.roles});
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 24),
|
|
height: MediaQuery.of(context).size.height,
|
|
//listview builder
|
|
child: ListView.builder(
|
|
scrollDirection: Axis.vertical,
|
|
shrinkWrap: true,
|
|
itemCount: roles.length,
|
|
itemBuilder: (BuildContext context, int index) {
|
|
// gridview.count
|
|
return SizedBox(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
roles[index].name,
|
|
style: Theme.of(context)
|
|
.textTheme
|
|
.labelLarge!
|
|
.copyWith(fontSize: 14),
|
|
),
|
|
|
|
const SizedBox(
|
|
height: 8,
|
|
),
|
|
GridView.count(
|
|
shrinkWrap: true,
|
|
crossAxisCount: 4,
|
|
crossAxisSpacing: 5,
|
|
mainAxisSpacing: 2,
|
|
physics: const BouncingScrollPhysics(),
|
|
padding: const EdgeInsets.symmetric(
|
|
vertical: 5, horizontal: 5),
|
|
children: roles[index].roles.map((role) {
|
|
return Container(
|
|
padding: const EdgeInsets.all(8),
|
|
decoration:box1(),
|
|
child: GestureDetector(
|
|
onTap: () {
|
|
},
|
|
child: Column(children: [
|
|
Icon(
|
|
role.icon,
|
|
size: 24,
|
|
color: second,
|
|
),
|
|
const SizedBox(
|
|
height: 5,
|
|
),
|
|
Expanded(
|
|
child: Text(
|
|
role.role.name!,
|
|
textAlign: TextAlign.center,
|
|
style: Theme.of(context)
|
|
.textTheme
|
|
.labelLarge!
|
|
.copyWith(
|
|
fontSize: blockSizeVertical*1.1,
|
|
fontWeight: FontWeight.bold),
|
|
),
|
|
),
|
|
]),
|
|
),
|
|
);
|
|
}).toList()),
|
|
const SizedBox(height: 8,)
|
|
],
|
|
),
|
|
);
|
|
}),
|
|
);
|
|
}
|
|
}
|