Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

last version in mc & marked it as discontinued package #11

Merged
merged 24 commits into from
Mar 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b5b3eb1
use HashMap instead of Map
M97Chahboun Dec 19, 2021
5fd0e4f
use LinkedList instead of List
M97Chahboun Dec 19, 2021
2f30749
make removeWhere extension support multivalue
M97Chahboun Dec 19, 2021
7312dc5
null supported for examples
M97Chahboun Dec 23, 2021
26051ca
Merge branch 'staging' into dev
M97Chahboun Dec 29, 2021
eebc844
Merge pull request #5 from OurFlutterC/dev
M97Chahboun Dec 29, 2021
95b3aea
use HashMap instead of Map and add hasKey extension
M97Chahboun Jan 2, 2022
e3ed0a2
solved conflicts'
M97Chahboun Jan 2, 2022
73092d6
Merge pull request #6 from OurFlutterC/dev
M97Chahboun Jan 2, 2022
017cb91
add models keys
M97Chahboun Jan 2, 2022
9d4001f
Merge pull request #7 from OurFlutterC/staging
M97Chahboun Jan 2, 2022
675d8cd
convert keys method to getter
M97Chahboun Jan 2, 2022
a6411b1
Merge branch 'dev' of https://github.com/OurFlutterC/mc into dev
M97Chahboun Jan 2, 2022
0fdacaf
add toScreenSize extension
M97Chahboun Jan 2, 2022
b5ec4c8
add toScreenSize extension
M97Chahboun Jan 2, 2022
f92df3d
Merge branch 'dev' of https://github.com/OurFlutterC/mc into dev
M97Chahboun Jan 2, 2022
698b9fe
add default value for onError [mc_request]
M97Chahboun Jan 3, 2022
4c1ab10
make loadin automatic for McView
M97Chahboun Jan 3, 2022
bc6f689
use Size object instead of height an width double & add sizeScreen ex…
M97Chahboun Jan 5, 2022
2109196
use log instead of print
M97Chahboun Jan 6, 2022
25fe62c
optimized _objData method in McRequest & rename folders for dart style
M97Chahboun Jan 25, 2022
91ea11b
add requests folder in examples
M97Chahboun Jan 25, 2022
b53402e
add const request key & endpoints on examples
M97Chahboun Feb 8, 2022
5636c89
marked mc as discontinued package
M97Chahboun Mar 20, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,17 @@
- removed [complex] parameter in [McRequest] methods
- in [McView] passed on [onError] builder [McException] msg of error and reload method for use it for retry
- removed unused parameter on [McView] Builder

## [0.0.2+2]
- add default value for onError on [McRequest] methods
- make loading automatic on [McView]
- use [Size] object instead of height an width double & inject [sizeScreen] extension in [BuildContext]
- use [log] instead of [print] for debugging mode
- optimized [_objData] method in [McRequest]
- optimized examples structure
- use [HashMap] instead of Map & add [hasKey] extension on [HashMap]
- use [LinkedList] instead of [List] & add extensions needed
- add const keys for RocketController [mcRequestKey], [sizeScreenKey] & [sizeDesignKey]
- Rename package from [mc] to [MVCRocket]
- Marked [mc] as discontinued package
- Publish package with new name [MVCRocket]
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# mc

State management and request package, Model,View,Controller,Request MVCR.
This package mark as discontinued you will found it with new name MVCRocket

# Author: [Mohammed CHAHBOUN](https://github.com/m97chahboun)

Expand All @@ -15,7 +16,7 @@ In your flutter project, add the dependency to your `pubspec.yaml`
```yaml
dependencies:
...
mc: ^0.0.2+1
mc: ^0.0.2+3
```
# Usage
## Simple case use McMV & McValue
Expand Down
173 changes: 0 additions & 173 deletions example/lib/Models/UserModel.dart

This file was deleted.

16 changes: 8 additions & 8 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import 'dart:async';
import 'package:example/views/counter_View.dart';
import 'package:example/views/mini_view.dart';
import 'package:example/views/photo_View.dart';
import 'package:example/views/post_View.dart';
import 'package:example/views/user_View.dart';
import 'package:flutter/material.dart';
import 'package:mc/mc.dart';
import 'Views/counter_View.dart';
import 'Views/mini_view.dart';
import 'Views/photo_View.dart';
import 'Views/post_View.dart';
import 'Views/user_View.dart';

