import 'package:flutter/material.dart'; import 'package:qhd_prevention/pages/my_appbar.dart'; class UserinfoPage extends StatefulWidget { const UserinfoPage({super.key}); @override State createState() => _UserinfoPageState(); } class _UserinfoPageState extends State { @override Widget build(BuildContext context) { return Scaffold( appBar: MyAppbar(title: "人员信息"), body: SafeArea( child: ListView( children: [ _userItemCell("姓名", "-----", false), _userItemCell("部门", "-----", false), _userItemCell("岗位", "-----", true), ], ), ), ); } Widget _userItemCell(final String title, final String detail, bool isLast) { return Container( padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 15), decoration: isLast ? const BoxDecoration( color: Colors.white, border: Border( bottom: BorderSide(color: Colors.grey, width: 0), ), ) : const BoxDecoration( color: Colors.white, border: Border( bottom: BorderSide(color: Colors.grey, width: 0.5), ), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.center, children: [ Text(title, style: const TextStyle(fontSize: 16, color: Colors.grey)), Flexible( child: Text( detail, style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w500), textAlign: TextAlign.right, maxLines: 2, overflow: TextOverflow.ellipsis, ), ), ], ), ); } }