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

Made test warnings fatal #2332

Merged
merged 4 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
221 changes: 100 additions & 121 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,135 @@ class _ExploreEventDialogState extends State<ExploreEventDialog> {
@override
Widget build(BuildContext context) {
return AlertDialog(
insetPadding: EdgeInsets.all(
SizeConfig.screenWidth! * 0.027,
),
actions: [
Padding(
padding: const EdgeInsets.all(26),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
insetPadding:
EdgeInsets.symmetric(horizontal: SizeConfig.screenWidth! * 0.15),
content: SizedBox(
Azad99-9 marked this conversation as resolved.
Show resolved Hide resolved
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
Loading