chat implementation changes 1.0

aamir_dev
Faiz Hashmi 2 years ago
parent 2b640c5624
commit cd3699a510

@ -1,5 +1,3 @@
import 'package:mc_common_app/models/requests_models/offers_model.dart';
import 'package:mc_common_app/models/requests_models/request_model.dart';
import 'package:mc_common_app/views/appointments/appointment_detail_view.dart'; import 'package:mc_common_app/views/appointments/appointment_detail_view.dart';
import 'package:mc_common_app/views/appointments/book_appointment_schedules_view.dart'; import 'package:mc_common_app/views/appointments/book_appointment_schedules_view.dart';
import 'package:mc_common_app/views/appointments/book_appointment_services_view.dart'; import 'package:mc_common_app/views/appointments/book_appointment_services_view.dart';

@ -69,7 +69,11 @@ Future<void> main() async {
ChangeNotifierProvider<PaymentVM>( ChangeNotifierProvider<PaymentVM>(
create: (_) => PaymentVM(paymentService: injector.get<PaymentService>(), paymentRepo: injector.get<PaymentsRepo>()), create: (_) => PaymentVM(paymentService: injector.get<PaymentService>(), paymentRepo: injector.get<PaymentsRepo>()),
), ),
ChangeNotifierProvider<ChatVM>(create: (_) => ChatVM(chatRepo: injector.get<ChatRepo>())), ChangeNotifierProvider<ChatVM>(
create: (_) => ChatVM(
chatRepo: injector.get<ChatRepo>(),
requestRepo: injector.get<RequestRepo>(),
)),
ChangeNotifierProvider<RequestsVM>( ChangeNotifierProvider<RequestsVM>(
create: (_) => RequestsVM( create: (_) => RequestsVM(
requestRepo: injector.get<RequestRepo>(), requestRepo: injector.get<RequestRepo>(),

@ -76,7 +76,7 @@ class _DashboardPageState extends State<DashboardPage> {
await adVM.getVehicleAdsDuration(); await adVM.getVehicleAdsDuration();
} }
await chatVM.buildHubConnection(); await chatVM.buildHubConnection(context);
adVM.updateVehicleAdDurationId( adVM.updateVehicleAdDurationId(
SelectionModel( SelectionModel(
selectedId: adVM.vehicleAdsDurations.first.id ?? 0, selectedId: adVM.vehicleAdsDurations.first.id ?? 0,

@ -32,28 +32,33 @@ class MyRequestsFragment extends StatelessWidget {
), ),
8.height, 8.height,
Expanded( Expanded(
child: RefreshIndicator( child: RefreshIndicator(
onRefresh: () async => await requestsVM.getRequests(isNeedToRebuild: true, appType: AppType.customer), onRefresh: () async => await requestsVM.getRequests(isNeedToRebuild: true, appType: AppType.customer),
child: requestsVM.state == ViewState.busy child: requestsVM.state == ViewState.busy
? const Center(child: CircularProgressIndicator()) ? const Center(child: CircularProgressIndicator())
: requestsVM.myFilteredRequests.isEmpty : requestsVM.myFilteredRequests.isEmpty
? Column( ? Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
"No Requests to show.".toText(fontSize: 16, color: MyColors.lightTextColor), "No Requests to show.".toText(fontSize: 16, color: MyColors.lightTextColor),
], ],
) )
: ListView.separated( : ListView.separated(
itemBuilder: (context, index) { itemBuilder: (context, index) {
return RequestItem(request: requestsVM.myFilteredRequests[index], appType: AppType.customer); return RequestItem(
}, request: requestsVM.myFilteredRequests[index],
separatorBuilder: (context, index) { appType: AppType.customer,
return 16.height; requestIndex: index,
}, );
itemCount: requestsVM.myFilteredRequests.length, },
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 16, top: 8), separatorBuilder: (context, index) {
), return 16.height;
)) },
itemCount: requestsVM.myFilteredRequests.length,
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 16, top: 8),
),
),
)
], ],
); );
}), }),

Loading…
Cancel
Save