Commit 4e39950 1 parent 834d350 commit 4e39950 Copy full SHA for 4e39950
File tree 6 files changed +27
-31
lines changed
6 files changed +27
-31
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ publish_to: none
5
5
version : 0.1.0
6
6
7
7
environment :
8
- sdk : ^3.6. 0
8
+ sdk : ^3.7.0- 0
9
9
10
10
dependencies :
11
11
cached_network_image : ^3.4.1
Original file line number Diff line number Diff line change @@ -12,12 +12,12 @@ import 'package:testing_app/screens/favorites.dart';
12
12
late Favorites favoritesList;
13
13
14
14
Widget createFavoritesScreen () => ChangeNotifierProvider <Favorites >(
15
- create: (context) {
16
- favoritesList = Favorites ();
17
- return favoritesList;
18
- },
19
- child: const MaterialApp (home: FavoritesPage ()),
20
- );
15
+ create: (context) {
16
+ favoritesList = Favorites ();
17
+ return favoritesList;
18
+ },
19
+ child: const MaterialApp (home: FavoritesPage ()),
20
+ );
21
21
22
22
void main () {
23
23
group ('Testing App State Management Tests' , () {
Original file line number Diff line number Diff line change @@ -17,17 +17,14 @@ class FavoritesPage extends StatelessWidget {
17
17
return Scaffold (
18
18
appBar: AppBar (title: const Text ('Favorites' )),
19
19
body: Consumer <Favorites >(
20
- builder:
21
- (context, value, child) =>
22
- value.items.isNotEmpty
23
- ? ListView .builder (
24
- itemCount: value.items.length,
25
- padding: const EdgeInsets .symmetric (vertical: 16 ),
26
- itemBuilder:
27
- (context, index) =>
28
- FavoriteItemTile (value.items[index]),
29
- )
30
- : const Center (child: Text ('No favorites added.' )),
20
+ builder: (context, value, child) => value.items.isNotEmpty
21
+ ? ListView .builder (
22
+ itemCount: value.items.length,
23
+ padding: const EdgeInsets .symmetric (vertical: 16 ),
24
+ itemBuilder: (context, index) =>
25
+ FavoriteItemTile (value.items[index]),
26
+ )
27
+ : const Center (child: Text ('No favorites added.' )),
31
28
),
32
29
);
33
30
}
Original file line number Diff line number Diff line change @@ -57,10 +57,9 @@ class ItemTile extends StatelessWidget {
57
57
title: Text ('Item $itemNo ' , key: Key ('text_$itemNo ' )),
58
58
trailing: IconButton (
59
59
key: Key ('icon_$itemNo ' ),
60
- icon:
61
- favoritesList.items.contains (itemNo)
62
- ? const Icon (Icons .favorite)
63
- : const Icon (Icons .favorite_border),
60
+ icon: favoritesList.items.contains (itemNo)
61
+ ? const Icon (Icons .favorite)
62
+ : const Icon (Icons .favorite_border),
64
63
onPressed: () {
65
64
! favoritesList.items.contains (itemNo)
66
65
? favoritesList.add (itemNo)
Original file line number Diff line number Diff line change @@ -11,12 +11,12 @@ import 'package:testing_app/screens/favorites.dart';
11
11
late Favorites favoritesList;
12
12
13
13
Widget createFavoritesScreen () => ChangeNotifierProvider <Favorites >(
14
- create: (context) {
15
- favoritesList = Favorites ();
16
- return favoritesList;
17
- },
18
- child: const MaterialApp (home: FavoritesPage ()),
19
- );
14
+ create: (context) {
15
+ favoritesList = Favorites ();
16
+ return favoritesList;
17
+ },
18
+ child: const MaterialApp (home: FavoritesPage ()),
19
+ );
20
20
21
21
void addItems () {
22
22
for (var i = 0 ; i < 5 ; i++ ) {
Original file line number Diff line number Diff line change @@ -9,9 +9,9 @@ import 'package:testing_app/main.dart';
9
9
import 'package:testing_app/models/favorites.dart' ;
10
10
11
11
Widget createHomeScreen () => ChangeNotifierProvider <Favorites >(
12
- create: (context) => Favorites (),
13
- child: MaterialApp .router (routerConfig: router ()),
14
- );
12
+ create: (context) => Favorites (),
13
+ child: MaterialApp .router (routerConfig: router ()),
14
+ );
15
15
16
16
void main () {
17
17
group ('Home Page Widget Tests' , () {
You can’t perform that action at this time.
0 commit comments