Skip to content

Commit

Permalink
Made test warnings fatal (PalisadoesFoundation#2332)
Browse files Browse the repository at this point in the history
* made test warnings fatal

* chore: fixed run_check_ignore

* resolved requested changes

* chore: dart format
  • Loading branch information
Azad99-9 committed Jan 22, 2024
1 parent 6ea6301 commit 7493de5
Show file tree
Hide file tree
Showing 8 changed files with 342 additions and 327 deletions.
220 changes: 100 additions & 120 deletions lib/views/after_auth_screens/events/explore_event_dialogue.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// ignore_for_file: talawa_api_doc
// ignore_for_file: talawa_good_doc_comments

import 'package:flutter/material.dart';
import 'package:talawa/locator.dart';
import 'package:talawa/services/size_config.dart';
Expand All @@ -22,153 +19,136 @@ class _ExploreEventDialogState extends State<ExploreEventDialog> {
@override
Widget build(BuildContext context) {
return AlertDialog(
insetPadding: EdgeInsets.all(
SizeConfig.screenWidth! * 0.027,
insetPadding: EdgeInsets.symmetric(
horizontal: SizeConfig.screenWidth! * 0.15,
),
actions: [
Padding(
padding: const EdgeInsets.all(26),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
content: SizedBox(
height: SizeConfig.screenHeight! * 0.33,
// width: SizeConfig.screenWidth! * 0.3,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.symmetric(vertical: 6),
child: Column(
children: [
Text(
AppLocalizations.of(context)!.strictTranslate('Start Date'),
),
const SizedBox(
height: 5,
),
GestureDetector(
datePicker(
context,
key: const Key('StartDateSelector'),
title: 'Start Date',
date: _startDate,
onTap: () async {
final date =
await customDatePicker(initialDate: _startDate);
setState(() {
_startDate = date;
});
},
child: SizedBox(
// SizedBox is a box with a specified size.
height: SizeConfig.screenHeight! * 0.07,
width: SizeConfig.screenWidth! * 0.36,
child: Card(
color: Theme.of(context).colorScheme.primaryContainer,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
const Padding(
padding: EdgeInsets.symmetric(horizontal: 10),
child: Icon(
Icons.calendar_today,
size: 19,
),
),
Expanded(
// shows the start date of the event
child: Text(
"${_startDate.toLocal()}".split(' ')[0],
maxLines: 1,
),
),
],
),
),
),
),
],
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
AppLocalizations.of(context)!.strictTranslate('End Date'),
),
const SizedBox(
height: 5,
),
GestureDetector(
datePicker(
context,
key: const Key('EndDateSelector'),
title: 'End Date',
date: _endDate,
onTap: () async {
final date =
await customDatePicker(initialDate: _endDate);
setState(() {
_endDate = date;
});
},
child: SizedBox(
height: SizeConfig.screenHeight! * 0.07,
width: SizeConfig.screenWidth! * 0.36,
child: Card(
color: Theme.of(context).colorScheme.primaryContainer,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
const Padding(
padding: EdgeInsets.symmetric(horizontal: 10),
child: Icon(
Icons.calendar_today,
size: 20,
),
),
Expanded(
// shows the end date of the event
child: Text(
"${_endDate.toLocal()}".split(' ')[0],
maxLines: 1,
),
),
],
),
),
),
),
],
),
],
),
),
Padding(
padding: EdgeInsets.only(
right: SizeConfig.screenWidth! * 0.072,
),
child: SizedBox(
width: SizeConfig.screenWidth! * 0.36,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Expanded(
// returns a button to cancel the event dialog
child: TextButton(
key: const Key('CancelButton'),
onPressed: () {
navigationService.pop();
},
child: Text(
AppLocalizations.of(context)!.strictTranslate('Cancel'),
style: Theme.of(context).textTheme.bodyMedium,
),
TextButton(
key: const Key('CancelButton'),
onPressed: () {
navigationService.pop();
},
child: Text(
AppLocalizations.of(context)!.strictTranslate('Cancel'),
style: Theme.of(context).textTheme.bodyMedium,
),
),
Expanded(
// returns a button to mark the event dialog as done.
child: TextButton(
key: const Key('DoneButton'),
onPressed: () {
navigationService.pop();
},
child: Text(
AppLocalizations.of(context)!.strictTranslate('Done'),
style: const TextStyle(
fontSize: 14,
color: Color(0xff4285F4),
),
TextButton(
key: const Key('DoneButton'),
onPressed: () {
navigationService.pop();
},
child: Text(
AppLocalizations.of(context)!.strictTranslate('Done'),
style: const TextStyle(
fontSize: 14,
color: Color(0xff4285F4),
),
),
),
],
),
],
),
),
);
}

/// Creates a column with a date picker.
///
/// **params**:
/// * `context`: A `BuildContext` representing the build context.
/// * `title`: A `String` representing the title of the date picker.
/// * `onTap`: A `void Function()` callback triggered when the date picker is tapped.
/// * `date`: A `DateTime` representing the selected date for the date picker.
/// * `key`: A `Key` to identify and differentiate the date picker widget.
///
/// **returns**:
/// * `Column`: Returns a `Column` widget containing the date picker elements.
Column datePicker(
BuildContext context, {
required String title,
required void Function()? onTap,
required DateTime date,
required Key key,
}) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
AppLocalizations.of(context)!.strictTranslate(title),
),
const SizedBox(
height: 5,
),
GestureDetector(
key: key,
onTap: onTap,
child: SizedBox(
height: SizeConfig.screenHeight! * 0.08,
child: Card(
color: Theme.of(context).colorScheme.primaryContainer,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
const Padding(
padding: EdgeInsets.symmetric(horizontal: 10),
child: Icon(
Icons.calendar_today,
size: 20,
),
),
Expanded(
// shows the end date of the event
child: Text(
"${date.toLocal()}".split(' ')[0],
// maxLines: 1,
),
),
],
),
),
),
),
],
Expand Down
Loading

0 comments on commit 7493de5

Please sign in to comment.