Rendamed widgets with "custom" in their name
This commit is contained in:
parent
33eab452e0
commit
0d47b271fe
6 changed files with 29 additions and 30 deletions
|
|
@ -1,13 +1,13 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/material.dart' hide AppBar;
|
||||
|
||||
import '../utils.dart' show getImageThumbnailPath, showUploadStatusSnackBar;
|
||||
import '../blocs/event_bloc.dart';
|
||||
import '../screens/gallery_screen.dart';
|
||||
import '../models/task_model.dart';
|
||||
import '../widgets/async_thumbnail.dart';
|
||||
import '../widgets/custom_app_bar.dart';
|
||||
import '../widgets/app_bar.dart';
|
||||
import '../widgets/gradient_touchable_container.dart';
|
||||
import '../widgets/loading_indicator.dart';
|
||||
import '../widgets/task_list_tile.dart';
|
||||
|
|
@ -68,7 +68,7 @@ class _EventScreenState extends State<EventScreen>
|
|||
}
|
||||
|
||||
Widget buildAppBar() {
|
||||
return CustomAppBar(
|
||||
return AppBar(
|
||||
title: widget.eventName,
|
||||
bottom: TabBar(
|
||||
controller: _tabController,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import 'dart:async';
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:rxdart/rxdart.dart';
|
||||
|
||||
import '../widgets/async_image.dart';
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/material.dart' hide AppBar;
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
|
||||
import '../utils.dart';
|
||||
import '../blocs/new_image_bloc.dart';
|
||||
import '../models/user_model.dart';
|
||||
import '../widgets/custom_app_bar.dart';
|
||||
import '../widgets/custom_dropdown.dart';
|
||||
import '../widgets/app_bar.dart';
|
||||
import '../widgets/event_dropdown.dart';
|
||||
import '../widgets/fractionally_screen_sized_box.dart';
|
||||
import '../widgets/gradient_touchable_container.dart';
|
||||
|
||||
|
|
@ -40,7 +40,7 @@ class _NewImageScreenState extends State<NewImageScreen> {
|
|||
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: CustomAppBar(
|
||||
appBar: AppBar(
|
||||
title: 'Add image',
|
||||
),
|
||||
body: Padding(
|
||||
|
|
@ -128,13 +128,13 @@ class _NewImageScreenState extends State<NewImageScreen> {
|
|||
return StreamBuilder(
|
||||
stream: bloc.eventName,
|
||||
builder: (BuildContext context, AsyncSnapshot<String> snap) {
|
||||
return CustomDropdownButton(
|
||||
return EventDropdown(
|
||||
isExpanded: true,
|
||||
value: snap.data,
|
||||
onChanged: bloc.changeEventName,
|
||||
hint: Text('Event'),
|
||||
items: events.map((String event) {
|
||||
return CustomDropdownMenuItem(
|
||||
return EventDropdownMenuItem(
|
||||
value: event,
|
||||
child: Text(
|
||||
event,
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/material.dart' hide AppBar;
|
||||
|
||||
import '../utils.dart';
|
||||
import '../blocs/task_bloc.dart';
|
||||
import '../models/user_model.dart';
|
||||
import '../widgets/custom_app_bar.dart';
|
||||
import '../widgets/custom_dropdown.dart';
|
||||
import '../widgets/app_bar.dart';
|
||||
import '../widgets/event_dropdown.dart';
|
||||
import '../widgets/big_text_input.dart';
|
||||
import '../widgets/fractionally_screen_sized_box.dart';
|
||||
import '../widgets/gradient_touchable_container.dart';
|
||||
|
|
@ -45,7 +45,7 @@ class _TaskScreenState extends State<TaskScreen> {
|
|||
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: CustomAppBar(
|
||||
appBar: AppBar(
|
||||
title: widget.isEdit ? 'Edit task' : 'Add task',
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
|
|
@ -128,13 +128,13 @@ class _TaskScreenState extends State<TaskScreen> {
|
|||
child: StreamBuilder(
|
||||
stream: bloc.eventName,
|
||||
builder: (BuildContext context, AsyncSnapshot<String> snap) {
|
||||
return CustomDropdownButton(
|
||||
return EventDropdown(
|
||||
isExpanded: true,
|
||||
value: snap.data,
|
||||
onChanged: bloc.changeEventName,
|
||||
hint: Text('Event'),
|
||||
items: events.map((String name) {
|
||||
return CustomDropdownMenuItem(
|
||||
return EventDropdownMenuItem(
|
||||
value: name,
|
||||
child: Text(
|
||||
name,
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/material.dart' hide AppBar;
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
/// A custom app bar to match the DO> design rules.
|
||||
///
|
||||
/// This app bar is meant to be usen in screens that are not the home screen.
|
||||
/// It will always contain a back button that pops the current screen.
|
||||
class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
class AppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
/// The title for the app bar.
|
||||
final String title;
|
||||
|
||||
|
|
@ -17,7 +17,7 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
|
|||
/// It will vary depending on the existance of the bottom widget.
|
||||
final double _appBarHeight;
|
||||
|
||||
CustomAppBar({
|
||||
AppBar({
|
||||
this.title = '',
|
||||
this.bottom,
|
||||
}) : _appBarHeight = bottom == null ? 140.0 : 120.0;
|
||||
|
|
@ -308,7 +308,7 @@ class _DropdownRoute<T> extends PopupRoute<_DropdownRouteResult<T>> {
|
|||
this.barrierLabel,
|
||||
}) : assert(style != null);
|
||||
|
||||
final List<CustomDropdownMenuItem<T>> items;
|
||||
final List<EventDropdownMenuItem<T>> items;
|
||||
final EdgeInsetsGeometry padding;
|
||||
final Rect buttonRect;
|
||||
final int selectedIndex;
|
||||
|
|
@ -424,11 +424,11 @@ class _DropdownRoute<T> extends PopupRoute<_DropdownRouteResult<T>> {
|
|||
///
|
||||
/// The type `T` is the type of the value the entry represents. All the entries
|
||||
/// in a given menu must represent values with consistent types.
|
||||
class CustomDropdownMenuItem<T> extends StatelessWidget {
|
||||
class EventDropdownMenuItem<T> extends StatelessWidget {
|
||||
/// Creates an item for a dropdown menu.
|
||||
///
|
||||
/// The [child] argument is required.
|
||||
const CustomDropdownMenuItem({
|
||||
const EventDropdownMenuItem({
|
||||
Key key,
|
||||
this.value,
|
||||
@required this.child,
|
||||
|
|
@ -519,7 +519,7 @@ class CustomDropdownMenuItem<T> extends StatelessWidget {
|
|||
/// from displaying their underlines.
|
||||
/// * [RaisedButton], [FlatButton], ordinary buttons that trigger a single action.
|
||||
/// * <https://material.io/design/components/menus.html#dropdown-menu>
|
||||
class CustomDropdownButton<T> extends StatefulWidget {
|
||||
class EventDropdown<T> extends StatefulWidget {
|
||||
/// Creates a dropdown button.
|
||||
///
|
||||
/// The [items] must have distinct values. If [value] isn't null then it
|
||||
|
|
@ -530,7 +530,7 @@ class CustomDropdownButton<T> extends StatefulWidget {
|
|||
/// The [elevation] and [iconSize] arguments must not be null (they both have
|
||||
/// defaults, so do not need to be specified). The boolean [isDense] and
|
||||
/// [isExpanded] arguments must not be null.
|
||||
CustomDropdownButton({
|
||||
EventDropdown({
|
||||
Key key,
|
||||
@required this.items,
|
||||
this.value,
|
||||
|
|
@ -548,7 +548,7 @@ class CustomDropdownButton<T> extends StatefulWidget {
|
|||
value == null ||
|
||||
items
|
||||
.where(
|
||||
(CustomDropdownMenuItem<T> item) => item.value == value)
|
||||
(EventDropdownMenuItem<T> item) => item.value == value)
|
||||
.length ==
|
||||
1),
|
||||
assert(elevation != null),
|
||||
|
|
@ -563,7 +563,7 @@ class CustomDropdownButton<T> extends StatefulWidget {
|
|||
/// then the dropdown button will be disabled, i.e. its arrow will be
|
||||
/// displayed in grey and it will not respond to input. A disabled button
|
||||
/// will display the [disabledHint] widget if it is non-null.
|
||||
final List<CustomDropdownMenuItem<T>> items;
|
||||
final List<EventDropdownMenuItem<T>> items;
|
||||
|
||||
/// The value of the currently selected [DropdownMenuItem], or null if no
|
||||
/// item has been selected. If `value` is null then the menu is popped up as
|
||||
|
|
@ -627,7 +627,7 @@ class CustomDropdownButton<T> extends StatefulWidget {
|
|||
_DropdownButtonState<T> createState() => _DropdownButtonState<T>();
|
||||
}
|
||||
|
||||
class _DropdownButtonState<T> extends State<CustomDropdownButton<T>>
|
||||
class _DropdownButtonState<T> extends State<EventDropdown<T>>
|
||||
with WidgetsBindingObserver {
|
||||
int _selectedIndex;
|
||||
_DropdownRoute<T> _dropdownRoute;
|
||||
|
|
@ -659,7 +659,7 @@ class _DropdownButtonState<T> extends State<CustomDropdownButton<T>>
|
|||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(CustomDropdownButton<T> oldWidget) {
|
||||
void didUpdateWidget(EventDropdown<T> oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
_updateSelectedIndex();
|
||||
}
|
||||
|
|
@ -671,7 +671,7 @@ class _DropdownButtonState<T> extends State<CustomDropdownButton<T>>
|
|||
|
||||
assert(widget.value == null ||
|
||||
widget.items
|
||||
.where((CustomDropdownMenuItem<T> item) =>
|
||||
.where((EventDropdownMenuItem<T> item) =>
|
||||
item.value == widget.value)
|
||||
.length ==
|
||||
1);
|
||||
|
|
@ -734,7 +734,7 @@ class _DropdownButtonState<T> extends State<CustomDropdownButton<T>>
|
|||
if (widget.hint != null || (!_enabled && widget.disabledHint != null)) {
|
||||
final Widget emplacedHint = _enabled
|
||||
? widget.hint
|
||||
: CustomDropdownMenuItem<Widget>(
|
||||
: EventDropdownMenuItem<Widget>(
|
||||
child: widget.disabledHint ?? widget.hint);
|
||||
hintIndex = items.length;
|
||||
items.add(DefaultTextStyle(
|
||||
Loading…
Add table
Add a link
Reference in a new issue