@@ -11,12 +11,26 @@ import 'package:help_me_design/appwrite_service/storage_service.dart';
1111import 'package:help_me_design/providers/inspiration_tab_provider/inspiration_tab_provider.dart' ;
1212import 'package:help_me_design/theme/my_design_system.dart' ;
1313import 'package:help_me_design/theme/my_theme.dart' ;
14+ import 'package:help_me_design/utility/utility_helper.dart' ;
1415import 'package:help_me_design/views/widgets/button_tap_effect.dart' ;
1516import 'package:provider/provider.dart' ;
1617
17- class InspirationsListView extends StatelessWidget {
18+ class InspirationsListView extends StatefulWidget {
1819 const InspirationsListView ({Key ? key}) : super (key: key);
1920
21+ @override
22+ State <InspirationsListView > createState () => _InspirationsListViewState ();
23+ }
24+
25+ class _InspirationsListViewState extends State <InspirationsListView > {
26+ @override
27+ void initState () {
28+ var inspirationTabProvider = Provider .of <InspirationTabProvider >(context, listen: false );
29+ var authService = Provider .of <AuthService >(context, listen: false );
30+ inspirationTabProvider.getCurrentUsersInspirationsData (authService.currentUser.$id);
31+ super .initState ();
32+ }
33+
2034 @override
2135 Widget build (BuildContext context) {
2236 var authService = Provider .of <AuthService >(context);
@@ -58,6 +72,7 @@ class InspirationsListView extends StatelessWidget {
5872 ),
5973 for (var i = 0 ; i < inspirationTabProvider.listOfCurrentUserInspirations.length; i++ )
6074 InspirationCard (
75+ onDelete: () {},
6176 onTap: () {},
6277 imageUrl:
6378 "https://cloud.appwrite.io/v1/storage/buckets/${AppWriteConst .usersInspirationFilesBucketId }/files/${inspirationTabProvider .listOfCurrentUserInspirations [i ].data ['fileId' ]}/view?project=${AppWriteConst .APPWRITE_PROJECT_ID }" ,
@@ -69,21 +84,59 @@ class InspirationsListView extends StatelessWidget {
6984}
7085// https://cloud.appwrite.io/v1/storage/buckets/648767889784e9d8ae81/files/648774e4cbb5d98a135d/preview?project=64803e0044c9826d779b&width=500&height=600
7186
72- class InspirationCard extends StatelessWidget {
87+ class InspirationCard extends StatefulWidget {
7388 const InspirationCard ({
7489 super .key,
7590 required this .onTap,
7691 required this .imageUrl,
92+ required this .onDelete,
7793 });
7894
7995 final VoidCallback onTap;
96+ final VoidCallback onDelete;
8097 final String imageUrl;
8198
99+ @override
100+ State <InspirationCard > createState () => _InspirationCardState ();
101+ }
102+
103+ class _InspirationCardState extends State <InspirationCard > {
104+ bool onHover = false ;
105+
82106 @override
83107 Widget build (BuildContext context) {
84108 var themeData = Theme .of (context);
109+ var size = MediaQuery .of (context).size;
85110 return ButtonTapEffect (
86- onTap: onTap,
111+ onHover: (value) {
112+ onHover = value;
113+ setState (() {});
114+ },
115+ onTap: () {
116+ widget.onTap ();
117+ UtilityHelper .showAlertMyDialog (
118+ context: context,
119+ bodyWidget: Container (
120+ child: Stack (
121+ children: [
122+ Container (
123+ constraints: BoxConstraints (maxHeight: size.height / 1.24 , maxWidth: size.width / 1.24 ),
124+ child: Image .network (widget.imageUrl, fit: BoxFit .contain),
125+ ),
126+ Positioned (
127+ right: 20 ,
128+ top: 20 ,
129+ child: ButtonTapEffect (
130+ onTap: () {
131+ Navigator .pop (context);
132+ },
133+ child: Icon (Icons .clear_rounded, size: 44 , color: themeData.colorScheme.secondary)),
134+ ),
135+ ],
136+ ),
137+ ),
138+ );
139+ },
87140 child: Container (
88141 height: 350 ,
89142 width: 300 ,
@@ -99,11 +152,21 @@ class InspirationCard extends StatelessWidget {
99152 child: ClipRRect (
100153 borderRadius: const BorderRadius .all (Radius .circular (4 )),
101154 child: Image .network (
102- imageUrl,
155+ widget. imageUrl,
103156 fit: BoxFit .cover,
104157 ),
105158 ),
106- )
159+ ),
160+ onHover
161+ ? Positioned (
162+ right: MySpaceSystem .spaceX2,
163+ top: MySpaceSystem .spaceX2,
164+ child: ButtonTapEffect (
165+ onTap: () {},
166+ child: Icon (Icons .delete_forever_rounded, size: 34 , color: themeData.colorScheme.primary),
167+ ),
168+ )
169+ : SizedBox (),
107170 ],
108171 ),
109172 ),
0 commit comments