From fe107b49b69433e279e044e13482f35e087a4bb2 Mon Sep 17 00:00:00 2001 From: iqfareez Date: Mon, 19 Jul 2021 20:33:10 +0800 Subject: [PATCH] :fire: Removed deprecated member :art: Added more style to the datatable --- lib/utils/cupertinoSwitchListTile.dart | 2 -- lib/views/GetPrayerTime.dart | 3 --- lib/views/full_prayer_table.dart | 25 ++++++++++++++++++++----- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/lib/utils/cupertinoSwitchListTile.dart b/lib/utils/cupertinoSwitchListTile.dart index 9513665..2256372 100644 --- a/lib/utils/cupertinoSwitchListTile.dart +++ b/lib/utils/cupertinoSwitchListTile.dart @@ -94,8 +94,6 @@ class CupertinoSwitchListTile extends StatelessWidget { @override Widget build(BuildContext context) { - var color = activeColor ?? Theme.of(context).accentColor; - print("Active color: ${color.red} ${color.green} ${color.blue}"); final Widget control = new CupertinoSwitch( value: value, onChanged: onChanged, diff --git a/lib/views/GetPrayerTime.dart b/lib/views/GetPrayerTime.dart index 2509dec..3980e45 100644 --- a/lib/views/GetPrayerTime.dart +++ b/lib/views/GetPrayerTime.dart @@ -277,9 +277,6 @@ class Error extends StatelessWidget { ), SizedBox(height: 8), ElevatedButton( - style: ElevatedButton.styleFrom( - primary: Theme.of(context).buttonColor, - ), child: Text('Retry', style: TextStyle(color: Colors.black)), onPressed: onRetryPressed, ) diff --git a/lib/views/full_prayer_table.dart b/lib/views/full_prayer_table.dart index c18f91f..3dc64dd 100644 --- a/lib/views/full_prayer_table.dart +++ b/lib/views/full_prayer_table.dart @@ -56,7 +56,7 @@ class PrayerDataTable extends StatelessWidget { @required this.model, }) : super(key: key); - final int today = DateTime.now().day; + final int todayIndex = DateTime.now().day - 1; final Mpti906PrayerModel model; @override @@ -79,13 +79,28 @@ class PrayerDataTable extends StatelessWidget { // columnSpacing: MediaQuery.of(context).size.width / 10, // columnSpacing: 30, rows: List.generate(model.data.times.length, (index) { - return DataRow(selected: index == today - 1, cells: [ - DataCell(Text('${index + 1} / ${model.data.month}')), + return DataRow(selected: index == todayIndex, cells: [ + DataCell(Container( + padding: EdgeInsets.all(3), + decoration: BoxDecoration( + color: Theme.of(context).brightness == Brightness.light + ? Colors.teal.shade50 + : Colors.teal.shade900, + borderRadius: BorderRadius.circular(3.0)), + child: Text( + '${index + 1} / ${model.data.month}', + ), + )), ...model.data.times[index].map((day) { return DataCell(Center( child: Opacity( - opacity: (index < today - 1) ? 0.60 : 1.0, - child: Text(DateAndTime.toTimeReadable(day, true))), + opacity: (index < todayIndex) ? 0.60 : 1.0, + child: Text( + DateAndTime.toTimeReadable(day, true), + style: index == todayIndex + ? TextStyle(fontWeight: FontWeight.bold) + : null, + )), )); }).toList(), ]);