diff --git a/assets/images/car.png b/assets/images/car.png index 2e7085d..b078ecc 100644 Binary files a/assets/images/car.png and b/assets/images/car.png differ diff --git a/assets/images/lady1.png b/assets/images/lady1.png index 48bbfef..2797b75 100644 Binary files a/assets/images/lady1.png and b/assets/images/lady1.png differ diff --git a/lib/controller/Widget/home_widget_provider.dart b/lib/controller/Widget/home_widget_provider.dart new file mode 100644 index 0000000..26c2980 --- /dev/null +++ b/lib/controller/Widget/home_widget_provider.dart @@ -0,0 +1,57 @@ +// import 'package:home_widget/home_widget.dart'; + +// class TripzHomeWidgetProvider { +// static const String widgetName = 'TripzHomeWidget'; + +// // Initialize Home Widget +// static Future initHomeWidget() async { +// await HomeWidget.registerInteractivityCallback(backgroundCallback); +// } + +// // Background Callback for Widget Updates +// static Future backgroundCallback(Uri? uri) async { +// if (uri?.host == 'updateWidget') { +// // Logic to update widget data +// await updateWidgetData(); +// } +// } + +// // Update Widget Data Method +// static Future updateWidgetData() async { +// // Fetch current ride details +// final rideData = await _fetchCurrentRideDetails(); + +// // Update Widget with Ride Information +// await HomeWidget.saveWidgetData( +// 'ride_destination', rideData.destination); +// await HomeWidget.saveWidgetData( +// 'ride_estimated_time', rideData.estimatedTime); +// await HomeWidget.saveWidgetData('ride_fare', rideData.fare); + +// // Trigger Widget Update +// await HomeWidget.updateWidget( +// name: widgetName, +// iOSName: 'TripzWidgetProvider', +// androidName: 'com.mobileapp.store.ride.HomeWidgetProvider', +// ); +// } + +// // Mock method to fetch ride details (replace with actual implementation) +// static Future _fetchCurrentRideDetails() async { +// // Implement actual data fetching logic +// return RideData( +// destination: 'Downtown Office', estimatedTime: '25 mins', fare: 15.50); +// } +// } + +// // Ride Data Model +// class RideData { +// final String destination; +// final String estimatedTime; +// final double fare; + +// RideData( +// {required this.destination, +// required this.estimatedTime, +// required this.fare}); +// } diff --git a/lib/homw_widget.dart b/lib/homw_widget.dart new file mode 100644 index 0000000..7346493 --- /dev/null +++ b/lib/homw_widget.dart @@ -0,0 +1,18 @@ +import 'package:flutter/services.dart'; + +class WidgetManager { + static const platform = MethodChannel('com.mobileapp.store.ride/widget'); + + static Future updateWidget() async { + try { + await platform.invokeMethod('updateWidget'); + } on PlatformException catch (e) { + print("Failed to update widget: '${e.message}'."); + } + } +} + +// Example usage: +void updateHomeScreenWidget() { + WidgetManager.updateWidget(); +}