Added Services Widget on HomeScreen
parent
0b63e00a14
commit
f9584c14cc
@ -0,0 +1,58 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mc_common_app/extensions/int_extensions.dart';
|
||||
import 'package:mc_common_app/extensions/string_extensions.dart';
|
||||
import 'package:mc_common_app/models/general_models/widgets_models.dart';
|
||||
import 'package:mc_common_app/view_models/appointments_view_model.dart';
|
||||
import 'package:mc_common_app/view_models/dashboard_view_model_customer.dart';
|
||||
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class MyServicesCategoriesWidget extends StatelessWidget {
|
||||
final List<FilterListModel> homeCategories;
|
||||
|
||||
const MyServicesCategoriesWidget({Key? key, required this.homeCategories}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
height: 140,
|
||||
child: ListView.builder(
|
||||
itemCount: homeCategories.length,
|
||||
scrollDirection: Axis.horizontal,
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
FilterListModel category = homeCategories[index];
|
||||
if (category.id == 0) {
|
||||
return SizedBox();
|
||||
}
|
||||
return SizedBox(
|
||||
width: 90,
|
||||
child: Column(
|
||||
children: [
|
||||
category.iconUrl.buildNetworkImage(height: 73, width: 73, fit: BoxFit.cover).toCircle(borderRadius: 100),
|
||||
9.height,
|
||||
Flexible(
|
||||
child: category.title.toText(
|
||||
fontSize: 14,
|
||||
textAlign: TextAlign.center,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
letterSpacing: -0.84,
|
||||
height: 18 / 14,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
).onPress(() {
|
||||
final appointmentVM = context.read<AppointmentsVM>();
|
||||
final dashboardCustomerVM = context.read<DashboardVmCustomer>();
|
||||
context.read<DashboardVmCustomer>().onNavbarTapped(0);
|
||||
dashboardCustomerVM.onNavbarTapped(0);
|
||||
appointmentVM.applyFilterOnBranches(index: index);
|
||||
});
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue