Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

comment experimental merge #36

Merged
merged 10 commits into from
Mar 12, 2024
Prev Previous commit
Next Next commit
Experiment Comments
  • Loading branch information
draqunov10 committed Mar 12, 2024

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
commit 984b237aa781326089ab9e8fbd510567192dbdfd
Original file line number Diff line number Diff line change
@@ -36,4 +36,19 @@ class QuizModeRepositoryImpl implements QuizModeRepositoryContract {
}
return questions;
}

@override
Future<List> collectComments({required String questionId}) async {
final dbService = services<FirebaseFirestore>();
List comments = [];

// await dbService
// .collection(FireStore.question2comments(questionId))
// .get()
// .then((snapshot) {
// snapshot.docs.map((e) => comments.add(e.data())).toList();
// });

return comments;
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@

import '../../../../core/models/question_model.dart';

abstract class QuizModeRepositoryContract {
const QuizModeRepositoryContract();

Future<List<Question>> collectQuestions({required SUBJ subj});
}

Future<List> collectComments({required String questionId});
}
Original file line number Diff line number Diff line change
@@ -52,16 +52,17 @@ class _SolutionCardDisplayState extends State<SolutionCardDisplay> {
),
),
TextTitle(title: "Solution"),
TextMarkdown(
text: widget.solution == ""
? "No solution yet provided"
: widget.solution,
styleSheet: MarkdownStyleSheet(
textAlign: WrapAlignment.center,
p: const TextStyle(fontSize: 18),
Expanded(
child: TextMarkdown(
text: widget.solution == ""
? "No solution yet provided"
: widget.solution,
styleSheet: MarkdownStyleSheet(
textAlign: WrapAlignment.center,
p: const TextStyle(fontSize: 18),
),
),
),
Expanded(child: Container()),
TextTitle(title: "Comments"),
TextMarkdown(
// ! To Remove
@@ -71,7 +72,6 @@ class _SolutionCardDisplayState extends State<SolutionCardDisplay> {
p: const TextStyle(fontSize: 18),
),
),
// SolutionCommentDisplay(),
ElevatedButton(
onPressed: () {
showModalBottomSheet(
@@ -82,7 +82,6 @@ class _SolutionCardDisplayState extends State<SolutionCardDisplay> {
},
child: Text("Experimental"),
),

Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// ignore_for_file: prefer_const_constructors

import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';

// ! TESTING
class SolutionCommentModal extends StatefulWidget {
@@ -9,6 +12,7 @@ class SolutionCommentModal extends StatefulWidget {
}

class _SolutionCommentModalState extends State<SolutionCommentModal> {
final TextEditingController _controller = TextEditingController();
final comments = [
{
'initials': 'WDT',
@@ -21,8 +25,8 @@ class _SolutionCommentModalState extends State<SolutionCommentModal> {
'comment': 'I think this solution is wrong',
},
{
'initials': 'MVL',
'user': 'Mark Victory Liner',
'initials': 'MV',
'user': 'Mark Viernes Sabado Linggo',
'comment': 'I think this solution is wrong',
},
];
@@ -33,32 +37,40 @@ class _SolutionCommentModalState extends State<SolutionCommentModal> {
height: MediaQuery.of(context).size.height,
child: Column(
children: <Widget>[
ListView.builder(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemCount: comments.length,
itemBuilder: (context, index) {
return ListTile(
leading: CircleAvatar(
child: Text(comments[index]['initials'] ?? 'AB'),
backgroundColor: Colors.blue,
),
title: Text(comments[index]['user'] ?? 'Anonymous'),
subtitle: Text(comments[index]['comment'] ?? 'No comment'),
);
},
Expanded(
child: ListView.builder(
itemCount: comments.length,
itemBuilder: (context, index) {
return ListTile(
leading: CircleAvatar(
child: Text(comments[index]['initials'] ?? 'AB'),
backgroundColor: Colors.blue,
),
title: Text(comments[index]['user'] ?? 'Anonymous'),
subtitle: Text(comments[index]['comment'] ?? 'No comment'),
);
},
),
),
Container(
width: MediaQuery.of(context).size.width * 0.9,
child: TextField(
controller: TextEditingController(),
decoration: InputDecoration(
labelText: 'Write a comment...',
suffixIcon: IconButton(
icon: Icon(Icons.send_rounded),
onPressed: () {
// Handle sending comment
},
Align(
alignment: Alignment.bottomCenter,
child: Container(
margin: EdgeInsets.only(bottom: 10.0),
width: MediaQuery.of(context).size.width * 0.9,
child: TextField(
controller: _controller,
style: TextStyle(fontSize: 14.0),
decoration: InputDecoration(
labelText: 'Write a comment...',
labelStyle: TextStyle(fontSize: 14.0),
suffixIcon: IconButton(
icon: Icon(Icons.send_rounded),
onPressed: () {
// Handle sending comment
print(_controller.text);
FocusScope.of(context).unfocus();
},
),
),
),
),