Skip to content

Commit

Permalink
Deploy version 2.7.0+24 for testing
Browse files Browse the repository at this point in the history
Deploy version 2.7.0+24 for testing
  • Loading branch information
M97Chahboun authored Oct 22, 2022
2 parents 831a894 + d2d8a74 commit 7614810
Show file tree
Hide file tree
Showing 10 changed files with 479 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/bump-version-based-on-labels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ jobs:
ruby-version: "2.6"
bundler-cache: true
working-directory: android
- run: bundle exec fastlane bump_version push:true branch:${{ github.head_ref }} ${{env.parts}} bump_build:false
- run: bundle exec fastlane bump_version branch:${{ github.head_ref }} ${{env.parts}} bump_build:false
working-directory: android
2 changes: 1 addition & 1 deletion android/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ lane :bump_version do |options|
parts: options[:bump],
pubspec: "../pubspec.yaml"
)
if(options[:push] && options[:bump])
if(options[:push] || options[:bump])
sh "git config --global user.email [email protected]"
sh "git config --global user.name Mohammed chahboun"
sh "git config --global push.followTags true"
Expand Down
5 changes: 5 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:flutter_ci_cd/views/counter_view.dart';
import 'package:flutter_ci_cd/views/mini_view.dart';
import 'package:flutter_ci_cd/views/photo_view.dart';
import 'package:flutter_ci_cd/views/post_view.dart';
import 'package:flutter_ci_cd/views/user_view.dart';
import 'package:mvc_rocket/mvc_rocket.dart';

void main() {
Expand All @@ -30,6 +31,9 @@ class App extends StatelessWidget {
'/photo': (BuildContext context) => PhotoExample(
title: "5000 Photos",
),
'/user': (BuildContext context) => UserExample(
title: "10 Users",
),
},
title: '🚀 MVCRocket 🚀 Package',
theme: ThemeData(
Expand Down Expand Up @@ -108,6 +112,7 @@ class MyApp extends StatelessWidget {
const Example("Counter View", "counter"),
const Example("100 Posts", "post"),
const Example("5000 Photos", "photo"),
const Example("10 Users", "user"),
],
),
),
Expand Down
96 changes: 96 additions & 0 deletions lib/models/user_model.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import 'package:mvc_rocket/mvc_rocket.dart';

import 'user_submodel/address_submodel.dart';
import 'user_submodel/company_submodel.dart';

const String userIdField = "id";
const String userNameField = "name";
const String userUsernameField = "username";
const String userEmailField = "email";
const String userAddressField = "address";
const String userPhoneField = "phone";
const String userWebsiteField = "website";
const String userCompanyField = "company";
const String userImageField = "image";

class User extends RocketModel<User> {
int? id;
String? name;
String? username;
String? email;
Address? address;
String? phone;
String? website;
Company? company;
String? image;

User(
{this.id,
this.name,
this.username,
this.email,
this.address,
this.phone,
this.website,
this.company,
this.image}) {
address ??= Address();
company ??= Company();
}

@override
void fromJson(Map<String, dynamic> json, {bool isSub = false}) {
id = json[userIdField];
name = json[userNameField];
username = json[userUsernameField];
email = json[userEmailField];
address!.fromJson(json[userAddressField]);
phone = json[userPhoneField];
website = json[userWebsiteField];
image = json[userImageField];
company!.fromJson(json[userCompanyField]);
super.fromJson(json, isSub: isSub);
}

void updateFields({
int? idField,
String? nameField,
String? usernameField,
String? emailField,
Address? addressField,
String? phoneField,
String? websiteField,
Company? companyField,
String? imageField,
}) {
id = idField ?? id;
name = nameField ?? name;
username = usernameField ?? username;
email = emailField ?? email;
address = addressField ?? address;
phone = phoneField ?? phone;
image = imageField ?? image;
website = websiteField ?? website;
company = companyField ?? company;
rebuildWidget(fromUpdate: true);
}

@override
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = {};
data[userIdField] = id;
data[userNameField] = name;
data[userUsernameField] = username;
data[userEmailField] = email;
data[userAddressField] = address!.toJson();
data[userPhoneField] = phone;
data[userWebsiteField] = website;
data[userCompanyField] = company!.toJson();
data[userImageField] = image;

return data;
}

