Skip to content

Commit

Permalink
Merge pull request #36 from ntatko/dark-mode
Browse files Browse the repository at this point in the history
Dark mode
  • Loading branch information
ntatko authored Sep 26, 2024
2 parents f423515 + 5565e11 commit e0780c3
Show file tree
Hide file tree
Showing 16 changed files with 249 additions and 128 deletions.
19 changes: 14 additions & 5 deletions lib/common/application_list_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,29 @@ import 'package:homiletics/storage/homiletic_storage.dart';
class ApplicationListItem extends StatelessWidget {
final Application application;

const ApplicationListItem({Key? key, required this.application}) : super(key: key);
const ApplicationListItem({Key? key, required this.application})
: super(key: key);

@override
Widget build(BuildContext context) {
return GestureDetector(
onTapUp: (_) async {
Homiletic homiletic = await getHomileticById(application.homileticsId);
Navigator.push(context, MaterialPageRoute(builder: (context) => HomileticEditor(homiletic: homiletic)));
Homiletic homiletic =
await getHomileticById(application.homileticsId);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => HomileticEditor(homiletic: homiletic)));
},
child: SizedBox(
width: 180,
child: Card(
color: Colors.green[300],
margin: const EdgeInsets.only(top: 10, left: 10, right: 10, bottom: 20),
color: MediaQuery.of(context).platformBrightness ==
Brightness.light
? Colors.green[300]
: Colors.green[800],
margin: const EdgeInsets.only(
top: 10, left: 10, right: 10, bottom: 20),
// decoration: BoxDecoration(
// color: Colors.green[600],
// boxShadow: [
Expand Down
7 changes: 3 additions & 4 deletions lib/common/notes_list_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ class NotesListItem extends StatelessWidget {
Widget build(BuildContext context) {
return Container(
key: Key("${note.id}"),
margin: const EdgeInsets.only(top: 5, bottom: 5),
// height: 80,
margin: const EdgeInsets.only(top: 5),
child: GestureDetector(
onTapUp: (_) {
Navigator.push(
Expand Down Expand Up @@ -43,12 +42,12 @@ class NotesListItem extends StatelessWidget {
style: const TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 22,
fontSize: 14,
),
),
)),
Padding(
padding: const EdgeInsets.only(left: 20),
padding: const EdgeInsets.only(left: 15),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
Expand Down
233 changes: 150 additions & 83 deletions lib/common/verse_container.dart

Large diffs are not rendered by default.

21 changes: 15 additions & 6 deletions lib/components/application_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,24 @@ class ApplicationList extends StatelessWidget {
return Container(
margin: const EdgeInsets.only(left: 10, right: 10, top: 20, bottom: 20),
child: Card(
color: Colors.green[100],
color: Theme.of(context).brightness == Brightness.dark
? Colors.green[900]
: Colors.green[100],
child: FutureBuilder<List<Application>>(
future: getAllApplications(),
builder: (context, snapshot) {
if (snapshot.hasError) logError("${snapshot.error}");

List<Application> filteredDataList =
snapshot.data?.where((application) => application.text != '').toList().reversed.toList() ?? [];
List<Application> filteredDataList = snapshot.data
?.where((application) => application.text != '')
.toList()
.reversed
.toList() ??
[];

return Container(
height: snapshot.hasData && filteredDataList.isNotEmpty ? 240 : 0,
height:
snapshot.hasData && filteredDataList.isNotEmpty ? 240 : 0,
width: MediaQuery.of(context).size.width,
padding: const EdgeInsets.only(top: 10),
child: snapshot.hasData
Expand All @@ -35,14 +42,16 @@ class ApplicationList extends StatelessWidget {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ApplicationPage(applications: filteredDataList)));
builder: (context) => ApplicationPage(
applications: filteredDataList)));
}),
Expanded(
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: filteredDataList.length,
itemBuilder: (context, index) {
Application? application = filteredDataList[index];
Application? application =
filteredDataList[index];
return ApplicationListItem(
application: application,
);
Expand Down
47 changes: 28 additions & 19 deletions lib/components/current_lesson.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,26 +67,35 @@ class _CurrentLessonState extends State<CurrentLesson> {
padding:
const EdgeInsets.only(left: 16, right: 16, top: 20, bottom: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
"Current Lessons",
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
DropdownButton<String>(
value: _selectedStudy,
hint: const Text("Filter by study"),
onChanged: _filterSchedules,
items: [
const DropdownMenuItem<String>(
value: null,
child: Text("All studies"),
),
..._uniqueStudies.map((study) => DropdownMenuItem<String>(
value: study,
child: Text(study),
)),
],
Expanded(
child: Wrap(
alignment: WrapAlignment.spaceBetween,
crossAxisAlignment: WrapCrossAlignment.center,
children: [
const Text(
"Current Lessons",
style:
TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
DropdownButton<String>(
value: _selectedStudy,
hint: const Text("Filter by study"),
onChanged: _filterSchedules,
items: [
const DropdownMenuItem<String>(
value: null,
child: Text("All studies"),
),
..._uniqueStudies
.map((study) => DropdownMenuItem<String>(
value: study,
child: Text(study),
)),
],
),
],
),
),
],
),
Expand Down
4 changes: 3 additions & 1 deletion lib/components/homiletics/aim_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ class AimCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Card(
color: Colors.red[100],
color: MediaQuery.of(context).platformBrightness == Brightness.light
? Colors.red[100]
: Colors.blueGrey[900],
child: Padding(
padding: const EdgeInsets.all(8),
child: Column(children: [
Expand Down
4 changes: 3 additions & 1 deletion lib/components/homiletics/application_questions_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ class ApplicationQuestionsCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Card(
color: Colors.grey[200],
color: MediaQuery.of(context).platformBrightness == Brightness.light
? Colors.grey[200]
: Colors.blueGrey[900],
child: Padding(
padding: const EdgeInsets.all(8),
child: Column(children: [
Expand Down
4 changes: 3 additions & 1 deletion lib/components/homiletics/content_summaries_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ class ContentSummariesCardState extends State<ContentSummariesCard> {
@override
Widget build(BuildContext context) {
return Card(
color: Colors.blue[100],
color: MediaQuery.of(context).platformBrightness == Brightness.light
? Colors.blue[100]
: Colors.blueGrey[900],
child: Padding(
padding: const EdgeInsets.all(8),
child: Column(
Expand Down
4 changes: 3 additions & 1 deletion lib/components/homiletics/divisions_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ class DivisionsCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Card(
color: Colors.green[100],
color: MediaQuery.of(context).platformBrightness == Brightness.light
? Colors.green[100]
: Colors.blueGrey[900],
child: Padding(
padding: const EdgeInsets.all(8),
child: Column(children: [
Expand Down
4 changes: 3 additions & 1 deletion lib/components/homiletics/fcf_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ class FcfCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Card(
color: const Color.fromARGB(255, 196, 255, 241),
color: MediaQuery.of(context).platformBrightness == Brightness.light
? const Color.fromARGB(255, 196, 255, 241)
: Colors.blueGrey[900],
child: Padding(
padding: const EdgeInsets.all(8),
child: Column(children: [
Expand Down
4 changes: 3 additions & 1 deletion lib/components/homiletics/summary_sentence_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ class SummarySentenceCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Card(
color: Colors.yellow[100],
color: MediaQuery.of(context).platformBrightness == Brightness.light
? Colors.yellow[100]
: Colors.blueGrey[900],
child: Padding(
padding: const EdgeInsets.all(8),
child: Column(children: [
Expand Down
10 changes: 7 additions & 3 deletions lib/components/past_lecture_notes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,18 @@ class PastLectureNotes extends StatelessWidget {

return snapshot.hasData && notes.isNotEmpty
? Container(
padding: const EdgeInsets.only(left: 10, right: 10, top: 20, bottom: 10),
padding: const EdgeInsets.only(
left: 10, right: 10, top: 20, bottom: 10),
child: Card(
color: Colors.orange[100],
color: Theme.of(context).brightness == Brightness.dark
? Colors.blueGrey[900]
: Colors.blueGrey[100],
child: Padding(
padding: const EdgeInsets.all(10),
child: Column(
children: [
const HomeHeader(title: "Past Notes", onExpand: null),
const HomeHeader(
title: "Past Notes", onExpand: null),
...notes.map((note) {
return NotesListItem(note: note);
})
Expand Down
4 changes: 3 additions & 1 deletion lib/components/past_lessons.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ class DisplayLessons extends StatelessWidget {
Widget build(BuildContext context) {
return homiletics.isNotEmpty
? Card(
color: Colors.blue[100],
color: Theme.of(context).brightness == Brightness.dark
? Colors.blueGrey[900]
: Colors.blueGrey[100],
child: Padding(
padding: const EdgeInsets.all(8),
child: Column(
Expand Down
4 changes: 3 additions & 1 deletion lib/components/start_activity.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ class _StartActivityState extends State<StartActivity> {
return Container(
padding: const EdgeInsets.only(top: 20, left: 8, right: 8),
child: Card(
color: Colors.blueGrey[100],
color: Theme.of(context).brightness == Brightness.dark
? Colors.blueGrey[900]
: Colors.blueGrey[100],
child: Padding(
padding: const EdgeInsets.all(20),
child: Column(
Expand Down
1 change: 1 addition & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class MyApp extends StatelessWidget {
// is not restarted.
useMaterial3: true,
primarySwatch: Colors.blue,
brightness: MediaQuery.of(context).platformBrightness,
),
home: const Home(),
);
Expand Down
7 changes: 7 additions & 0 deletions lib/pages/notes_editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,19 @@ class _NotesState extends State<NotesEditor> {
],
),
body: SlidingUpPanel(
backdropColor:
MediaQuery.of(context).platformBrightness == Brightness.dark
? Colors.white
: Colors.white,
controller: _controller,
minHeight: 75,
// panelSnapping: false,
backdropEnabled: true,
parallaxEnabled: false,
isDraggable: true,
color: MediaQuery.of(context).platformBrightness == Brightness.dark
? Colors.black
: Colors.white,
borderRadius: BorderRadius.circular(15),
onPanelClosed: () {
setState(() {
Expand Down

0 comments on commit e0780c3

Please sign in to comment.