mirror of
https://github.com/Iconica-Development/flutter_availability.git
synced 2025-05-20 05:33:44 +02:00
feat: add flutter_availability configuration
This commit is contained in:
parent
d38119f493
commit
651277c1ca
4 changed files with 103 additions and 11 deletions
|
@ -1,8 +1,8 @@
|
|||
///
|
||||
library flutter_availability;
|
||||
|
||||
/// A Calculator.
|
||||
class Calculator {
|
||||
/// Returns [value] plus 1.
|
||||
int addOne(int value) => value + 1;
|
||||
}
|
||||
export "src/config/availability_options.dart";
|
||||
export "src/config/availability_translations.dart";
|
||||
export "src/screens/availability_overview.dart";
|
||||
export "src/userstory/navigator_userstory.dart";
|
||||
export "src/userstory/userstory_configuration.dart";
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
import "package:flutter_availability/src/config/availability_translations.dart";
|
||||
|
||||
/// Class that holds all options for the availability userstory
|
||||
class AvailabilityOptions {
|
||||
/// AvailabilityOptions constructor where everything is optional.
|
||||
const AvailabilityOptions({
|
||||
this.translations = const AvailabilityTranslations.empty(),
|
||||
});
|
||||
|
||||
/// The translations for the availability userstory
|
||||
final AvailabilityTranslations translations;
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
// SPDX-FileCopyrightText: 2024 Iconica
|
||||
//
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
/// Class that holds all translatable strings for the availability userstory
|
||||
class AvailabilityTranslations {
|
||||
/// AvailabilityTranslations constructor where everything is required.
|
||||
/// If you want to have a default value, use the `empty` constructor.
|
||||
/// You can copyWith the values to override some default translations.
|
||||
/// It is recommended to use this constructor.
|
||||
const AvailabilityTranslations({
|
||||
required this.calendarTitle,
|
||||
required this.addAvailableDayButtonText,
|
||||
required this.availabilityOverviewTitle,
|
||||
required this.availabilityDate,
|
||||
required this.availabilityHours,
|
||||
required this.availabilityEmptyMessage,
|
||||
required this.availabilitySubmit,
|
||||
required this.availabilitySave,
|
||||
});
|
||||
|
||||
/// AvailabilityTranslations constructor where everything is optional.
|
||||
/// This provides default english values for the availability userstory.
|
||||
const AvailabilityTranslations.empty({
|
||||
this.calendarTitle = "Availability",
|
||||
this.addAvailableDayButtonText = "Add availability",
|
||||
this.availabilityOverviewTitle = "Overview of your availabilities",
|
||||
this.availabilityDate = "Date",
|
||||
this.availabilityHours = "Hours",
|
||||
this.availabilityEmptyMessage =
|
||||
"No availabilities filled in for this month",
|
||||
this.availabilitySubmit = "Submit",
|
||||
this.availabilitySave = "Save",
|
||||
});
|
||||
|
||||
/// The title shown above the calendar
|
||||
final String calendarTitle;
|
||||
|
||||
/// The text shown on the button to add an available day
|
||||
final String addAvailableDayButtonText;
|
||||
|
||||
/// The title for the overview of the availabilities
|
||||
final String availabilityOverviewTitle;
|
||||
|
||||
/// The label for the date of an availability
|
||||
final String availabilityDate;
|
||||
|
||||
/// The label for the hours of an availability
|
||||
final String availabilityHours;
|
||||
|
||||
/// The text shown when there are no availabilities filled in for a month
|
||||
final String availabilityEmptyMessage;
|
||||
|
||||
/// The text shown on the button to submit the availabilities
|
||||
final String availabilitySubmit;
|
||||
|
||||
/// The text shown on the button to save a single availability
|
||||
final String availabilitySave;
|
||||
|
||||
/// Method to update the translations with new values
|
||||
AvailabilityTranslations copyWith({
|
||||
String? calendarTitle,
|
||||
String? addAvailableDayButtonText,
|
||||
String? availabilityOverviewTitle,
|
||||
String? availabilityDate,
|
||||
String? availabilityHours,
|
||||
String? availabilityEmptyMessage,
|
||||
String? availabilitySubmit,
|
||||
String? availabilitySave,
|
||||
}) =>
|
||||
AvailabilityTranslations(
|
||||
calendarTitle: calendarTitle ?? this.calendarTitle,
|
||||
addAvailableDayButtonText:
|
||||
addAvailableDayButtonText ?? this.addAvailableDayButtonText,
|
||||
availabilityOverviewTitle:
|
||||
availabilityOverviewTitle ?? this.availabilityOverviewTitle,
|
||||
availabilityDate: availabilityDate ?? this.availabilityDate,
|
||||
availabilityHours: availabilityHours ?? this.availabilityHours,
|
||||
availabilityEmptyMessage:
|
||||
availabilityEmptyMessage ?? this.availabilityEmptyMessage,
|
||||
availabilitySubmit: availabilitySubmit ?? this.availabilitySubmit,
|
||||
availabilitySave: availabilitySave ?? this.availabilitySave,
|
||||
);
|
||||
}
|
|
@ -1,11 +1,7 @@
|
|||
import "package:flutter_availability/flutter_availability.dart";
|
||||
import "package:flutter_test/flutter_test.dart";
|
||||
|
||||
void main() {
|
||||
test("adds one to input values", () {
|
||||
var calculator = Calculator();
|
||||
expect(calculator.addOne(2), 3);
|
||||
expect(calculator.addOne(-7), -6);
|
||||
expect(calculator.addOne(0), 1);
|
||||
test("Expects tests to run", () {
|
||||
expect(true, isTrue);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue