Posts

Showing posts with the label #MVVM

Master Flutter MVVM: Easy Guide for Efficient App Development

Image
  Introduction to MVVM Architecture MVVM (Model-View-ViewModel) is a software architectural pattern widely used in building user interfaces, particularly in frameworks like WPF, Xamarin, and Flutter. It's an evolution of the MVC (Model-View-Controller) pattern, aiming to improve separation of concerns and facilitate testability and maintainability of code. In MVVM, the UI is divided into three components: Model: Represents the data and business logic of the application. It encapsulates the data and operations that manipulate that data. The model notifies the ViewModel of any changes, but it's unaware of the UI. View: Represents the user interface. It's responsible for displaying data and capturing user input. Unlike MVC, the view in MVVM is passive and doesn't directly interact with the model. Instead, it binds to properties and commands exposed by the ViewModel. ViewModel: Acts as an intermediary between the view and the model. It exposes properties and commands tha

Taxi booking in Flutter - locationviewmodel.dart

Image
 Create a new dart file named as 'locationviewmodel.dart in lib -> viewmodels folder and paste following code. Please, support my blog by clicking on our sponsors ad! import 'package:flutter/cupertino.dart'; import 'package:myfirstproject/models/AreaSpotModel.dart'; import 'package:myfirstproject/models/locationmodel.dart'; class LocationViewModel extends ChangeNotifier { List<LocationModel> _list = []; List<LocationModel> get locationList => _list; set locationList(List<LocationModel> value) { _list = value; } void GetData() { locationList = [ LocationModel( Name: 'Mugal Garden', Img: 'https://images.hindustantimes.com/img/2022/12/03/original/fbdf0039359861ef8026921ab8fd5382_1670055785607.jpg', Distance: '25 km', Rate: '80.0', Address: '1A, Bombay Market-Punagam Rd, Krishnakunj Society, Punagam, Varachha, Surat

MVVM MAUI Ecommerce APP Address Entry Form

Image
  Create a Address Entry Form in xamarin Please, support my blog by clicking on our sponsors ad! Watch video to understand code. For fontawesome refer this   link Lets create all Controls ImageLabel.xaml <ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Ecommerce.UI.Template.CustomControls.ImageLabel"> <Grid RowDefinitions="Auto,Auto"> <Label x:Name="lblIcon" FontFamily="{x:DynamicResource FontAwesomeFamily}" HorizontalOptions="Center" TextColor="Gray" Grid.Column="0" Grid.Row="0"></Label> <Label x:Name="lbl" Grid.Column="0" Grid.Row="1" HorizontalOptions="FillAndExpand" HorizontalTextAlignment="Center" TextColor="Gray"></Label>

MVVM and MAUI - Checkout page for Ecommerce APP

Image
MVVM and MAUI - Checkout page for Ecommerce APP Please, support my blog by clicking on our sponsors ad! Watch this video to understand code. For fontawesome refer this   link First We will create all template CheckoutStepTemplate.xaml <ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="Ecommerce.UI.Template.Pages.CheckOut.Template.CheckoutStepTemplate" xmlns:fontawesome="clr-namespace:Ecommerce.UI.Template.Models"> <Grid x:Name="grid" ColumnDefinitions="Auto,*,Auto,*,Auto" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"> <StackLayout Grid.Column="0" Spacing="5" > <Label x:Name="lblCartCircle" Text="{x:Static fontawesome:Solid.Circle}" HorizontalOpt