Skip to content

Commit 3d27dbc

Browse files
committed
code refactored
1 parent a6735c0 commit 3d27dbc

File tree

10 files changed

+322
-265
lines changed

10 files changed

+322
-265
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ You can follow me on twitter [@diegoveloper](https://www.twitter.com/diegovelope
4444
| <center> <img src="https://media.giphy.com/media/h4x6fHw65l3KdnDrTi/giphy.gif" width="250"> </center> | <center> <img src="https://media.giphy.com/media/Y07CGmYvcNyl9rkgbY/giphy.gif" width="250">
4545
</center>
4646

47-
| App Clone / Photo Concept | Animations / Page View Animated |
47+
| App Clone / Photo Concept | App Clone / Movies Concept |
4848
|--|--|
4949
| <center> <img src="https://media.giphy.com/media/XybRawN2vj4YV3fhul/giphy.gif" width="250"> </center> | <center> <img src="https://media.giphy.com/media/UuNiEk20TKjn4F4H7a/giphy.gif" width="250">
5050
</center>

lib/animations/main_animations.dart

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import 'package:flutter_samples/animations/custom_appbar/my_custom_appbar_page.d
44
import 'package:flutter_samples/animations/foldable/foldable_animation.dart';
55
import 'package:flutter_samples/animations/list_details/list_page.dart';
66
import 'package:flutter_samples/animations/menu_exploration/main_menu_exploration.dart';
7-
import 'package:flutter_samples/animations/page_view_animated/page_view_animated.dart';
87
import 'package:flutter_samples/animations/split_widget/main_split_widget.dart';
98
import 'package:flutter_samples/animations/turn_on_the_light/turn_on_the_light.dart';
109
import 'package:flutter_samples/main.dart';
@@ -89,13 +88,6 @@ class MainAnimationsState extends State<MainAnimations> {
8988
onButtonTap(MainMenuExploration());
9089
},
9190
),
92-
93-
MyMenuButton(
94-
title: "Page View Animated",
95-
actionTap: () {
96-
onButtonTap(PageViewAnimated());
97-
},
98-
),
9991
],
10092
),
10193
),
Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,53 @@
11
class Album {
22
final String image;
33

4-
Album._(this.image);
4+
const Album._(this.image);
55

66
factory Album.fromJson(dynamic json) =>
77
Album._(((json['image'] as List).last)['#text']);
88
}
9+
10+
const albumsData = [
11+
Album._(
12+
'https:\/\/lastfm.freetls.fastly.net\/i\/u\/174s\/ac6921b5afdc64f859a2aa38773a468b.jpg'),
13+
Album._(
14+
'https:\/\/lastfm.freetls.fastly.net\/i\/u\/174s\/cf3a46415a1f4e9cce0f365af8225097.png'),
15+
Album._(
16+
'https:\/\/lastfm.freetls.fastly.net\/i\/u\/174s\/1e5ef1165e904436a5a244c936fb505c.png'),
17+
Album._(
18+
'https:\/\/lastfm.freetls.fastly.net\/i\/u\/174s\/716e62c7152a4788bb47cfe7207b8521.jpg'),
19+
Album._(
20+
'https:\/\/lastfm.freetls.fastly.net\/i\/u\/174s\/cf47afa9760249238e3269e61b5facb4.png'),
21+
Album._(
22+
'https:\/\/lastfm.freetls.fastly.net\/i\/u\/174s\/cdee664c355c4c9dbb0e7ba8db690064.png'),
23+
Album._(
24+
'https:\/\/lastfm.freetls.fastly.net\/i\/u\/174s\/05cc536929ca130183b15c1f1f9f221e.jpg'),
25+
Album._(
26+
'https:\/\/lastfm.freetls.fastly.net\/i\/u\/174s\/cc8218235b6f438dbddd294d9022880e.png'),
27+
Album._(
28+
'https:\/\/lastfm.freetls.fastly.net\/i\/u\/174s\/667c311baea63b88f110ad49e094fd12.jpg'),
29+
Album._(
30+
'https:\/\/lastfm.freetls.fastly.net\/i\/u\/174s\/c1e96f217c4c4d15a6d00fff66e21226.png'),
31+
Album._(
32+
'https:\/\/lastfm.freetls.fastly.net\/i\/u\/174s\/16849a85994fe7b931dd348c5fb70987.jpg'),
33+
Album._(
34+
'https:\/\/lastfm.freetls.fastly.net\/i\/u\/174s\/ba2bc55a13cc4dd9824ef9ebb8f468f0.jpg'),
35+
Album._(
36+
'https:\/\/lastfm.freetls.fastly.net\/i\/u\/174s\/e588abb451e854488dfe2a64a6e0aeb5.jpg'),
37+
Album._(
38+
'https:\/\/lastfm.freetls.fastly.net\/i\/u\/174s\/b788451ab3594c81b77ff24e6f5d439f.png'),
39+
Album._(
40+
'https:\/\/lastfm.freetls.fastly.net\/i\/u\/174s\/05442cefecfc46b4aeb6ea62a5366a5e.jpg'),
41+
Album._(
42+
'https:\/\/lastfm.freetls.fastly.net\/i\/u\/174s\/1a77ce6d579b4ba5b0c5caa9a4606cf6.png'),
43+
Album._(
44+
'https:\/\/lastfm.freetls.fastly.net\/i\/u\/174s\/bc4e31504f5f47adb31f36aa0889be45.png'),
45+
Album._(
46+
'https:\/\/lastfm.freetls.fastly.net\/i\/u\/174s\/742e40bd3aa5e14e86842f457d7ece2c.jpg'),
47+
Album._(
48+
'https:\/\/lastfm.freetls.fastly.net\/i\/u\/174s\/89c670accaa20ceab8f53f5dced75706.jpg'),
49+
Album._(
50+
'https:\/\/lastfm.freetls.fastly.net\/i\/u\/174s\/6d305843325cec758562218fa504d47e.png'),
51+
Album._(
52+
'https:\/\/lastfm.freetls.fastly.net\/i\/u\/174s\/66cf5a401c274f418e0c35268931d6ee.png'),
53+
];

