import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/widgets.dart'; import 'package:get/get.dart'; import 'package:sk_base_mobile/app_theme.dart'; import 'package:sk_base_mobile/util/screen_adaper_util.dart'; class WorkBenchModel { final String title; final String icon; final String route; WorkBenchModel( {required this.title, required this.icon, required this.route}); } class WorkBenchPage extends StatelessWidget { WorkBenchPage({super.key}); List works = [ WorkBenchModel( title: '产品管理', icon: 'assets/images/product_manage.png', route: '/product'), WorkBenchModel( title: '库存管理', icon: 'assets/images/inventory_manage.png', route: '/inventory'), WorkBenchModel( title: '合同管理', icon: 'assets/images/contract_manage.png', route: '/contract'), WorkBenchModel( title: '人事管理', icon: 'assets/images/hr_manage.png', route: '/personnel'), WorkBenchModel( title: '公车管理', icon: 'assets/images/vehicle_usage.png', route: '/finance'), WorkBenchModel( title: '任务管理', icon: 'assets/images/task_manage.png', route: '/task_manage'), WorkBenchModel( title: '报表管理', icon: 'assets/images/report_manage.png', route: '/report'), ]; @override Widget build(BuildContext context) { return SingleChildScrollView( child: Column(children: [ Container( padding: EdgeInsets.all(ScreenAdaper.width(20)), child: GridView.builder( shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), itemCount: works.length, gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: Get.width > 800 ? 5 : 3, crossAxisSpacing: ScreenAdaper.width(20), mainAxisSpacing: ScreenAdaper.height(20), childAspectRatio: 1.0), itemBuilder: (BuildContext context, int index) { return buildCard(index); }, ), ) ])); } Widget buildCard(int index) { return Card( clipBehavior: Clip.antiAlias, shadowColor: AppTheme.black, elevation: 10.0, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(ScreenAdaper.width(20))), child: Stack( children: [ Image.asset(works[index].icon), Center( child: Stack( alignment: Alignment.center, children: [ Text( works[index].title, style: TextStyle( letterSpacing: ScreenAdaper.width(5), fontSize: ScreenAdaper.sp(30), fontWeight: FontWeight.bold, foreground: Paint() ..style = PaintingStyle.stroke ..strokeWidth = 5 ..color = Colors.black), ), Text( works[index].title, style: TextStyle( letterSpacing: ScreenAdaper.width(5), color: Colors.white, fontSize: ScreenAdaper.sp(30), fontWeight: FontWeight.bold), ), ], ), ) ], )); } }