123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- import 'package:fis_jsonrpc/rpc.dart';
- import 'package:flutter/material.dart';
- import 'package:get/get.dart';
- import 'package:vitalapp/pages/contract/package_list/controller.dart';
- /// 包详情
- class PackageInfoPage extends GetView<ServicePackageContractController> {
- final ServicePackDTO? dto;
- const PackageInfoPage({super.key, this.dto});
- Widget buildAlertDialog(ServicePackDTO? servicePackDTO) {
- return Container(
- margin: const EdgeInsets.only(left: 55),
- alignment: Alignment.topLeft,
- padding: const EdgeInsets.symmetric(horizontal: 15),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- const Text(
- '服务名称',
- style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
- ),
- const SizedBox(
- height: 10,
- ),
- Container(
- color: const Color.fromARGB(255, 243, 240, 240),
- child: _buildItemContent(servicePackDTO?.name ?? ""),
- ),
- const SizedBox(
- height: 10,
- ),
- const Text(
- '服务介绍',
- style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
- ),
- const SizedBox(
- height: 10,
- ),
- Container(
- color: const Color.fromARGB(255, 243, 240, 240),
- child: _buildItemContent(servicePackDTO?.content ?? ""),
- ),
- const SizedBox(
- height: 10,
- ),
- const Text(
- '服务项目',
- style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
- ),
- const SizedBox(
- height: 10,
- ),
- Expanded(
- child: Container(
- color: const Color.fromARGB(255, 243, 240, 240),
- child: Scrollbar(
- thumbVisibility: true,
- child: ListView(
- children: [
- ...controller
- .getServiceItemsName(
- servicePackDTO?.items ?? [],
- )
- .map(
- (ServiceItemDTO e) => _buildServiceItem(e),
- ),
- ],
- ),
- ),
- ),
- ),
- ],
- ),
- );
- }
- Widget _buildServiceItem(ServiceItemDTO dto) {
- return Container(
- margin: const EdgeInsets.only(left: 20),
- padding: const EdgeInsets.all(5),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- dto.name ?? '',
- style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
- ),
- const SizedBox(
- height: 5,
- ),
- Container(
- margin: const EdgeInsets.only(left: 20),
- child: Text(
- dto.content ?? '',
- style: const TextStyle(fontSize: 18),
- ),
- ),
- ],
- ),
- );
- }
- Widget _buildItemContent(String itemName) {
- return LayoutBuilder(
- builder: (BuildContext context, BoxConstraints constraints) {
- return ConstrainedBox(
- constraints: const BoxConstraints(
- maxHeight: 100,
- ),
- child: Scrollbar(
- thumbVisibility: true,
- child: ListView(
- shrinkWrap: true,
- children: [
- Container(
- margin: const EdgeInsets.only(left: 20),
- padding: const EdgeInsets.all(5),
- child: Text(
- itemName,
- style: const TextStyle(fontSize: 18),
- ),
- ),
- ],
- ),
- ),
- );
- },
- );
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(
- title: const Text(
- "服务包详情",
- style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
- ),
- // leading: Container(),
- // leadingWidth: 0,
- // actions: [
- // IconButton(
- // onPressed: () {
- // Navigator.pop(context);
- // },
- // icon: const Icon(
- // Icons.cancel,
- // size: 24,
- // ))
- // ],
- ),
- body: buildAlertDialog(dto),
- );
- }
- }
|