From 494a6b1d833b179b0758f7316a3298fc6ef031fa Mon Sep 17 00:00:00 2001 From: Sam Joe Chalissery Date: Sun, 1 Sep 2024 09:37:00 +0530 Subject: [PATCH] text colour change --- lib/main.dart | 2 +- lib/pages/firstFloor.dart | 139 +++++++++++++++++++------------------ lib/pages/groundFloor.dart | 127 +++++++++++++++++---------------- lib/pages/home.dart | 18 +++-- lib/pages/secondFloor.dart | 139 +++++++++++++++++++------------------ 5 files changed, 225 insertions(+), 200 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 34f536a..4112268 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -9,7 +9,7 @@ Future main() async { // Initialize Supabase try { await Supabase.initialize( - url: 'https://xyz.supabase.co', //Replace with your Supabase URL + url: 'https://smth.supabase.co', //Replace with your Supabase URL anonKey: 'xyz', // Replace with your Supabase anonymous key ); } catch (e) { diff --git a/lib/pages/firstFloor.dart b/lib/pages/firstFloor.dart index 971b20e..21248d0 100644 --- a/lib/pages/firstFloor.dart +++ b/lib/pages/firstFloor.dart @@ -195,7 +195,7 @@ class _FloorOnePageState extends State { const Text( 'Refresh the page for updating the list', style: TextStyle( - color: Colors.white, + color: Color.fromARGB(255, 109, 109, 109), fontSize: 14, fontWeight: FontWeight.normal, fontStyle: FontStyle.italic, @@ -204,72 +204,79 @@ class _FloorOnePageState extends State { ), const SizedBox(height: 20), Expanded( - child: FutureBuilder>>( - future: futureData, - builder: (context, snapshot) { - if (snapshot.connectionState == ConnectionState.waiting) { - return const Center(child: CircularProgressIndicator()); - } else if (snapshot.hasError) { - return Center(child: Text('Error: ${snapshot.error}')); - } else { - var data = snapshot.data!; - if (data.isEmpty) { - return const Center(child: Text('No data found')); - } - - var columns = ['Name', 'Slot', 'Status']; - - return SingleChildScrollView( - child: DataTable( - columns: columns.map((column) { - return DataColumn( - label: Text( - column.replaceAll('_', ' ').toUpperCase(), - style: const TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontFamily: 'JetBrains Mono', - ), - ), - ); - }).toList(), - rows: data.map((row) { - return DataRow( - cells: columns.map((column) { - String displayText = row[column].toString(); - TextStyle textStyle = const TextStyle( - color: Colors.white, - fontFamily: 'JetBrains Mono', - ); - - if (column == 'Status' && - row['Status'] == 'Active') { - textStyle = - textStyle.copyWith(color: Colors.green); - } - - if (column == 'Status' && - row['Status'] == 'Finished') { - textStyle = textStyle.copyWith( - color: - const Color.fromARGB(255, 66, 66, 66)); - } - - if (column == 'Status' && - row['Status'] == 'Pending') { - textStyle = - textStyle.copyWith(color: Colors.red); - } - - return DataCell( - Text(displayText, style: textStyle)); - }).toList(), - ); - }).toList(), - ), - ); - } + child: RefreshIndicator( + onRefresh: () async { + setState(() { + futureData = updateStatusAndFetchData(); + }); }, + child: FutureBuilder>>( + future: futureData, + builder: (context, snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) { + return const Center(child: CircularProgressIndicator()); + } else if (snapshot.hasError) { + return Center(child: Text('Error: ${snapshot.error}')); + } else { + var data = snapshot.data!; + if (data.isEmpty) { + return const Center(child: Text('No data found')); + } + + var columns = ['Name', 'Slot', 'Status']; + + return SingleChildScrollView( + child: DataTable( + columns: columns.map((column) { + return DataColumn( + label: Text( + column.replaceAll('_', ' ').toUpperCase(), + style: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontFamily: 'JetBrains Mono', + ), + ), + ); + }).toList(), + rows: data.map((row) { + return DataRow( + cells: columns.map((column) { + String displayText = row[column].toString(); + TextStyle textStyle = const TextStyle( + color: Colors.white, + fontFamily: 'JetBrains Mono', + ); + + if (column == 'Status' && + row['Status'] == 'Active') { + textStyle = + textStyle.copyWith(color: Colors.green); + } + + if (column == 'Status' && + row['Status'] == 'Finished') { + textStyle = textStyle.copyWith( + color: const Color.fromARGB( + 255, 66, 66, 66)); + } + + if (column == 'Status' && + row['Status'] == 'Pending') { + textStyle = + textStyle.copyWith(color: Colors.red); + } + + return DataCell( + Text(displayText, style: textStyle)); + }).toList(), + ); + }).toList(), + ), + ); + } + }, + ), ), ), ], diff --git a/lib/pages/groundFloor.dart b/lib/pages/groundFloor.dart index c53fd7c..8a1fa3c 100644 --- a/lib/pages/groundFloor.dart +++ b/lib/pages/groundFloor.dart @@ -172,7 +172,7 @@ class _FloorZeroPageState extends State { const Text( 'Refresh the page for updating the list', style: TextStyle( - color: Colors.white, + color: Color.fromARGB(255, 109, 109, 109), fontSize: 14, fontWeight: FontWeight.normal, fontStyle: FontStyle.italic, @@ -181,72 +181,79 @@ class _FloorZeroPageState extends State { ), const SizedBox(height: 20), Expanded( - child: FutureBuilder>>( - future: futureData, - builder: (context, snapshot) { - if (snapshot.connectionState == ConnectionState.waiting) { - return const Center(child: CircularProgressIndicator()); - } else if (snapshot.hasError) { - return Center(child: Text('Error: ${snapshot.error}')); - } else { - var data = snapshot.data!; - if (data.isEmpty) { - return const Center(child: Text('No data found')); - } + child: RefreshIndicator( + onRefresh: () async { + setState(() { + futureData = updateStatusAndFetchData(); + }); + }, + child: FutureBuilder>>( + future: futureData, + builder: (context, snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) { + return const Center(child: CircularProgressIndicator()); + } else if (snapshot.hasError) { + return Center(child: Text('Error: ${snapshot.error}')); + } else { + var data = snapshot.data!; + if (data.isEmpty) { + return const Center(child: Text('No data found')); + } - var columns = ['Name', 'Slot', 'Status']; + var columns = ['Name', 'Slot', 'Status']; - return SingleChildScrollView( - child: DataTable( - columns: columns.map((column) { - return DataColumn( - label: Text( - column.replaceAll('_', ' ').toUpperCase(), - style: const TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontFamily: 'JetBrains Mono', + return SingleChildScrollView( + child: DataTable( + columns: columns.map((column) { + return DataColumn( + label: Text( + column.replaceAll('_', ' ').toUpperCase(), + style: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontFamily: 'JetBrains Mono', + ), ), - ), - ); - }).toList(), - rows: data.map((row) { - return DataRow( - cells: columns.map((column) { - String displayText = row[column].toString(); - TextStyle textStyle = const TextStyle( - color: Colors.white, - fontFamily: 'JetBrains Mono', - ); + ); + }).toList(), + rows: data.map((row) { + return DataRow( + cells: columns.map((column) { + String displayText = row[column].toString(); + TextStyle textStyle = const TextStyle( + color: Colors.white, + fontFamily: 'JetBrains Mono', + ); - if (column == 'Status' && - row['Status'] == 'Active') { - textStyle = - textStyle.copyWith(color: Colors.green); - } + if (column == 'Status' && + row['Status'] == 'Active') { + textStyle = + textStyle.copyWith(color: Colors.green); + } - if (column == 'Status' && - row['Status'] == 'Finished') { - textStyle = textStyle.copyWith( - color: - const Color.fromARGB(255, 66, 66, 66)); - } + if (column == 'Status' && + row['Status'] == 'Finished') { + textStyle = textStyle.copyWith( + color: const Color.fromARGB( + 255, 66, 66, 66)); + } - if (column == 'Status' && - row['Status'] == 'Pending') { - textStyle = - textStyle.copyWith(color: Colors.red); - } + if (column == 'Status' && + row['Status'] == 'Pending') { + textStyle = + textStyle.copyWith(color: Colors.red); + } - return DataCell( - Text(displayText, style: textStyle)); - }).toList(), - ); - }).toList(), - ), - ); - } - }, + return DataCell( + Text(displayText, style: textStyle)); + }).toList(), + ); + }).toList(), + ), + ); + } + }, + ), ), ), ], diff --git a/lib/pages/home.dart b/lib/pages/home.dart index 48ba105..e790bac 100644 --- a/lib/pages/home.dart +++ b/lib/pages/home.dart @@ -25,10 +25,14 @@ class HomePage extends StatelessWidget { 'Github: github.com/KingRain\n' 'Website: samjoe.tech\n' 'Support ☕: buymeacoffee.com/samjoe.png\n' - '' + '\n' 'UI/UX by Basil\n' 'Instagram: @basi__gar\n' - 'Github: github.com/Basil-World\n', + 'Github: github.com/Basil-World\n' + '\n' + 'Web Dev: Lestlin Robins\n' + 'Instagram: @lestlin_robins\n' + 'Github: github.com/LestlinRobins\n', style: TextStyle( fontFamily: 'JetBrains Mono', color: Color.fromARGB(255, 29, 29, 29), @@ -122,7 +126,7 @@ class HomePage extends StatelessWidget { Text( 'Kalapurackal Edition', style: TextStyle( - color: Color.fromARGB(255, 255, 200, 0), + color: Color.fromARGB(255, 109, 109, 109), fontSize: 16, fontFamily: 'JetBrains Mono', fontStyle: FontStyle.italic, @@ -200,18 +204,18 @@ class HomePage extends StatelessWidget { child: Column( children: [ Text( - 'Developed by Sam Joe', + 'Version 1.0.1', style: TextStyle( - color: Color.fromARGB(255, 255, 255, 255), + color: Color.fromARGB(255, 109, 109, 109), fontSize: 14, fontFamily: 'JetBrains Mono', fontStyle: FontStyle.italic, ), ), Text( - 'UI/UX by Basil', + '© 2024 Washio. All rights reserved.', style: TextStyle( - color: Color.fromARGB(255, 255, 255, 255), + color: Color.fromARGB(255, 109, 109, 109), fontSize: 14, fontFamily: 'JetBrains Mono', fontStyle: FontStyle.italic, diff --git a/lib/pages/secondFloor.dart b/lib/pages/secondFloor.dart index 0867230..e27799c 100644 --- a/lib/pages/secondFloor.dart +++ b/lib/pages/secondFloor.dart @@ -195,7 +195,7 @@ class _FloorTwoPageState extends State { const Text( 'Refresh the page for updating the list', style: TextStyle( - color: Colors.white, + color: Color.fromARGB(255, 109, 109, 109), fontSize: 14, fontWeight: FontWeight.normal, fontStyle: FontStyle.italic, @@ -204,72 +204,79 @@ class _FloorTwoPageState extends State { ), const SizedBox(height: 20), Expanded( - child: FutureBuilder>>( - future: futureData, - builder: (context, snapshot) { - if (snapshot.connectionState == ConnectionState.waiting) { - return const Center(child: CircularProgressIndicator()); - } else if (snapshot.hasError) { - return Center(child: Text('Error: ${snapshot.error}')); - } else { - var data = snapshot.data!; - if (data.isEmpty) { - return const Center(child: Text('No data found')); - } - - var columns = ['Name', 'Slot', 'Status']; - - return SingleChildScrollView( - child: DataTable( - columns: columns.map((column) { - return DataColumn( - label: Text( - column.replaceAll('_', ' ').toUpperCase(), - style: const TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontFamily: 'JetBrains Mono', - ), - ), - ); - }).toList(), - rows: data.map((row) { - return DataRow( - cells: columns.map((column) { - String displayText = row[column].toString(); - TextStyle textStyle = const TextStyle( - color: Colors.white, - fontFamily: 'JetBrains Mono', - ); - - if (column == 'Status' && - row['Status'] == 'Active') { - textStyle = - textStyle.copyWith(color: Colors.green); - } - - if (column == 'Status' && - row['Status'] == 'Finished') { - textStyle = textStyle.copyWith( - color: - const Color.fromARGB(255, 66, 66, 66)); - } - - if (column == 'Status' && - row['Status'] == 'Pending') { - textStyle = - textStyle.copyWith(color: Colors.red); - } - - return DataCell( - Text(displayText, style: textStyle)); - }).toList(), - ); - }).toList(), - ), - ); - } + child: RefreshIndicator( + onRefresh: () async { + setState(() { + futureData = updateStatusAndFetchData(); + }); }, + child: FutureBuilder>>( + future: futureData, + builder: (context, snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) { + return const Center(child: CircularProgressIndicator()); + } else if (snapshot.hasError) { + return Center(child: Text('Error: ${snapshot.error}')); + } else { + var data = snapshot.data!; + if (data.isEmpty) { + return const Center(child: Text('No data found')); + } + + var columns = ['Name', 'Slot', 'Status']; + + return SingleChildScrollView( + child: DataTable( + columns: columns.map((column) { + return DataColumn( + label: Text( + column.replaceAll('_', ' ').toUpperCase(), + style: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontFamily: 'JetBrains Mono', + ), + ), + ); + }).toList(), + rows: data.map((row) { + return DataRow( + cells: columns.map((column) { + String displayText = row[column].toString(); + TextStyle textStyle = const TextStyle( + color: Colors.white, + fontFamily: 'JetBrains Mono', + ); + + if (column == 'Status' && + row['Status'] == 'Active') { + textStyle = + textStyle.copyWith(color: Colors.green); + } + + if (column == 'Status' && + row['Status'] == 'Finished') { + textStyle = textStyle.copyWith( + color: const Color.fromARGB( + 255, 66, 66, 66)); + } + + if (column == 'Status' && + row['Status'] == 'Pending') { + textStyle = + textStyle.copyWith(color: Colors.red); + } + + return DataCell( + Text(displayText, style: textStyle)); + }).toList(), + ); + }).toList(), + ), + ); + } + }, + ), ), ), ],