Skip to content

Commit

Permalink
Merge pull request #105 from Eugene600/ask_Me
Browse files Browse the repository at this point in the history
Aligned Ask Me to use themes from Material 3 as well as fixing text overflow issues in the questions screen
  • Loading branch information
IamMuuo authored Oct 26, 2024
2 parents 410befa + 771a9d2 commit 3b9ddad
Show file tree
Hide file tree
Showing 5 changed files with 257 additions and 351 deletions.
37 changes: 28 additions & 9 deletions lib/tools/ask_me/pages/askme_home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class _AskMeHomeState extends State<AskMeHome> {

@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return Scaffold(
appBar: AppBar(
title: const Text("Ask Me"),
Expand Down Expand Up @@ -217,7 +218,11 @@ class _AskMeHomeState extends State<AskMeHome> {
floatingActionButton: FloatingActionButton(
onPressed: () {
_bottomSheet(context);
// final screenHeight = MediaQuery.of(context).size.height;
// debugPrint("Screen Height is $screenHeight");
},
backgroundColor: theme.colorScheme.primaryContainer,
foregroundColor: theme.colorScheme.onPrimaryContainer,
child: const Icon(Icons.add),
),
);
Expand All @@ -232,15 +237,29 @@ class _AskMeHomeState extends State<AskMeHome> {
),
isScrollControlled: true,
showDragHandle: true,
builder: (context) => FractionallySizedBox(
heightFactor: 0.7,
child: ModalContent(
id: id,
title: title,
filepath: filepath,
avgScore: avgScore,
),
),
builder: (context) {
//Get the screen height
final screenHeight = MediaQuery.of(context).size.height;

//adjusting height factor based on screen height
double heightFactor = 0.7;

if (screenHeight < 600) {
heightFactor = 0.9;
} else if (screenHeight < 800) {
heightFactor = 0.8;
}

return FractionallySizedBox(
heightFactor: heightFactor,
child: ModalContent(
id: id,
title: title,
filepath: filepath,
avgScore: avgScore,
),
);
},
);
}
}
25 changes: 6 additions & 19 deletions lib/tools/ask_me/pages/modal_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ class _ModalContentState extends State<ModalContent> {

@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
// The maximum allowed time in seconds
const int maxTimeInSeconds = 1800; // 30 minutes

Expand Down Expand Up @@ -238,20 +239,11 @@ class _ModalContentState extends State<ModalContent> {
const SizedBox(
height: 5,
),
Row(
children: [
FilledButton(
onPressed: () async {
await _pickFile();
},
style: FilledButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0),
),
),
child: const Text("Upload a File"),
),
],
OutlinedButton(
onPressed: () async {
await _pickFile();
},
child: const Text("Upload a File"),
),
if (_filePath != null)
Padding(
Expand All @@ -267,11 +259,6 @@ class _ModalContentState extends State<ModalContent> {
height: 45,
)
: FilledButton(
style: FilledButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30.0),
),
),
onPressed: () async {
int? minuteValue =
int.tryParse(minuteController.text);
Expand Down
Loading

0 comments on commit 3b9ddad

Please sign in to comment.