123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218 |
- import 'package:flutter/material.dart';
- import 'package:vitalapp/consts/styles.dart';
- class DashboardDemoView extends StatelessWidget {
- const DashboardDemoView({super.key});
- @override
- Widget build(BuildContext context) {
- const borderRadius = GlobalStyles.borderRadiusValue;
- return ListView(
- children: [
- Container(
- height: 150,
- padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8),
- decoration: const BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.all(borderRadius),
- ),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: const [
- _CountCircleWidget(
- count: 100,
- title: "日新增签约人数",
- color: Colors.red,
- ),
- _CountCircleWidget(
- count: 100,
- title: "已随访总人数",
- color: Colors.purple,
- ),
- _CountCircleWidget(
- count: 100,
- title: "累计签约总人数",
- color: Colors.green,
- ),
- _CountCircleWidget(
- count: 100,
- title: "签约逾期总数",
- color: Colors.blue,
- ),
- ],
- ),
- ),
- const SizedBox(height: 10),
- Column(
- children: [
- Container(
- height: 40,
- padding: const EdgeInsets.symmetric(horizontal: 14),
- decoration: BoxDecoration(
- color: Theme.of(context).primaryColor,
- borderRadius: const BorderRadius.only(
- topLeft: borderRadius,
- topRight: borderRadius,
- ),
- ),
- child: Row(
- children: const [
- Icon(Icons.notifications_active_outlined,
- color: Colors.white),
- Text(
- "工作提醒",
- style: TextStyle(
- color: Colors.white,
- fontSize: 18,
- fontWeight: FontWeight.bold,
- ),
- ),
- ],
- ),
- ),
- Container(
- padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 20),
- decoration: const BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.only(
- bottomLeft: borderRadius,
- bottomRight: borderRadius,
- ),
- ),
- // height: 100,
- child: _DemoTable(),
- ),
- ],
- ),
- ],
- );
- }
- }
- class _DemoTable extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- final source = [
- "肺结核",
- "冠心病",
- "脑卒中",
- "严重精神病",
- "糖尿病",
- "高血压",
- "老年人",
- "月产妇",
- "儿童",
- ];
- final rows = <TableRow>[];
- for (var i = 0; i < source.length; i++) {
- rows.add(_buildRow(source[i], i));
- }
- return Table(
- children: [
- TableRow(
- decoration: const BoxDecoration(
- color: Color.fromRGBO(215, 234, 255, 1),
- ),
- children: [
- _buildHeaderCell("重点人群"),
- _buildHeaderCell("首次随访未进行"),
- _buildHeaderCell("本日应随访"),
- _buildHeaderCell("本周应随访"),
- _buildHeaderCell("逾期随访"),
- ],
- ),
- ...rows,
- ],
- );
- }
- TableRow _buildRow(String title, int index) {
- return TableRow(
- decoration: index % 2 == 0
- ? null
- : const BoxDecoration(
- color: Color.fromRGBO(233, 244, 255, 1),
- ),
- children: [
- _buildDataCell(title),
- _buildDataCell("0"),
- _buildDataCell("0"),
- _buildDataCell("0"),
- _buildDataCell("0"),
- ],
- );
- }
- TableCell _buildHeaderCell(String title) {
- return TableCell(
- child: Container(
- alignment: Alignment.center,
- height: 37,
- child: Text(
- title,
- style: const TextStyle(fontSize: 14, fontWeight: FontWeight.bold),
- ),
- ),
- );
- }
- TableCell _buildDataCell(String title) {
- return TableCell(
- child: Container(
- alignment: Alignment.center,
- height: 37,
- child: Text(
- title,
- style: const TextStyle(fontSize: 14),
- ),
- ),
- );
- }
- }
- class _CountCircleWidget extends StatelessWidget {
- final int count;
- final String title;
- final Color color;
- const _CountCircleWidget({
- required this.count,
- required this.title,
- required this.color,
- });
- @override
- Widget build(BuildContext context) {
- return Column(
- crossAxisAlignment: CrossAxisAlignment.center,
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Container(
- width: 94,
- height: 94,
- decoration: BoxDecoration(
- border: Border.all(
- width: 5,
- color: color,
- ),
- borderRadius: BorderRadius.circular(94 / 2),
- ),
- alignment: Alignment.center,
- child: Text(
- count.toString(),
- style: TextStyle(
- color: color,
- fontSize: 20,
- fontWeight: FontWeight.bold,
- ),
- ),
- ),
- const SizedBox(height: 8),
- Text(
- title,
- style: const TextStyle(fontSize: 14),
- ),
- ],
- );
- }
- }
|