You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
137 lines
4.6 KiB
Dart
137 lines
4.6 KiB
Dart
import 'package:doctor_app_flutter/config/size_config.dart';
|
|
import 'package:doctor_app_flutter/core/model/live_care/AlternativeServicesList.dart';
|
|
import 'package:doctor_app_flutter/core/viewModel/LiveCarePatientViewModel.dart';
|
|
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
|
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
|
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
|
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
class TestScreen extends StatefulWidget {
|
|
@override
|
|
_TestScreenState createState() => _TestScreenState();
|
|
}
|
|
|
|
class _TestScreenState extends State<TestScreen> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BaseView<LiveCarePatientViewModel>(
|
|
onModelReady: (model) => model.setDemoData(),
|
|
builder: (_, model, w) => AppScaffold(
|
|
baseViewModel: model,
|
|
appBarTitle: TranslationBase.of(context).patientProfile,
|
|
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
|
isShowAppBar: false,
|
|
body: Container(
|
|
child: Center(
|
|
child: AppButton(
|
|
fontWeight: FontWeight.w700,
|
|
color: Colors.red[600],
|
|
title: "open dialog", //TranslationBase.of(context).close,
|
|
onPressed: () {
|
|
showAlternativesDialog(context, model, () {
|
|
model.alternativeServicesList.map((e) => () {
|
|
if (e.isSelected) {
|
|
print(e.serviceName);
|
|
}
|
|
});
|
|
Navigator.of(context).pop();
|
|
});
|
|
},
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
showAlternativesDialog(BuildContext context, LiveCarePatientViewModel model, Function okFunction) {
|
|
return showDialog(
|
|
context: context,
|
|
barrierDismissible: false, // user must tap button!
|
|
builder: (_) {
|
|
return Container(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
AlertDialog(
|
|
title: null,
|
|
content: Container(
|
|
height: MediaQuery.of(context).size.height / 2,
|
|
child: CheckBoxListWidget(model: model,),
|
|
),
|
|
actions: [
|
|
AppButton(
|
|
onPressed: (){
|
|
okFunction();
|
|
},
|
|
title: TranslationBase.of(context).noteConfirm,
|
|
fontColor: Colors.white,
|
|
color: Colors.green[600],
|
|
),
|
|
AppButton(
|
|
onPressed: () {
|
|
Navigator.of(context).pop();
|
|
},
|
|
title: TranslationBase.of(context).cancel,
|
|
fontColor: Colors.white,
|
|
color: Colors.red[600],
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
);
|
|
});
|
|
}
|
|
}
|
|
|
|
class CheckBoxListWidget extends StatefulWidget {
|
|
final LiveCarePatientViewModel model;
|
|
const CheckBoxListWidget({
|
|
Key key, this.model,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
_CheckBoxListState createState() => _CheckBoxListState();
|
|
}
|
|
|
|
class _CheckBoxListState extends State<CheckBoxListWidget> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SingleChildScrollView(
|
|
child: Column(
|
|
children: [
|
|
...widget.model
|
|
.alternativeServicesList
|
|
.map(
|
|
(element) => Container(
|
|
child: CheckboxListTile(
|
|
title: AppText(
|
|
element.serviceName,
|
|
fontWeight: FontWeight.normal,
|
|
fontSize: SizeConfig.textMultiplier * 2.2,
|
|
),
|
|
value: element.isSelected,
|
|
onChanged: (newValue) {
|
|
setState(() {
|
|
widget.model.setSelected(
|
|
element, newValue);
|
|
});
|
|
},
|
|
activeColor: Color(0xFFD02127),
|
|
controlAffinity:
|
|
ListTileControlAffinity.leading,
|
|
contentPadding: EdgeInsets.all(0),
|
|
),
|
|
),
|
|
)
|
|
.toList()
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|