import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:helpers/helpers/misc_build/build_media.dart'; import '../../../global/store.dart'; class SharedNotesScreen extends ConsumerStatefulWidget { const SharedNotesScreen({super.key, required this.initialData}); final Map initialData; @override ConsumerState createState() => _SharedNotesScreenState(); } class _SharedNotesScreenState extends ConsumerState { @override Widget build(BuildContext context) { final sharedNotes = ref.watch(Store().sharedNotesProvider); return Column( children: [ const Padding( padding: EdgeInsets.all(18.0), child: Text( 'Notes:', style: TextStyle(fontSize: 20), textAlign: TextAlign.center, ), ), if (sharedNotes.isEmpty) const Text('Add notes to get started:'), if (sharedNotes.isNotEmpty) GridView.builder( gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, ), itemBuilder: (BuildContext context, int index) { final note = sharedNotes[index]; return SizedBox( width: BuildMedia(context).width * 0.4, child: Card( child: Padding( padding: const EdgeInsets.all(8.0), child: Text(note.content), ), ), ); }, ), ], ); } }