From ae217b95ea1e70f6353e363fefefb4ccf53113cc Mon Sep 17 00:00:00 2001 From: Arnav Jain Date: Wed, 23 Jul 2025 18:38:49 +0530 Subject: [PATCH 1/2] secondary fd --- lib/screens/results.dart | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/screens/results.dart b/lib/screens/results.dart index 18adc46..944378b 100644 --- a/lib/screens/results.dart +++ b/lib/screens/results.dart @@ -5,8 +5,6 @@ import 'package:google_fonts/google_fonts.dart'; import 'package:notesportal/model/model.dart'; import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart'; -// ... previous imports and code remain the same - class ResultsScreen extends StatelessWidget { final Future> notes; @@ -138,7 +136,6 @@ class ResultsScreen extends StatelessWidget { padding: EdgeInsets.zero, onPressed: () { print("de"); - // You might want to navigate to a full PDF viewer here Navigator.push( context, MaterialPageRoute( @@ -193,7 +190,6 @@ class ResultsScreen extends StatelessWidget { ], ), SizedBox(height: 10), - // Add PDF preview with constrained height Container( height: 200, // Fixed height for preview decoration: BoxDecoration( From d0ec2bd1ce9e90ed6eb7776c2383b1f3c37ae589 Mon Sep 17 00:00:00 2001 From: Arnav Jain Date: Thu, 24 Jul 2025 00:41:05 +0530 Subject: [PATCH 2/2] polishing --- lib/screens/home.dart | 165 ++++++++++++++++++++------------ lib/screens/results.dart | 200 +++++++++++++++++++-------------------- 2 files changed, 204 insertions(+), 161 deletions(-) diff --git a/lib/screens/home.dart b/lib/screens/home.dart index 56acb4f..db4881b 100644 --- a/lib/screens/home.dart +++ b/lib/screens/home.dart @@ -54,73 +54,118 @@ class _SubjectFormPageState extends State { ), backgroundColor: Color(0xFFF5F4F4), ), - body: SingleChildScrollView( + body: SafeArea( child: Container( + height: MediaQuery.of(context).size.height, child: Padding( - padding: const EdgeInsets.all(16.0), - child: Padding( - padding: const EdgeInsets.all(20.0), - child: Form( - key: _formKey, - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - TextFormField( - controller: _subjectController, - style: GoogleFonts.inter(color: Colors.black), - decoration: InputDecoration( - labelText: 'Subject', - labelStyle: GoogleFonts.inter(color: Colors.black), - border: OutlineInputBorder(), - prefixIcon: Icon(CupertinoIcons.book, color: Colors.black), - ), - validator: (value) => - value == null || value.isEmpty ? 'Please enter a subject' : null, - onSaved: (value) => _subject = value, - ), - SizedBox(height: 16), - - ElevatedButton( - onPressed: () { - if (_formKey.currentState?.validate() ?? false) { - _formKey.currentState?.save(); - _subject = _subjectController.text; - - // Future> results = SupaBaseAPI().traverseFileLinks(_subjectController.text.toString()); - Navigator.of(context).push(MaterialPageRoute(builder: (context) => ResultsScreen(notes: SupaBaseAPI().traverseFileLinks(_subjectController.text.toString())))); - } - }, - style: ElevatedButton.styleFrom( - iconAlignment: IconAlignment.end, - backgroundColor: Color(0xFF573DA0), - padding: EdgeInsets.symmetric(horizontal: 24, vertical: 16), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(100), + padding: EdgeInsets.only( + left: 34.0, + right: 34.0, + top: 30.0, + bottom: 28, + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Form( + key: _formKey, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + TextFormField( + controller: _subjectController, + style: GoogleFonts.inter( + color: Colors.black, + fontSize: 17, ), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - 'Submit', - style: GoogleFonts.inter( - fontSize: 17, - color: Colors.white, - fontWeight: FontWeight.w600, - letterSpacing: -0.4, + decoration: InputDecoration( + labelText: 'Subject', + labelStyle: GoogleFonts.inter( + color: Colors.black54, + fontSize: 17, + ), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(10), + borderSide: BorderSide.none, // Removes the border + ), + filled: true, + fillColor: Color(0xFFE7E7E7), // Subtle grey background + contentPadding: EdgeInsets.symmetric( + vertical: 16, + horizontal: 16, + ), + prefixIcon: Padding( + padding: EdgeInsets.only(left: 10), // Indents the icon + child: Icon( + CupertinoIcons.book, + color: Colors.black54, + size: 20, // Slightly smaller icon for iOS feel ), ), - Icon( - CupertinoIcons.chevron_right_circle_fill, - size: 20, - color: Colors.white, + prefixIconConstraints: BoxConstraints( + minWidth: 50, + minHeight: 40, + ), + floatingLabelBehavior: FloatingLabelBehavior.never, // Makes it more iOS-like + hintStyle: GoogleFonts.inter( + color: Colors.black54, + fontSize: 17, ), - ], + ), + validator: (value) => + value == null || value.isEmpty ? 'Please enter a subject' : null, + onSaved: (value) => _subject = value, ), - ), - ], + SizedBox(height: 16), + ElevatedButton( + onPressed: () { + if (_formKey.currentState?.validate() ?? false) { + _formKey.currentState?.save(); + _subject = _subjectController.text; + Navigator.of(context).push( + MaterialPageRoute( + builder: (context) => ResultsScreen( + notes: SupaBaseAPI().traverseFileLinks( + _subjectController.text.toString() + ) + ) + ) + ); + } + }, + style: ElevatedButton.styleFrom( + shadowColor: Colors.transparent, + iconAlignment: IconAlignment.end, + backgroundColor: Color(0xFF53399A), + padding: EdgeInsets.symmetric(horizontal: 24, vertical: 16), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(100), + ), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + 'Submit', + style: GoogleFonts.inter( + fontSize: 17, + color: Colors.white, + fontWeight: FontWeight.w600, + letterSpacing: -0.4, + ), + ), + Icon( + CupertinoIcons.chevron_right_circle_fill, + size: 20, + color: Colors.white, + ), + ], + ), + ), + ], + ), ), - ), + ], ), ), ), @@ -128,4 +173,4 @@ class _SubjectFormPageState extends State { ), ); } -} +} \ No newline at end of file diff --git a/lib/screens/results.dart b/lib/screens/results.dart index 944378b..1efd6cd 100644 --- a/lib/screens/results.dart +++ b/lib/screens/results.dart @@ -53,7 +53,7 @@ class ResultsScreen extends StatelessWidget { Text( 'Loading notes...', style: TextStyle( - color: Colors.white, + color: Colors.black, fontSize: 16, ), ), @@ -83,7 +83,6 @@ class ResultsScreen extends StatelessWidget { SizedBox(height: 8), TextButton( onPressed: () { - // Refresh the page Navigator.pushReplacement( context, MaterialPageRoute( @@ -132,105 +131,104 @@ class ResultsScreen extends StatelessWidget { itemCount: noteList.length, itemBuilder: (context, index) { return GridTile( - child: CupertinoButton( - padding: EdgeInsets.zero, - onPressed: () { - print("de"); - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => Scaffold( - appBar: AppBar( - title: Text(noteList[index].fileName), - backgroundColor: Color(0xFFF5F4F4), - iconTheme: IconThemeData(color: Colors.black), - ), - body: SfPdfViewer.network( - noteList[index].pdfLink, - canShowPaginationDialog: false, - ), - ), - ), - ); - }, - child: Container( - margin: EdgeInsets.only(left: 18, right: 18, bottom: 22), - padding: EdgeInsets.all(15), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Color(0xFFEEEEEE), - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Text( - "${index + 1}. ${noteList[index].fileName}", - style: TextStyle( - color: Colors.black, - fontWeight: FontWeight.w600, - fontSize: 14 - ), - overflow: TextOverflow.ellipsis, - maxLines: 1, - ), - ), - Row( - children: [ - Text("@", style: TextStyle(color: Colors.grey, fontSize: 15),), - Text( - noteList[index].author, - style: TextStyle(color: Color(0xFFB4A6D5), fontSize: 15, fontWeight: FontWeight.w500) - ), - ], - ) - ], - ), - SizedBox(height: 10), - Container( - height: 200, // Fixed height for preview - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(8), - color: Colors.grey.withOpacity(0.1), - ), - child: ClipRRect( - borderRadius: BorderRadius.circular(8), - child: SfPdfViewer.network( - noteList[index].pdfLink, - canShowPaginationDialog: false, - canShowScrollHead: false, - enableDoubleTapZooming: false, - enableTextSelection: false, - pageSpacing: 0, - initialZoomLevel: 1.0, - ), - ), - ), - SizedBox(height: 10), - Row( - children: [ - Expanded( - child: Text( - capitalizeFirstLetter(noteList[index].desc), - style: TextStyle(color: Colors.black45, fontSize: 15), - overflow: TextOverflow.ellipsis, - maxLines: 1, - ), - ), - Icon( - CupertinoIcons.chevron_right_circle_fill, - color: Color(0xFFB4A6D5), - size: 18 - ) - ], - ), - ], - ), - ), - ), + child: CupertinoButton( + padding: EdgeInsets.zero, + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => Scaffold( + appBar: AppBar( + title: Text(noteList[index].fileName), + backgroundColor: Color(0xFFF5F4F4), + iconTheme: IconThemeData(color: Colors.black), + ), + body: SfPdfViewer.network( + noteList[index].pdfLink, + canShowPaginationDialog: false, + ), + ), + ), + ); + }, + child: Container( + margin: EdgeInsets.only(left: 18, right: 18, bottom: 22), + padding: EdgeInsets.all(15), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + color: Color(0xFFEEEEEE), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Text( + "${index + 1}. ${noteList[index].fileName}", + style: TextStyle( + color: Colors.black, + fontWeight: FontWeight.w600, + fontSize: 14 + ), + overflow: TextOverflow.ellipsis, + maxLines: 1, + ), + ), + Row( + children: [ + Text("@", style: TextStyle(color: Colors.grey, fontSize: 15),), + Text( + noteList[index].author, + style: TextStyle(color: Color(0xFFB4A6D5), fontSize: 15, fontWeight: FontWeight.w500) + ), + ], + ) + ], + ), + SizedBox(height: 10), + Container( + height: 200, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8), + color: Colors.grey.withOpacity(0.1), + ), + child: ClipRRect( + borderRadius: BorderRadius.circular(8), + child: SfPdfViewer.network( + noteList[index].pdfLink, + canShowPaginationDialog: false, + canShowScrollHead: false, + enableDoubleTapZooming: false, + enableTextSelection: false, + pageSpacing: 0, + initialZoomLevel: 1.0, + ), + ), + ), + SizedBox(height: 10), + Row( + children: [ + Expanded( + child: Text( + capitalizeFirstLetter(noteList[index].desc), + style: TextStyle(color: Colors.black45, fontSize: 15), + overflow: TextOverflow.ellipsis, + maxLines: 1, + ), + ), + Icon( + CupertinoIcons.chevron_right_circle_fill, + color: Color(0xFFB4A6D5), + size: 18 + ) + ], + ), + ], + ), + ), + ), ); }, );