Skip to content

Commit

Permalink
text colour change
Browse files Browse the repository at this point in the history
  • Loading branch information
KingRain committed Sep 1, 2024
1 parent e34bd0d commit 494a6b1
Show file tree
Hide file tree
Showing 5 changed files with 225 additions and 200 deletions.
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Future<void> 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) {
Expand Down
139 changes: 73 additions & 66 deletions lib/pages/firstFloor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ class _FloorOnePageState extends State<FloorOnePage> {
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,
Expand All @@ -204,72 +204,79 @@ class _FloorOnePageState extends State<FloorOnePage> {
),
const SizedBox(height: 20),
Expanded(
child: FutureBuilder<List<Map<String, dynamic>>>(
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<DataColumn>((column) {
return DataColumn(
label: Text(
column.replaceAll('_', ' ').toUpperCase(),
style: const TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontFamily: 'JetBrains Mono',
),
),
);
}).toList(),
rows: data.map<DataRow>((row) {
return DataRow(
cells: columns.map<DataCell>((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<List<Map<String, dynamic>>>(
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<DataColumn>((column) {
return DataColumn(
label: Text(
column.replaceAll('_', ' ').toUpperCase(),
style: const TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontFamily: 'JetBrains Mono',
),
),
);
}).toList(),
rows: data.map<DataRow>((row) {
return DataRow(
cells: columns.map<DataCell>((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(),
),
);
}
},
),
),
),
],
Expand Down
127 changes: 67 additions & 60 deletions lib/pages/groundFloor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class _FloorZeroPageState extends State<FloorZeroPage> {
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,
Expand All @@ -181,72 +181,79 @@ class _FloorZeroPageState extends State<FloorZeroPage> {
),
const SizedBox(height: 20),
Expanded(
child: FutureBuilder<List<Map<String, dynamic>>>(
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<List<Map<String, dynamic>>>(
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<DataColumn>((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<DataColumn>((column) {
return DataColumn(
label: Text(
column.replaceAll('_', ' ').toUpperCase(),
style: const TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontFamily: 'JetBrains Mono',
),
),
),
);
}).toList(),
rows: data.map<DataRow>((row) {
return DataRow(
cells: columns.map<DataCell>((column) {
String displayText = row[column].toString();
TextStyle textStyle = const TextStyle(
color: Colors.white,
fontFamily: 'JetBrains Mono',
);
);
}).toList(),
rows: data.map<DataRow>((row) {
return DataRow(
cells: columns.map<DataCell>((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(),
),
);
}
},
),
),
),
],
Expand Down
18 changes: 11 additions & 7 deletions lib/pages/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Loading

0 comments on commit 494a6b1

Please sign in to comment.