lib/app_clone/album_flow/album_flow_page.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ class _AlbumFlowPageState extends State<AlbumFlowPage> {
2323
final _pageController = PageController();
2424
final _pageNotifier = ValueNotifier<double>(0.0);
2525
double _lastOffset = 0.0;
26-
double _maxScroll = 0.0;
2726
int numberOfElements = 30;
2827

2928
void _scrollListener() {
@@ -34,7 +33,6 @@ class _AlbumFlowPageState extends State<AlbumFlowPage> {
3433
} else {
3534
isGoingDown = true;
3635
}
37-
_maxScroll = _pageController.position.maxScrollExtent;
3836
_lastOffset = _pageNotifier.value;
3937
}
4038

@@ -92,6 +90,7 @@ class _AlbumFlowPageState extends State<AlbumFlowPage> {
9290
valueListenable: _pageNotifier,
9391
builder: (context, value, child) {
9492
return ListView.builder(
93+
physics: const BouncingScrollPhysics(),
9594
padding: const EdgeInsets.only(
9695
top: 100, left: 25, right: 25),
9796
controller: _pageController,

lib/app_clone/album_flow/album_image.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import 'dart:ui';
22
import 'package:flutter/material.dart';
33
import 'package:cached_network_image/cached_network_image.dart';
4-
import 'package:flutter/scheduler.dart';
54
import 'package:vector_math/vector_math.dart' as vector;
65

76
class AlbumImage extends StatelessWidget {
@@ -16,7 +15,6 @@ class AlbumImage extends StatelessWidget {
1615

1716
@override
1817
Widget build(BuildContext context) {
19-
timeDilation = 1.0;
2018
return Hero(
2119
tag: image,
2220
flightShuttleBuilder: (

lib/app_clone/main_apps_clone.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter_samples/app_clone/album_flow/album_flow_page.dart';
33
import 'package:flutter_samples/app_clone/android_messages/android_messages_page.dart';
4+
import 'package:flutter_samples/app_clone/movies_concept/movies_concept_page.dart';
45
import 'package:flutter_samples/app_clone/photo_concept/photo_concept_page.dart';
56
import 'package:flutter_samples/app_clone/shoes_store/shoes_store_page.dart';
67
import 'package:flutter_samples/app_clone/sports_store/sports_store_page.dart';
@@ -42,6 +43,12 @@ class MainAppCloneState extends State<MainAppsClone> {
4243
onButtonTap(TwitterProfilePage());
4344
},
4445
),
46+
MyMenuButton(
47+
title: "Movies Concept",
48+
actionTap: () {
49+
onButtonTap(MoviesConceptPage());
50+
},
51+
),
4552
MyMenuButton(
4653
title: "Photo Concept",
4754
actionTap: () {

lib/animations/page_view_animated/page_view_animated.dart renamed to lib/app_clone/movies_concept/movies_concept_page.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ const movies = [
2727
),
2828
];
2929

30-
class PageViewAnimated extends StatefulWidget {
30+
class MoviesConceptPage extends StatefulWidget {
3131
@override
32-
_PageViewAnimatedState createState() => _PageViewAnimatedState();
32+
_MoviesConceptPageState createState() => _MoviesConceptPageState();
3333
}
3434

35-
class _PageViewAnimatedState extends State<PageViewAnimated> {
35+
class _MoviesConceptPageState extends State<MoviesConceptPage> {
3636
final pageController = PageController(viewportFraction: 0.7);
3737
final ValueNotifier<double> _pageNotifier = ValueNotifier(0.0);
3838

@@ -130,6 +130,7 @@ class _PageViewAnimatedState extends State<PageViewAnimated> {
130130
child: Align(
131131
alignment: Alignment.bottomCenter,
132132
child: Card(
133+
color: Colors.white,
133134
borderOnForeground: true,
134135
elevation: 4,
135136
shape: RoundedRectangleBorder(
@@ -165,6 +166,7 @@ class _PageViewAnimatedState extends State<PageViewAnimated> {
165166
textAlign: TextAlign.center,
166167
style: TextStyle(
167168
fontWeight: FontWeight.w700,
169+
color: Colors.black,
168170
fontSize: 24,
169171
),
170172
),

lib/app_clone/shoes_store/shoes_store_page.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import 'dart:math';
21
import 'dart:ui';
32

43
import 'package:flutter/material.dart';

lib/app_clone/sports_store/sports_store_detail_page.dart

Lines changed: 49 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -9,61 +9,64 @@ class SportsStoreDetailPage extends StatelessWidget {
99
@override
1010
Widget build(BuildContext context) {
1111
final size = MediaQuery.of(context).size;
12-
return Scaffold(
13-
body: Stack(
14-
fit: StackFit.expand,
15-
children: [
16-
Positioned(
17-
top: 0,
18-
right: 0,
19-
width: size.width / 2.5,
20-
height: size.height / 1.8,
21-
child: Hero(
22-
tag: 'hero_background_${ball.name}',
23-
child: Container(
24-
decoration: BoxDecoration(
25-
color: ball.color,
26-
borderRadius: BorderRadius.only(
27-
bottomLeft: Radius.circular(30),
12+
return Theme(
13+
data: ThemeData.light(),
14+
child: Scaffold(
15+
body: Stack(
16+
fit: StackFit.expand,
17+
children: [
18+
Positioned(
19+
top: 0,
20+
right: 0,
21+
width: size.width / 2.5,
22+
height: size.height / 1.8,
23+
child: Hero(
24+
tag: 'hero_background_${ball.name}',
25+
child: Container(
26+
decoration: BoxDecoration(
27+
color: ball.color,
28+
borderRadius: BorderRadius.only(
29+
bottomLeft: Radius.circular(30),
30+
),
2831
),
2932
),
3033
),
3134
),
32-
),
33-
Positioned(
34-
left: 30,
35-
top: 100,
36-
child: Hero(
37-
tag: 'hero_text_${ball.name}',
38-
child: Material(
39-
color: Colors.transparent,
40-
child: Text(
41-
ball.name.split(' ').join('\n'),
42-
style: TextStyle(
43-
color: Colors.black,
44-
fontSize: 40,
45-
fontWeight: FontWeight.w700),
35+
Positioned(
36+
left: 30,
37+
top: 100,
38+
child: Hero(
39+
tag: 'hero_text_${ball.name}',
40+
child: Material(
41+
color: Colors.transparent,
42+
child: Text(
43+
ball.name.split(' ').join('\n'),
44+
style: TextStyle(
45+
color: Colors.black,
46+
fontSize: 40,
47+
fontWeight: FontWeight.w700),
48+
),
4649
),
4750
),
4851
),
49-
),
50-
Positioned(
51-
right: 30,
52-
top: size.height / 4,
53-
child: Hero(
54-
tag: 'hero_ball_${ball.name}',
55-
child: Image.asset(
56-
ball.image,
57-
height: MediaQuery.of(context).size.width / 2.2,
52+
Positioned(
53+
right: 30,
54+
top: size.height / 4,
55+
child: Hero(
56+
tag: 'hero_ball_${ball.name}',
57+
child: Image.asset(
58+
ball.image,
59+
height: MediaQuery.of(context).size.width / 2.2,
60+
),
5861
),
5962
),
60-
),
61-
Positioned(
62-
left: 20,
63-
top: 40,
64-
child: BackButton(),
65-
),
66-
],
63+
Positioned(
64+
left: 20,
65+
top: 40,
66+
child: BackButton(),
67+
),
68+
],
69+
),
6770
),
6871
);
6972
}

0 commit comments

Comments
 (0)