From 0d47b271feca3a4eb844e50c2059952452f93fc6 Mon Sep 17 00:00:00 2001 From: AYM1607 Date: Mon, 15 Apr 2019 17:23:47 -0500 Subject: [PATCH] Rendamed widgets with "custom" in their name --- lib/src/screens/event_screen.dart | 6 ++--- lib/src/screens/gallery_screen.dart | 1 - lib/src/screens/new_image_screen.dart | 12 +++++----- lib/src/screens/task_screen.dart | 12 +++++----- .../{custom_app_bar.dart => app_bar.dart} | 6 ++--- ...stom_dropdown.dart => event_dropdown.dart} | 22 +++++++++---------- 6 files changed, 29 insertions(+), 30 deletions(-) rename lib/src/widgets/{custom_app_bar.dart => app_bar.dart} (94%) rename lib/src/widgets/{custom_dropdown.dart => event_dropdown.dart} (97%) diff --git a/lib/src/screens/event_screen.dart b/lib/src/screens/event_screen.dart index eebe5c9..88b2423 100644 --- a/lib/src/screens/event_screen.dart +++ b/lib/src/screens/event_screen.dart @@ -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 } Widget buildAppBar() { - return CustomAppBar( + return AppBar( title: widget.eventName, bottom: TabBar( controller: _tabController, diff --git a/lib/src/screens/gallery_screen.dart b/lib/src/screens/gallery_screen.dart index d2d2048..b238a69 100644 --- a/lib/src/screens/gallery_screen.dart +++ b/lib/src/screens/gallery_screen.dart @@ -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'; diff --git a/lib/src/screens/new_image_screen.dart b/lib/src/screens/new_image_screen.dart index 90b21c8..653d5d7 100644 --- a/lib/src/screens/new_image_screen.dart +++ b/lib/src/screens/new_image_screen.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 { Widget build(BuildContext context) { return Scaffold( - appBar: CustomAppBar( + appBar: AppBar( title: 'Add image', ), body: Padding( @@ -128,13 +128,13 @@ class _NewImageScreenState extends State { return StreamBuilder( stream: bloc.eventName, builder: (BuildContext context, AsyncSnapshot 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, diff --git a/lib/src/screens/task_screen.dart b/lib/src/screens/task_screen.dart index 42a2886..7e89714 100644 --- a/lib/src/screens/task_screen.dart +++ b/lib/src/screens/task_screen.dart @@ -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 { 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 { child: StreamBuilder( stream: bloc.eventName, builder: (BuildContext context, AsyncSnapshot 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, diff --git a/lib/src/widgets/custom_app_bar.dart b/lib/src/widgets/app_bar.dart similarity index 94% rename from lib/src/widgets/custom_app_bar.dart rename to lib/src/widgets/app_bar.dart index ccb2f7e..49ef387 100644 --- a/lib/src/widgets/custom_app_bar.dart +++ b/lib/src/widgets/app_bar.dart @@ -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; diff --git a/lib/src/widgets/custom_dropdown.dart b/lib/src/widgets/event_dropdown.dart similarity index 97% rename from lib/src/widgets/custom_dropdown.dart rename to lib/src/widgets/event_dropdown.dart index c0cbb44..2204abf 100644 --- a/lib/src/widgets/custom_dropdown.dart +++ b/lib/src/widgets/event_dropdown.dart @@ -308,7 +308,7 @@ class _DropdownRoute extends PopupRoute<_DropdownRouteResult> { this.barrierLabel, }) : assert(style != null); - final List> items; + final List> items; final EdgeInsetsGeometry padding; final Rect buttonRect; final int selectedIndex; @@ -424,11 +424,11 @@ class _DropdownRoute extends PopupRoute<_DropdownRouteResult> { /// /// 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 extends StatelessWidget { +class EventDropdownMenuItem 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 extends StatelessWidget { /// from displaying their underlines. /// * [RaisedButton], [FlatButton], ordinary buttons that trigger a single action. /// * -class CustomDropdownButton extends StatefulWidget { +class EventDropdown 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 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 extends StatefulWidget { value == null || items .where( - (CustomDropdownMenuItem item) => item.value == value) + (EventDropdownMenuItem item) => item.value == value) .length == 1), assert(elevation != null), @@ -563,7 +563,7 @@ class CustomDropdownButton 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> items; + final List> 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 extends StatefulWidget { _DropdownButtonState createState() => _DropdownButtonState(); } -class _DropdownButtonState extends State> +class _DropdownButtonState extends State> with WidgetsBindingObserver { int _selectedIndex; _DropdownRoute _dropdownRoute; @@ -659,7 +659,7 @@ class _DropdownButtonState extends State> } @override - void didUpdateWidget(CustomDropdownButton oldWidget) { + void didUpdateWidget(EventDropdown oldWidget) { super.didUpdateWidget(oldWidget); _updateSelectedIndex(); } @@ -671,7 +671,7 @@ class _DropdownButtonState extends State> assert(widget.value == null || widget.items - .where((CustomDropdownMenuItem item) => + .where((EventDropdownMenuItem item) => item.value == widget.value) .length == 1); @@ -734,7 +734,7 @@ class _DropdownButtonState extends State> if (widget.hint != null || (!_enabled && widget.disabledHint != null)) { final Widget emplacedHint = _enabled ? widget.hint - : CustomDropdownMenuItem( + : EventDropdownMenuItem( child: widget.disabledHint ?? widget.hint); hintIndex = items.length; items.add(DefaultTextStyle(