|
1 | 1 | import 'package:flutter/material.dart';
|
2 | 2 | import 'package:provider/provider.dart';
|
| 3 | +import 'package:firebase_auth/firebase_auth.dart'; |
3 | 4 |
|
4 | 5 | import '../models/fav_anime_provider.dart';
|
5 | 6 |
|
@@ -33,50 +34,56 @@ class _FavAnimeScreenState extends State<FavAnimeScreen> {
|
33 | 34 | centerTitle: true,
|
34 | 35 | elevation: 0,
|
35 | 36 | ),
|
36 |
| - body: ListView.separated( |
37 |
| - itemCount: fav.length, |
38 |
| - itemBuilder: (context, i) { |
39 |
| - return InkWell( |
40 |
| - onTap: () {}, |
41 |
| - child: Padding( |
42 |
| - padding: const EdgeInsets.all(8.0), |
43 |
| - child: Column( |
44 |
| - mainAxisAlignment: MainAxisAlignment.spaceEvenly, |
45 |
| - children: [ |
46 |
| - Row( |
47 |
| - mainAxisAlignment: MainAxisAlignment.spaceAround, |
48 |
| - children: [ |
49 |
| - CircleAvatar( |
50 |
| - radius: 35, |
51 |
| - backgroundImage: NetworkImage(fav[i]['imgUrl']), |
52 |
| - backgroundColor: Colors.black.withOpacity(0.04), |
53 |
| - ), |
54 |
| - Expanded( |
55 |
| - child: Container( |
56 |
| - margin: const EdgeInsets.only(left: 10), |
57 |
| - child: Text( |
58 |
| - fav[i]['title'], |
59 |
| - style: const TextStyle( |
60 |
| - fontWeight: FontWeight.w500, |
61 |
| - fontSize: 16, |
| 37 | + body: FirebaseAuth.instance.currentUser == null |
| 38 | + ? Container( |
| 39 | + child: const Center( |
| 40 | + child: Text('Not Logged In'), |
| 41 | + ), |
| 42 | + ) |
| 43 | + : ListView.separated( |
| 44 | + itemCount: fav.length, |
| 45 | + itemBuilder: (context, i) { |
| 46 | + return InkWell( |
| 47 | + onTap: () {}, |
| 48 | + child: Padding( |
| 49 | + padding: const EdgeInsets.all(8.0), |
| 50 | + child: Column( |
| 51 | + mainAxisAlignment: MainAxisAlignment.spaceEvenly, |
| 52 | + children: [ |
| 53 | + Row( |
| 54 | + mainAxisAlignment: MainAxisAlignment.spaceAround, |
| 55 | + children: [ |
| 56 | + CircleAvatar( |
| 57 | + radius: 35, |
| 58 | + backgroundImage: NetworkImage(fav[i]['imgUrl']), |
| 59 | + backgroundColor: Colors.black.withOpacity(0.04), |
| 60 | + ), |
| 61 | + Expanded( |
| 62 | + child: Container( |
| 63 | + margin: const EdgeInsets.only(left: 10), |
| 64 | + child: Text( |
| 65 | + fav[i]['title'], |
| 66 | + style: const TextStyle( |
| 67 | + fontWeight: FontWeight.w500, |
| 68 | + fontSize: 16, |
| 69 | + ), |
| 70 | + overflow: TextOverflow.ellipsis, |
| 71 | + ), |
| 72 | + ), |
62 | 73 | ),
|
63 |
| - overflow: TextOverflow.ellipsis, |
64 |
| - ), |
| 74 | + ], |
65 | 75 | ),
|
66 |
| - ), |
67 |
| - ], |
| 76 | + ], |
| 77 | + ), |
68 | 78 | ),
|
69 |
| - ], |
70 |
| - ), |
| 79 | + ); |
| 80 | + }, |
| 81 | + separatorBuilder: (context, i) { |
| 82 | + return const Divider( |
| 83 | + height: 1, |
| 84 | + ); |
| 85 | + }, |
71 | 86 | ),
|
72 |
| - ); |
73 |
| - }, |
74 |
| - separatorBuilder: (context, i) { |
75 |
| - return const Divider( |
76 |
| - height: 1, |
77 |
| - ); |
78 |
| - }, |
79 |
| - ), |
80 | 87 | );
|
81 | 88 | }
|
82 | 89 | }
|
0 commit comments