All Projects → ditclear → Mvvm_flutter

ditclear / Mvvm_flutter

Licence: other
Build MVVM App for Android and IOS with Flutter

Programming Languages

dart
5743 projects

Projects that are alternatives of or similar to Mvvm flutter

Combine Mvvm
Sample project with Combine & UIKit framework, MVVM architecture
Stars: ✭ 132 (-31.96%)
Mutual labels:  mvvm-architecture
Android Vmlib
VMLib is an Android framework based on Android Jetpack, easy to use, desinged for fast development. Embrace the new way devloping Android :)
Stars: ✭ 146 (-24.74%)
Mutual labels:  mvvm-architecture
Trailersapp
A simple demo project for The Movie DB based on MVVM clean architecture.
Stars: ✭ 180 (-7.22%)
Mutual labels:  mvvm-architecture
Track My Location
Android real-time location tracker app (learn using Firebase 🔥, Google Maps & Location Api) 🌐
Stars: ✭ 136 (-29.9%)
Mutual labels:  mvvm-architecture
Artify Macos
🌎 18th century Arts for everyone
Stars: ✭ 140 (-27.84%)
Mutual labels:  mvvm-architecture
Paginglibrary Sample
An open source app that is refactored to demo Paging Library from Android Jetpack
Stars: ✭ 165 (-14.95%)
Mutual labels:  mvvm-architecture
Restapimvvm
App that interacts with a Rest Api. Architecture is MVVM.
Stars: ✭ 130 (-32.99%)
Mutual labels:  mvvm-architecture
Android Kotlin Mvi Cleanarchitecture
Android + Kotlin + Modularization + Gradle Depedency managment + Gradle written in Kotlin DSL + Custom Gradle Plugin + MVVM + MVI + Clean Architecture + Repository Pattern + Coroutines + Flows + Koin + Retrofit2 + ROOM + Kotlin-Android-Extension + KtLints
Stars: ✭ 187 (-3.61%)
Mutual labels:  mvvm-architecture
Popularmovies
🎥 Movie discovery app showcasing Android best practices with Google's recommended architecture: MVVM + Repository + Offline support + Android Architecture Components + Paging library & Retrofit2.
Stars: ✭ 142 (-26.8%)
Mutual labels:  mvvm-architecture
Mvvm Architecture Android Beginners
This repository contains a sample app that implements MVVM architecture using Kotlin, ViewModel, LiveData, and etc.
Stars: ✭ 176 (-9.28%)
Mutual labels:  mvvm-architecture
Hiya Hiya Hiya
Whatsapp Clone base on Firebase Cloud Messaging
Stars: ✭ 139 (-28.35%)
Mutual labels:  mvvm-architecture
Android Modular Architecture
📚 Sample Android Components Architecture on a modular word focused on the scalability, testability and maintainability written in Kotlin, following best practices using Jetpack.
Stars: ✭ 2,048 (+955.67%)
Mutual labels:  mvvm-architecture
Swifthub
GitHub iOS client in RxSwift and MVVM-C clean architecture
Stars: ✭ 2,330 (+1101.03%)
Mutual labels:  mvvm-architecture
Kotlinmultiplatform mvvm
Android & iOS App using MVVM pattern and LiveData on the presentation layer + Clean Arch on the common shared code.
Stars: ✭ 135 (-30.41%)
Mutual labels:  mvvm-architecture
Android Firebase Kotlin Java Mvp Mvc Mvvm Chat
Simple chat Application with one to one connectivity using Firebase Real time Database written in MVC,MVP and MVVM architecture to better understand the android coding patterns. Purpose of writing same application functionality with 3 different pattern is to show how single application can be developed using 3 different patterns(Mvc, Mvp, Mvvm).
Stars: ✭ 180 (-7.22%)
Mutual labels:  mvvm-architecture
Bindables
🧬 Android DataBinding kit for notifying data changes from Model layers to UI layers on MVVM architecture.
Stars: ✭ 130 (-32.99%)
Mutual labels:  mvvm-architecture
Clean Architecture Swiftui
SwiftUI sample app using Clean Architecture. Examples of working with CoreData persistence, networking, dependency injection, unit testing, and more.
Stars: ✭ 2,925 (+1407.73%)
Mutual labels:  mvvm-architecture
Diffadapter
A high-performance , easy-to-use Adapter for RecyclerView ,using diffutil
Stars: ✭ 193 (-0.52%)
Mutual labels:  mvvm-architecture
Mvvm Android
Build MVVM APP With Kotlin,完整示例见PaoNet
Stars: ✭ 184 (-5.15%)
Mutual labels:  mvvm-architecture
Kotlin Mvvm
Sample for MVVM using Kotlin
Stars: ✭ 173 (-10.82%)
Mutual labels:  mvvm-architecture

MVVM-Flutter

Build MVVM App for Android and IOS with Flutter。

The Structure seems like MVVM-Android

DownLoad

dependencies

PS:each layer connected by rx, use responsive thinking and rxdart operators for logical processing.Finally, update the view with provider.

ScreenShot

Code

//remote
class GithubService{
  Observable<dynamic> login()=> get("user");
}
//repo
class GithubRepo {
  final GithubService _remote;

  GithubRepo(this._remote);

  Observable login(String username, String password) {
    token = "basic " + base64Encode(utf8.encode('$username:$password'));
    return _remote.login();
  }
}
//viewmodel
class HomeViewModel extends ChangeNotifier {
  final GithubRepo _repo; 
  String username = ""; 
  String password = ""; 
  bool _loading = false; 
  String _response = ""; 
  //...
  HomeViewModel(this._repo);

   /**
   * call the model layer 's method to login
   * doOnData : handle response when success
   * doOnError : handle error when failure
   * doOnListen : show loading when listen start
   * doOnDone : hide loading when complete
   */
  Observable login() => _repo
      .login(username, password)
      .doOnData((r) => response = r.toString())
      .doOnError((e, stacktrace) {
        if (e is DioError) {
          response = e.response.data.toString();
        }
      })
      .doOnListen(() => loading = true)
      .doOnDone(() => loading = false);
}

/// View :HomePage
///
/// 获取其它页面传递来的参数
class HomePage extends PageProvideNode<HomeProvide> {
  /// 提供
  ///
  /// 获取参数 [title] 并生成一个[HomeProvide]对象
  HomePage(String title) : super(params: [title]);

  @override
  Widget buildContent(BuildContext context) {
    return _HomeContentPage(mProvider);
  }
}
// ...
class _HomeContentPageState extends State<_HomeContentPage> implements Presenter{
   //...
  _HomeState(this._viewModel) {
    providers.provideValue(_viewModel);
  }
	
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appbar://...,
        body://...
       
        CupertinoButton(
            onPressed: ()=>onClick(ACTION_LOGIN),
            //...
         ),
         Container(
                //...
                child: Provide<HomeViewModel>(
                  builder: (BuildContext context, Widget child,
                          HomeViewModel value) =>
                      Text(value.response),
                ),
              ),
        //...
        
        );
  }
  
  /// 通过[action]进行事件处理
  @override
  void onClick(String action) {
    print("onClick:" + action);
    if (ACTION_LOGIN == action) {
      _login();
    }
  }
  
    
  _login()=>_viewModel.login().doOnListen(() {
      _controller.forward();
    }).doOnDone(() {
      _controller.reverse();
    }).listen((_) {
      //success
      Toast.show("login success",context,type: Toast.SUCCESS);
    }, onError: (e) {
      //error
      dispatchFailure(context, e);
    });
 
}

LICENSE

the Apache License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].