void main() {
runApp(App());
Expand Down Expand Up @@ -45,7 +45,7 @@ class App extends StatelessWidget {
// ignore: must_be_immutable
class MyApp extends StatelessWidget {
final ValueNotifier<double> dx = ValueNotifier<double>(0.1);
BuildContext cntx;
late BuildContext cntx;
final List<String> exps = [
"Mc Package",
"Link your app with API easily",
Expand All @@ -59,7 +59,7 @@ class MyApp extends StatelessWidget {
// create request object
McRequest request = McRequest(url: baseUrl);
// save it, for use it from any screen
mc.add('rq', request);
mc.add(mcRequestKey, request);
Timer.periodic(Duration(milliseconds: 5), (timer) {
if (dx.value <=
MediaQuery.of(cntx).size.width +
Expand Down Expand Up @@ -100,7 +100,7 @@ class MyApp extends StatelessWidget {
exps[index],
style: Theme.of(context)
.textTheme
.headline5
.headline5!
.copyWith(fontWeight: FontWeight.bold),
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Counter extends McModel<Counter> {
Counter({
this.count = 0,
});
fromJson(Map<String, dynamic> json) {
fromJson(covariant Map<String, dynamic> json) {
count = json['count'] ?? count;
return super.fromJson(json);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
import 'package:mc/mc.dart';

class Photo extends McModel<Photo> {
List<Photo> multi;
int albumId;
int id;
String title;
String url;
String thumbnailUrl;
List<Photo>? multi;
int? albumId;
int? id;
String? title;
String? url;
String? thumbnailUrl;

String albumIdVar = "albumId";
String idVar = "id";
String titleVar = "title";
String urlVar = "url";
String thumbnailUrlVar = "thumbnailUrl";
Photo({
this.albumId,
this.id,
this.title,
this.url,
this.thumbnailUrl,
}) {
multi = multi ?? [];
}
fromJson(Map<String, dynamic> json) {
});

void fromJson(covariant Map<String, dynamic> json) {
albumId = json['albumId'] ?? albumId;
id = json['id'] ?? id;
title = json['title'] ?? title;
Expand All @@ -27,7 +31,7 @@ class Photo extends McModel<Photo> {
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
final Map<String, dynamic> data = {};
data['albumId'] = this.albumId;
data['id'] = this.id;
data['title'] = this.title;
Expand All @@ -38,12 +42,11 @@ class Photo extends McModel<Photo> {
}

void setMulti(List data) {
List listOfphoto = data.map((e) {
Photo photo = Photo();
photo.fromJson(e);
return photo;
List<Photo> listOfphotos = data.map((e) {
Photo photos = Photo();
photos.fromJson(e);
return photos;
}).toList();
multi = listOfphoto;
multi = listOfphotos;
}
}

Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
import 'package:mc/mc.dart';

class Post extends McModel<Post> {
List<Post> multi;
int userId;
int id;
String title;
String body;

final String userIdStr = 'userId';
final String idStr = 'id';
final String titleStr = 'title';
final String bodyStr = 'body';
List<Post>? multi;
int? userId;
int? id;
String? title;
String? body;

String userIdVar = "userId";
String idVar = "id";
String titleVar = "title";
String bodyVar = "body";
Post({
this.userId,
this.id,
this.title,
this.body,
});

fromJson(Map<String, dynamic> json) {
void fromJson(covariant Map<String, dynamic> json) {
userId = json['userId'] ?? userId;
id = json['id'] ?? id;
title = json['title'] ?? title;
Expand All @@ -28,7 +27,7 @@ class Post extends McModel<Post> {
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
final Map<String, dynamic> data = {};
data['userId'] = this.userId;
data['id'] = this.id;
data['title'] = this.title;
Expand All @@ -38,7 +37,7 @@ class Post extends McModel<Post> {
}

void setMulti(List data) {
List listOfpost = data.map((e) {
List<Post> listOfpost = data.map((e) {
Post post = Post();
post.fromJson(e);
return post;
Expand Down
Loading