@override
get instance => User();
}
63 changes: 63 additions & 0 deletions lib/models/user_submodel/address_submodel.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import 'package:flutter_ci_cd/models/user_submodel/geo_submodel.dart';
import 'package:mvc_rocket/mvc_rocket.dart';

const String addressStreetField = "street";
const String addressSuiteField = "suite";
const String addressCityField = "city";
const String addressZipcodeField = "zipcode";
const String addressGeoField = "geo";

class Address extends RocketModel<Address> {
String? street;
String? suite;
String? city;
String? zipcode;
Geo? geo;

Address({
this.street,
this.suite,
this.city,
this.zipcode,
this.geo,
}) {
geo ??= Geo();
}

@override
void fromJson(Map<String, dynamic> json, {bool isSub = false}) {
street = json[addressStreetField];
suite = json[addressSuiteField];
city = json[addressCityField];
zipcode = json[addressZipcodeField];
geo!.fromJson(json[addressGeoField]);
super.fromJson(json, isSub: isSub);
}

void updateFields({
String? streetField,
String? suiteField,
String? cityField,
String? zipcodeField,
Geo? geoField,
}) {
street = streetField ?? street;
suite = suiteField ?? suite;
city = cityField ?? city;
zipcode = zipcodeField ?? zipcode;
geo = geoField ?? geo;
rebuildWidget(fromUpdate: true);
}

@override
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = {};
data[addressStreetField] = street;
data[addressSuiteField] = suite;
data[addressCityField] = city;
data[addressZipcodeField] = zipcode;
data[addressGeoField] = geo!.toJson();

return data;
}
}
46 changes: 46 additions & 0 deletions lib/models/user_submodel/company_submodel.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import 'package:mvc_rocket/mvc_rocket.dart';

const String companyNameField = "name";
const String companyCatchPhraseField = "catchPhrase";
const String companyBsField = "bs";

class Company extends RocketModel<Company> {
String? name;
String? catchPhrase;
String? bs;

Company({
this.name,
this.catchPhrase,
this.bs,
});

@override
void fromJson(Map<String, dynamic> json, {bool isSub = false}) {
name = json[companyNameField];
catchPhrase = json[companyCatchPhraseField];
bs = json[companyBsField];
super.fromJson(json, isSub: isSub);
}

void updateFields({
String? nameField,
String? catchPhraseField,
String? bsField,
}) {
name = nameField ?? name;
catchPhrase = catchPhraseField ?? catchPhrase;
bs = bsField ?? bs;
rebuildWidget(fromUpdate: true);
}

@override
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = {};
data[companyNameField] = name;
data[companyCatchPhraseField] = catchPhrase;
data[companyBsField] = bs;

return data;
}
}
38 changes: 38 additions & 0 deletions lib/models/user_submodel/geo_submodel.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import 'package:mvc_rocket/mvc_rocket.dart';

const String geoLatField = "lat";
const String geoLngField = "lng";

class Geo extends RocketModel<Geo> {
String? lat;
String? lng;

Geo({
this.lat,
this.lng,
});
@override
void fromJson(Map<String, dynamic> json, {bool isSub = false}) {
lat = json[geoLatField];
lng = json[geoLngField];
super.fromJson(json, isSub: isSub);
}

void updateFields({
String? latField,
String? lngField,
}) {
lat = latField ?? lat;
lng = lngField ?? lng;
rebuildWidget(fromUpdate: true);
}

@override
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = {};
data[geoLatField] = lat;
data[geoLngField] = lng;

return data;
}
}
9 changes: 9 additions & 0 deletions lib/requests/user_request.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import 'package:flutter_ci_cd/models/user_model.dart';
import 'package:mvc_rocket/mvc_rocket.dart';

const String usersEndpoint = "users";

class GetUsers {
static Future getUsers(User userModel) => Rocket.get(rocketRequestKey)
.getObjData(usersEndpoint, userModel, multi: true);
}
Loading

0 comments on commit 7614810

Please sign in to comment.