123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- import 'package:flutter/material.dart';
- import 'package:get_it/get_it.dart';
- import 'package:ustest/Services/UserService.dart';
- import 'package:ustest/tool.dart';
- import 'Services/BuildService.dart';
- class BuildHistoryList extends StatefulWidget {
- BuildHistoryList({Key? key, required this.token, required this.histories})
- : super();
- final String token;
- final List<BuildHistory> histories;
- @override
- _ConsultationListState createState() => _ConsultationListState();
- }
- class _ConsultationListState extends State<BuildHistoryList> {
- @override
- void initState() {
- var service = GetIt.instance.get<UserService>();
- service.NotificationReceived.subscribe((args) {
- if (args == null) {
- return;
- }
- });
- super.initState();
- }
- @override
- void dispose() {
- var service = GetIt.instance.get<UserService>();
- service.NotificationReceived.unsubscribe((args) {});
- super.dispose();
- }
- void showConfirmDialog(BuildContext context, String content,
- Function confirmCallback, Function rejectCallback) {
- showDialog(
- context: context,
- builder: (context) {
- return new AlertDialog(
- title: new Text("提示"),
- content: new Text(content),
- actions: <Widget>[
- new TextButton(
- onPressed: () {
- confirmCallback();
- Navigator.of(context).pop();
- },
- child: new Text("接受"),
- ),
- new TextButton(
- onPressed: () {
- Navigator.of(context).pop();
- },
- child: new Text("拒絕"),
- ),
- ],
- );
- });
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- body: Container(
- height: 600,
- child: Row(
- children: [
- Container(
- height: 500,
- width: 400,
- child: ListView(
- restorationId: 'list_demo_list_view',
- padding: const EdgeInsets.symmetric(vertical: 0),
- children: [
- for (int index = 0; index < widget.histories.length; index++)
- Row(
- children: [
- Expanded(
- child: Container(
- child: ListTile(
- leading: ExcludeSemantics(
- child: Icon(Icons.person),
- ),
- title: Text(widget.histories[index].id),
- onTap: (() =>
- onTabPatient(widget.histories[index].id)),
- ),
- )),
- Row(
- children: [Offstage()],
- ),
- Container(
- alignment: Alignment.topRight,
- child: Container(
- child: Column(
- children: [
- ClipRRect(
- borderRadius: BorderRadius.circular(2),
- child: Container(
- color: Colors.amber[50],
- child: Row(children: [
- Icon(
- Icons.star,
- color: Colors.amber[500],
- size: 12,
- ),
- Text(
- "5.0",
- style: TextStyle(
- color: Colors.amber[900],
- fontSize: 9),
- ),
- ]))),
- Container(
- child: Row(
- children: [
- TextButton(
- child: Text("Start"),
- onPressed: (() =>
- OnStartLiveConsultation(
- widget.histories[index].id))),
- ],
- ))
- ],
- ),
- )),
- ],
- ),
- ],
- ),
- ),
- ],
- ),
- ));
- }
- void onTabPatient(String id) async {}
- void OnStartLiveConsultation(id) async {
- try {
- //var service = GetIt.instance.get<ConsultationService>();
- Navigator.of(context).pushNamed('/meeting');
- } catch (ex) {
- print('OnStartLiveConsultation.to ex:$ex');
- MeetingTool.toast(ex.toString(), context);
- }
- }
- }
|