Skip to content

Commit

Permalink
Deploy version 2.6.0+23 to alpha for testing (#107)
Browse files Browse the repository at this point in the history
* Add counter & mini view example (mvc rocket package) (#100)

* Add mvc_rocket package

* Add counter & mini view example

* removed tests

* bump version maunually

* bump version from 2.2.15+22 to 2.3.0+22 by fastlane plugin

* Disabled tests

* bump version from 2.3.0+22 to 2.4.0+22 by fastlane plugin

* Add posts mvc rocket example (#101)

* Add post model

* Add post request

* Add post view

* Integrate posts feature

* bump version from 2.4.0+22 to 2.5.0+22 by fastlane plugin

* Enhance realse notes (#102)

* Add photo mvc rocket example (#105)

* Add photo model

* Add photo request

* Add photo view

* Integrate photo screen

* format code

* bump version from 2.5.0+22 to 2.6.0+22 by fastlane plugin

* Fix push bump version on staging (#106)
  • Loading branch information
M97Chahboun authored Oct 21, 2022
1 parent bca8bd7 commit 1362d4a
Show file tree
Hide file tree
Showing 6 changed files with 154 additions and 4 deletions.
4 changes: 1 addition & 3 deletions android/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ lane :bump_version do |options|
sh "git add ../../pubspec.yaml"
sh 'git commit -m "bump version from '+result[:previous]+ ' to ' + result[:new] + ' by fastlane plugin"'
sh 'git tag -a v'+result[:new]+' -m "Version '+result[:new]+'"'
if(options[:bump])
sh 'git pull --rebase origin '+options[:branch]
end
sh 'git pull --rebase origin '+options[:branch]
sh "git push origin HEAD:"+options[:branch]
end
end
5 changes: 5 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
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:mvc_rocket/mvc_rocket.dart';

Expand All @@ -26,6 +27,9 @@ class App extends StatelessWidget {
'/post': (BuildContext context) => PostExample(
title: "100 Posts",
),
'/photo': (BuildContext context) => PhotoExample(
title: "5000 Photos",
),
},
title: '🚀 MVCRocket 🚀 Package',
theme: ThemeData(
Expand Down Expand Up @@ -103,6 +107,7 @@ class MyApp extends StatelessWidget {
const Example("Mini View", "miniView"),
const Example("Counter View", "counter"),
const Example("100 Posts", "post"),
const Example("5000 Photos", "photo"),
],
),
),
Expand Down
63 changes: 63 additions & 0 deletions lib/models/photo_model.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import 'package:mvc_rocket/mvc_rocket.dart';

const String photoAlbumIdField = "albumId";
const String photoIdField = "id";
const String photoTitleField = "title";
const String photoUrlField = "url";
const String photoThumbnailUrlField = "thumbnailUrl";

class Photo extends RocketModel<Photo> {
int? albumId;
int? id;
String? title;
String? url;
String? thumbnailUrl;

Photo({
this.albumId,
this.id,
this.title,
this.url,
this.thumbnailUrl,
});

@override
void fromJson(Map<String, dynamic> json, {bool isSub = false}) {
albumId = json[photoAlbumIdField];
id = json[photoIdField];
title = json[photoTitleField];
url = json[photoUrlField];
thumbnailUrl = json[photoThumbnailUrlField];
super.fromJson(json, isSub: isSub);
}

void updateFields({
int? albumIdField,
int? idField,
String? titleField,
String? urlField,
String? thumbnailUrlField,
}) {
albumId = albumIdField ?? albumId;
id = idField ?? id;
title = titleField ?? title;
url = urlField ?? url;
thumbnailUrl = thumbnailUrlField ?? thumbnailUrl;
rebuildWidget(fromUpdate: true);
}

@override
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = {};
data[photoAlbumIdField] = albumId;
data[photoIdField] = id;
data[photoTitleField] = title;
data[photoUrlField] = url;
data[photoThumbnailUrlField] = thumbnailUrl;

return data;
}

@override
get instance => Photo();
}
9 changes: 9 additions & 0 deletions lib/requests/photo_request.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import 'package:flutter_ci_cd/models/photo_model.dart';
import 'package:mvc_rocket/mvc_rocket.dart';

const String photosEndpoint = "photos";

class GetPhotos {
static Future getPhotos(Photo photoModel) => Rocket.get(rocketRequestKey)
.getObjData(photosEndpoint, photoModel, multi: true);
}
75 changes: 75 additions & 0 deletions lib/views/photo_view.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import 'package:flutter/material.dart';
import 'package:flutter_ci_cd/models/photo_model.dart';
import 'package:flutter_ci_cd/requests/photo_request.dart';
import 'package:mvc_rocket/mvc_rocket.dart';

class PhotoExample extends StatelessWidget {
PhotoExample({Key? key, required this.title}) : super(key: key);
final String title;
final Photo photo = Rocket.add<Photo>(photosEndpoint, Photo());
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(title),
),
body: SizedBox(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
child: RocketView(
model: photo,
// get 5000 items
call: () => GetPhotos.getPhotos(photo),
builder: (context) {
return ListView.builder(
itemCount: photo.multi!.length,
itemBuilder: (BuildContext context, int index) {
Photo currentphoto = photo.multi![index];
return Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
ListTile(
title: Text(currentphoto.title!),
leading: Text(currentphoto.id!.toString()),
onTap: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (BuildContext context) {
return ApiImage(currentphoto.url!);
}));
},
),
],
),
);
});
},
)),
);
}
}

class ApiImage extends StatelessWidget {
final String url;
const ApiImage(this.url, {Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Image.network(
url,
frameBuilder: (_, child, __, ___) {
return Container(
decoration: BoxDecoration(boxShadow: [
BoxShadow(
blurRadius: 10.0,
color: Colors.black.withAlpha(100),
offset: Offset.zero)
]),
child: child,
);
},
)),
);
}
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html

version: 2.5.0+22
version: 2.6.0+23

environment:
sdk: ">=2.17.6 <3.0.0"
Expand Down

0 comments on commit 1362d4a

Please sign in to comment.