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.
diplomatic-quarter/lib/pages/sub_categories_modalsheet.dart

109 lines
3.9 KiB
Dart

import 'package:diplomaticquarterapp/core/model/pharmacy/categorise_parent_model.dart';
import 'package:diplomaticquarterapp/core/model/pharmacy/pharmacy_categorise.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/sub_categorise_page.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_pharmacy_widget.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:flutter/material.dart';
import 'base/base_view.dart';
import 'package:provider/provider.dart';
class SubCategoriseModalsheet extends StatefulWidget {
String id;
String titleName;
SubCategoriseModalsheet({this.id, this.titleName});
@override
_SubCategoriseModalsheetState createState() => _SubCategoriseModalsheetState(id: id, titleName: titleName);
}
class _SubCategoriseModalsheetState extends State<SubCategoriseModalsheet> {
String id;
String titleName;
// List<CategoriseParentModel> categoriesList = [];
_SubCategoriseModalsheetState({this.id, this.titleName});
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return BaseView<PharmacyCategoriseViewModel>(
onModelReady: (model) => model.getCategoriseParent(i: id),
builder: (_, model, wi) => AppScaffold(
// appBarTitle: titleName,
appBarTitle: TranslationBase.of(context).categorise,
isBottomBar: false,
isShowAppBar: true,
isPharmacy: true,
backgroundColor: Colors.white,
isShowDecPage: false,
baseViewModel: model,
body: Container(
color: Colors.white,
child: Center(
child: ListView.builder(
scrollDirection: Axis.vertical,
itemCount: model.categoriseParent.length,
itemBuilder: (BuildContext context, int index) {
return Container(
child: Padding(
padding: EdgeInsets.all(4.0),
child: InkWell(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(projectViewModel.isArabic
? model.categoriseParent[index].namen
: model.categoriseParent[index].name),
SizedBox(
height: 10,
),
Divider(
thickness: 0.6,
color: Colors.black12,
)
],
),
onTap: () {
Navigator.push(
context,
FadePage(
page: SubCategorisePage(
title: model.categoriseParent[index].name,
id: model.categoriseParent[index].id,
parentId: id,
)),
);
},
),
),
);
}),
),
),
),
);
}
// getCatName() {
//
// if (widget.id == '1' )
// return Texts("text1");
// else if (widget.id == '2' )
// return Texts("text2");
// else if (widget.id == '3')
// return Texts("text3");
// else if (widget.id == '4' )
// return Texts("text4");
// }
}