Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
d759197d
Unverified
Commit
d759197d
authored
5 years ago
by
LongCatIsLooong
Committed by
GitHub
5 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add scrollbars to Gallery (#33634)
parent
23174c34
Changes
18
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
553 additions
and
525 deletions
+553
-525
colors_demo.dart
examples/flutter_gallery/lib/demo/colors_demo.dart
+5
-3
cupertino_alert_demo.dart
...tter_gallery/lib/demo/cupertino/cupertino_alert_demo.dart
+125
-123
cupertino_navigation_demo.dart
...gallery/lib/demo/cupertino/cupertino_navigation_demo.dart
+6
-4
cupertino_text_field_demo.dart
...gallery/lib/demo/cupertino/cupertino_text_field_demo.dart
+20
-18
backdrop_demo.dart
...ples/flutter_gallery/lib/demo/material/backdrop_demo.dart
+35
-33
bottom_app_bar_demo.dart
...lutter_gallery/lib/demo/material/bottom_app_bar_demo.dart
+23
-21
cards_demo.dart
examples/flutter_gallery/lib/demo/material/cards_demo.dart
+23
-21
chip_demo.dart
examples/flutter_gallery/lib/demo/material/chip_demo.dart
+1
-1
data_table_demo.dart
...es/flutter_gallery/lib/demo/material/data_table_demo.dart
+58
-56
elevation_demo.dart
...les/flutter_gallery/lib/demo/material/elevation_demo.dart
+1
-3
expansion_tile_list_demo.dart
...r_gallery/lib/demo/material/expansion_tile_list_demo.dart
+18
-16
full_screen_dialog_demo.dart
...er_gallery/lib/demo/material/full_screen_dialog_demo.dart
+82
-80
icons_demo.dart
examples/flutter_gallery/lib/demo/material/icons_demo.dart
+9
-7
leave_behind_demo.dart
.../flutter_gallery/lib/demo/material/leave_behind_demo.dart
+12
-10
overscroll_demo.dart
...es/flutter_gallery/lib/demo/material/overscroll_demo.dart
+14
-12
text_form_field_demo.dart
...utter_gallery/lib/demo/material/text_form_field_demo.dart
+105
-103
typography_demo.dart
examples/flutter_gallery/lib/demo/typography_demo.dart
+1
-1
video_demo.dart
examples/flutter_gallery/lib/demo/video_demo.dart
+15
-13
No files found.
examples/flutter_gallery/lib/demo/colors_demo.dart
View file @
d759197d
...
...
@@ -115,9 +115,11 @@ class PaletteTabView extends StatelessWidget {
}).
toList
());
}
return
ListView
(
itemExtent:
kColorItemHeight
,
children:
colorItems
,
return
Scrollbar
(
child:
ListView
(
itemExtent:
kColorItemHeight
,
children:
colorItems
,
)
);
}
}
...
...
This diff is collapsed.
Click to expand it.
examples/flutter_gallery/lib/demo/cupertino/cupertino_alert_demo.dart
View file @
d759197d
This diff is collapsed.
Click to expand it.
examples/flutter_gallery/lib/demo/cupertino/cupertino_navigation_demo.dart
View file @
d759197d
...
...
@@ -430,10 +430,12 @@ class CupertinoDemoTab2 extends StatelessWidget {
navigationBar:
CupertinoNavigationBar
(
trailing:
trailingButtons
,
),
child:
ListView
(
children:
<
Widget
>[
Tab2Header
(),
]..
addAll
(
buildTab2Conversation
()),
child:
CupertinoScrollbar
(
child:
ListView
(
children:
<
Widget
>[
Tab2Header
(),
]..
addAll
(
buildTab2Conversation
()),
),
),
);
}
...
...
This diff is collapsed.
Click to expand it.
examples/flutter_gallery/lib/demo/cupertino/cupertino_text_field_demo.dart
View file @
d759197d
...
...
@@ -166,25 +166,27 @@ class _CupertinoTextFieldDemoState extends State<CupertinoTextFieldDemo> {
previousPageTitle:
'Cupertino'
,
middle:
Text
(
'Text Fields'
),
),
child:
ListView
(
children:
<
Widget
>[
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
32.0
,
horizontal:
16.0
),
child:
Column
(
children:
<
Widget
>[
_buildNameField
(),
_buildEmailField
(),
_buildLocationField
(),
_buildPinField
(),
_buildTagsField
(),
],
child:
CupertinoScrollbar
(
child:
ListView
(
children:
<
Widget
>[
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
32.0
,
horizontal:
16.0
),
child:
Column
(
children:
<
Widget
>[
_buildNameField
(),
_buildEmailField
(),
_buildLocationField
(),
_buildPinField
(),
_buildTagsField
(),
],
),
),
),
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
32.0
,
horizontal:
16.0
),
child:
_buildChatTextField
(
),
)
,
]
,
Padding
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
32.0
,
horizontal:
16.0
),
child:
_buildChatTextField
(
),
),
]
,
)
,
),
),
);
...
...
This diff is collapsed.
Click to expand it.
examples/flutter_gallery/lib/demo/material/backdrop_demo.dart
View file @
d759197d
...
...
@@ -102,43 +102,45 @@ class CategoryView extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
final
ThemeData
theme
=
Theme
.
of
(
context
);
return
ListView
(
key:
PageStorageKey
<
Category
>(
category
),
padding:
const
EdgeInsets
.
symmetric
(
vertical:
16.0
,
horizontal:
64.0
,
),
children:
category
.
assets
.
map
<
Widget
>((
String
asset
)
{
return
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
children:
<
Widget
>[
Card
(
child:
Container
(
width:
144.0
,
alignment:
Alignment
.
center
,
child:
Column
(
children:
<
Widget
>[
Image
.
asset
(
asset
,
package:
'flutter_gallery_assets'
,
fit:
BoxFit
.
contain
,
),
Container
(
padding:
const
EdgeInsets
.
only
(
bottom:
16.0
),
alignment:
AlignmentDirectional
.
center
,
child:
Text
(
return
Scrollbar
(
child:
ListView
(
key:
PageStorageKey
<
Category
>(
category
),
padding:
const
EdgeInsets
.
symmetric
(
vertical:
16.0
,
horizontal:
64.0
,
),
children:
category
.
assets
.
map
<
Widget
>((
String
asset
)
{
return
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
children:
<
Widget
>[
Card
(
child:
Container
(
width:
144.0
,
alignment:
Alignment
.
center
,
child:
Column
(
children:
<
Widget
>[
Image
.
asset
(
asset
,
style:
theme
.
textTheme
.
caption
,
package:
'flutter_gallery_assets'
,
fit:
BoxFit
.
contain
,
),
),
],
Container
(
padding:
const
EdgeInsets
.
only
(
bottom:
16.0
),
alignment:
AlignmentDirectional
.
center
,
child:
Text
(
asset
,
style:
theme
.
textTheme
.
caption
,
),
),
],
),
),
),
),
const
SizedBox
(
height:
24.0
)
,
],
);
}).
toList
(),
const
SizedBox
(
height:
24.0
),
]
,
);
}).
toList
(),
)
);
}
}
...
...
This diff is collapsed.
Click to expand it.
examples/flutter_gallery/lib/demo/material/bottom_app_bar_demo.dart
View file @
d759197d
...
...
@@ -156,34 +156,36 @@ class _BottomAppBarDemoState extends State<BottomAppBarDemo> {
),
],
),
body:
ListView
(
padding:
const
EdgeInsets
.
only
(
bottom:
88.0
),
children:
<
Widget
>[
const
_Heading
(
'FAB Shape'
),
body:
Scrollbar
(
child:
ListView
(
padding:
const
EdgeInsets
.
only
(
bottom:
88.0
),
children:
<
Widget
>[
const
_Heading
(
'FAB Shape'
),
_RadioItem
<
Widget
>(
kCircularFab
,
_fabShape
,
_onFabShapeChanged
),
_RadioItem
<
Widget
>(
kDiamondFab
,
_fabShape
,
_onFabShapeChanged
),
_RadioItem
<
Widget
>(
kNoFab
,
_fabShape
,
_onFabShapeChanged
),
_RadioItem
<
Widget
>(
kCircularFab
,
_fabShape
,
_onFabShapeChanged
),
_RadioItem
<
Widget
>(
kDiamondFab
,
_fabShape
,
_onFabShapeChanged
),
_RadioItem
<
Widget
>(
kNoFab
,
_fabShape
,
_onFabShapeChanged
),
const
Divider
(),
const
_Heading
(
'Notch'
),
const
Divider
(),
const
_Heading
(
'Notch'
),
_RadioItem
<
bool
>(
kShowNotchTrue
,
_showNotch
,
_onShowNotchChanged
),
_RadioItem
<
bool
>(
kShowNotchFalse
,
_showNotch
,
_onShowNotchChanged
),
_RadioItem
<
bool
>(
kShowNotchTrue
,
_showNotch
,
_onShowNotchChanged
),
_RadioItem
<
bool
>(
kShowNotchFalse
,
_showNotch
,
_onShowNotchChanged
),
const
Divider
(),
const
_Heading
(
'FAB Position'
),
const
Divider
(),
const
_Heading
(
'FAB Position'
),
_RadioItem
<
FloatingActionButtonLocation
>(
kFabEndDocked
,
_fabLocation
,
_onFabLocationChanged
),
_RadioItem
<
FloatingActionButtonLocation
>(
kFabCenterDocked
,
_fabLocation
,
_onFabLocationChanged
),
_RadioItem
<
FloatingActionButtonLocation
>(
kFabEndFloat
,
_fabLocation
,
_onFabLocationChanged
),
_RadioItem
<
FloatingActionButtonLocation
>(
kFabCenterFloat
,
_fabLocation
,
_onFabLocationChanged
),
_RadioItem
<
FloatingActionButtonLocation
>(
kFabEndDocked
,
_fabLocation
,
_onFabLocationChanged
),
_RadioItem
<
FloatingActionButtonLocation
>(
kFabCenterDocked
,
_fabLocation
,
_onFabLocationChanged
),
_RadioItem
<
FloatingActionButtonLocation
>(
kFabEndFloat
,
_fabLocation
,
_onFabLocationChanged
),
_RadioItem
<
FloatingActionButtonLocation
>(
kFabCenterFloat
,
_fabLocation
,
_onFabLocationChanged
),
const
Divider
(),
const
_Heading
(
'App bar color'
),
const
Divider
(),
const
_Heading
(
'App bar color'
),
_ColorsItem
(
kBabColors
,
_babColor
,
_onBabColorChanged
),
],
_ColorsItem
(
kBabColors
,
_babColor
,
_onBabColorChanged
),
],
),
),
floatingActionButton:
_fabShape
.
value
,
floatingActionButtonLocation:
_fabLocation
.
value
,
...
...
This diff is collapsed.
Click to expand it.
examples/flutter_gallery/lib/demo/material/cards_demo.dart
View file @
d759197d
...
...
@@ -388,27 +388,29 @@ class _CardsDemoState extends State<CardsDemo> {
),
],
),
body:
ListView
(
padding:
const
EdgeInsets
.
only
(
top:
8.0
,
left:
8.0
,
right:
8.0
),
children:
destinations
.
map
<
Widget
>((
TravelDestination
destination
)
{
Widget
child
;
switch
(
destination
.
type
)
{
case
CardDemoType
.
standard
:
child
=
TravelDestinationItem
(
destination:
destination
,
shape:
_shape
);
break
;
case
CardDemoType
.
tappable
:
child
=
TappableTravelDestinationItem
(
destination:
destination
,
shape:
_shape
);
break
;
case
CardDemoType
.
selectable
:
child
=
SelectableTravelDestinationItem
(
destination:
destination
,
shape:
_shape
);
break
;
}
return
Container
(
margin:
const
EdgeInsets
.
only
(
bottom:
8.0
),
child:
child
,
);
}).
toList
(),
body:
Scrollbar
(
child:
ListView
(
padding:
const
EdgeInsets
.
only
(
top:
8.0
,
left:
8.0
,
right:
8.0
),
children:
destinations
.
map
<
Widget
>((
TravelDestination
destination
)
{
Widget
child
;
switch
(
destination
.
type
)
{
case
CardDemoType
.
standard
:
child
=
TravelDestinationItem
(
destination:
destination
,
shape:
_shape
);
break
;
case
CardDemoType
.
tappable
:
child
=
TappableTravelDestinationItem
(
destination:
destination
,
shape:
_shape
);
break
;
case
CardDemoType
.
selectable
:
child
=
SelectableTravelDestinationItem
(
destination:
destination
,
shape:
_shape
);
break
;
}
return
Container
(
margin:
const
EdgeInsets
.
only
(
bottom:
8.0
),
child:
child
,
);
}).
toList
(),
),
),
);
}
...
...
This diff is collapsed.
Click to expand it.
examples/flutter_gallery/lib/demo/material/chip_demo.dart
View file @
d759197d
...
...
@@ -324,7 +324,7 @@ class _ChipDemoState extends State<ChipDemo> {
borderRadius:
BorderRadius
.
circular
(
10.0
),
))
:
theme
.
chipTheme
,
child:
ListView
(
children:
tiles
),
child:
Scrollbar
(
child:
ListView
(
children:
tiles
)
),
),
floatingActionButton:
FloatingActionButton
(
onPressed:
()
=>
setState
(
_reset
),
...
...
This diff is collapsed.
Click to expand it.
examples/flutter_gallery/lib/demo/material/data_table_demo.dart
View file @
d759197d
...
...
@@ -172,62 +172,64 @@ class _DataTableDemoState extends State<DataTableDemo> {
MaterialDemoDocumentationButton
(
DataTableDemo
.
routeName
),
],
),
body:
ListView
(
padding:
const
EdgeInsets
.
all
(
20.0
),
children:
<
Widget
>[
PaginatedDataTable
(
header:
const
Text
(
'Nutrition'
),
rowsPerPage:
_rowsPerPage
,
onRowsPerPageChanged:
(
int
value
)
{
setState
(()
{
_rowsPerPage
=
value
;
});
},
sortColumnIndex:
_sortColumnIndex
,
sortAscending:
_sortAscending
,
onSelectAll:
_dessertsDataSource
.
_selectAll
,
columns:
<
DataColumn
>[
DataColumn
(
label:
const
Text
(
'Dessert (100g serving)'
),
onSort:
(
int
columnIndex
,
bool
ascending
)
=>
_sort
<
String
>((
Dessert
d
)
=>
d
.
name
,
columnIndex
,
ascending
),
),
DataColumn
(
label:
const
Text
(
'Calories'
),
tooltip:
'The total amount of food energy in the given serving size.'
,
numeric:
true
,
onSort:
(
int
columnIndex
,
bool
ascending
)
=>
_sort
<
num
>((
Dessert
d
)
=>
d
.
calories
,
columnIndex
,
ascending
),
),
DataColumn
(
label:
const
Text
(
'Fat (g)'
),
numeric:
true
,
onSort:
(
int
columnIndex
,
bool
ascending
)
=>
_sort
<
num
>((
Dessert
d
)
=>
d
.
fat
,
columnIndex
,
ascending
),
),
DataColumn
(
label:
const
Text
(
'Carbs (g)'
),
numeric:
true
,
onSort:
(
int
columnIndex
,
bool
ascending
)
=>
_sort
<
num
>((
Dessert
d
)
=>
d
.
carbs
,
columnIndex
,
ascending
),
),
DataColumn
(
label:
const
Text
(
'Protein (g)'
),
numeric:
true
,
onSort:
(
int
columnIndex
,
bool
ascending
)
=>
_sort
<
num
>((
Dessert
d
)
=>
d
.
protein
,
columnIndex
,
ascending
),
),
DataColumn
(
label:
const
Text
(
'Sodium (mg)'
),
numeric:
true
,
onSort:
(
int
columnIndex
,
bool
ascending
)
=>
_sort
<
num
>((
Dessert
d
)
=>
d
.
sodium
,
columnIndex
,
ascending
),
),
DataColumn
(
label:
const
Text
(
'Calcium (%)'
),
tooltip:
'The amount of calcium as a percentage of the recommended daily amount.'
,
numeric:
true
,
onSort:
(
int
columnIndex
,
bool
ascending
)
=>
_sort
<
num
>((
Dessert
d
)
=>
d
.
calcium
,
columnIndex
,
ascending
),
),
DataColumn
(
label:
const
Text
(
'Iron (%)'
),
numeric:
true
,
onSort:
(
int
columnIndex
,
bool
ascending
)
=>
_sort
<
num
>((
Dessert
d
)
=>
d
.
iron
,
columnIndex
,
ascending
),
),
],
source
:
_dessertsDataSource
,
),
],
body:
Scrollbar
(
child:
ListView
(
padding:
const
EdgeInsets
.
all
(
20.0
),
children:
<
Widget
>[
PaginatedDataTable
(
header:
const
Text
(
'Nutrition'
),
rowsPerPage:
_rowsPerPage
,
onRowsPerPageChanged:
(
int
value
)
{
setState
(()
{
_rowsPerPage
=
value
;
});
},
sortColumnIndex:
_sortColumnIndex
,
sortAscending:
_sortAscending
,
onSelectAll:
_dessertsDataSource
.
_selectAll
,
columns:
<
DataColumn
>[
DataColumn
(
label:
const
Text
(
'Dessert (100g serving)'
),
onSort:
(
int
columnIndex
,
bool
ascending
)
=>
_sort
<
String
>((
Dessert
d
)
=>
d
.
name
,
columnIndex
,
ascending
),
),
DataColumn
(
label:
const
Text
(
'Calories'
),
tooltip:
'The total amount of food energy in the given serving size.'
,
numeric:
true
,
onSort:
(
int
columnIndex
,
bool
ascending
)
=>
_sort
<
num
>((
Dessert
d
)
=>
d
.
calories
,
columnIndex
,
ascending
),
),
DataColumn
(
label:
const
Text
(
'Fat (g)'
),
numeric:
true
,
onSort:
(
int
columnIndex
,
bool
ascending
)
=>
_sort
<
num
>((
Dessert
d
)
=>
d
.
fat
,
columnIndex
,
ascending
),
),
DataColumn
(
label:
const
Text
(
'Carbs (g)'
),
numeric:
true
,
onSort:
(
int
columnIndex
,
bool
ascending
)
=>
_sort
<
num
>((
Dessert
d
)
=>
d
.
carbs
,
columnIndex
,
ascending
),
),
DataColumn
(
label:
const
Text
(
'Protein (g)'
),
numeric:
true
,
onSort:
(
int
columnIndex
,
bool
ascending
)
=>
_sort
<
num
>((
Dessert
d
)
=>
d
.
protein
,
columnIndex
,
ascending
),
),
DataColumn
(
label:
const
Text
(
'Sodium (mg)'
),
numeric:
true
,
onSort:
(
int
columnIndex
,
bool
ascending
)
=>
_sort
<
num
>((
Dessert
d
)
=>
d
.
sodium
,
columnIndex
,
ascending
),
),
DataColumn
(
label:
const
Text
(
'Calcium (%)'
),
tooltip:
'The amount of calcium as a percentage of the recommended daily amount.'
,
numeric:
true
,
onSort:
(
int
columnIndex
,
bool
ascending
)
=>
_sort
<
num
>((
Dessert
d
)
=>
d
.
calcium
,
columnIndex
,
ascending
),
),
DataColumn
(
label:
const
Text
(
'Iron (%)'
),
numeric:
true
,
onSort:
(
int
columnIndex
,
bool
ascending
)
=>
_sort
<
num
>((
Dessert
d
)
=>
d
.
iron
,
columnIndex
,
ascending
),
),
],
source
:
_dessertsDataSource
,
),
],
),
),
);
}
...
...
This diff is collapsed.
Click to expand it.
examples/flutter_gallery/lib/demo/material/elevation_demo.dart
View file @
d759197d
...
...
@@ -57,9 +57,7 @@ class _ElevationDemoState extends State<ElevationDemo> {
),
],
),
body:
ListView
(
children:
buildCards
(),
),
body:
Scrollbar
(
child:
ListView
(
children:
buildCards
())),
);
}
}
This diff is collapsed.
Click to expand it.
examples/flutter_gallery/lib/demo/material/expansion_tile_list_demo.dart
View file @
d759197d
...
...
@@ -16,22 +16,24 @@ class ExpansionTileListDemo extends StatelessWidget {
title:
const
Text
(
'Expand/collapse list control'
),
actions:
<
Widget
>[
MaterialDemoDocumentationButton
(
routeName
)],
),
body:
ListView
(
children:
<
Widget
>[
const
ListTile
(
title:
Text
(
'Top'
)),
ExpansionTile
(
title:
const
Text
(
'Sublist'
),
backgroundColor:
Theme
.
of
(
context
).
accentColor
.
withOpacity
(
0.025
),
children:
const
<
Widget
>[
ListTile
(
title:
Text
(
'One'
)),
ListTile
(
title:
Text
(
'Two'
)),
// https://en.wikipedia.org/wiki/Free_Four
ListTile
(
title:
Text
(
'Free'
)),
ListTile
(
title:
Text
(
'Four'
)),
],
),
const
ListTile
(
title:
Text
(
'Bottom'
)),
],
body:
Scrollbar
(
child:
ListView
(
children:
<
Widget
>[
const
ListTile
(
title:
Text
(
'Top'
)),
ExpansionTile
(
title:
const
Text
(
'Sublist'
),
backgroundColor:
Theme
.
of
(
context
).
accentColor
.
withOpacity
(
0.025
),
children:
const
<
Widget
>[
ListTile
(
title:
Text
(
'One'
)),
ListTile
(
title:
Text
(
'Two'
)),
// https://en.wikipedia.org/wiki/Free_Four
ListTile
(
title:
Text
(
'Free'
)),
ListTile
(
title:
Text
(
'Four'
)),
],
),
const
ListTile
(
title:
Text
(
'Bottom'
)),
],
),
),
);
}
...
...
This diff is collapsed.
Click to expand it.
examples/flutter_gallery/lib/demo/material/full_screen_dialog_demo.dart
View file @
d759197d
...
...
@@ -162,86 +162,69 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
),
body:
Form
(
onWillPop:
_onWillPop
,
child:
ListView
(
padding:
const
EdgeInsets
.
all
(
16.0
),
children:
<
Widget
>[
Container
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
8.0
),
alignment:
Alignment
.
bottomLeft
,
child:
TextField
(
decoration:
const
InputDecoration
(
labelText:
'Event name'
,
filled:
true
,
),
style:
theme
.
textTheme
.
headline
,
onChanged:
(
String
value
)
{
setState
(()
{
_hasName
=
value
.
isNotEmpty
;
if
(
_hasName
)
{
_eventName
=
value
;
}
});
},
),
),
Container
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
8.0
),
alignment:
Alignment
.
bottomLeft
,
child:
TextField
(
decoration:
const
InputDecoration
(
labelText:
'Location'
,
hintText:
'Where is the event?'
,
filled:
true
,
),
onChanged:
(
String
value
)
{
setState
(()
{
_hasLocation
=
value
.
isNotEmpty
;
});
},
),
),
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
Text
(
'From'
,
style:
theme
.
textTheme
.
caption
),
DateTimeItem
(
dateTime:
_fromDateTime
,
onChanged:
(
DateTime
value
)
{
child:
Scrollbar
(
child:
ListView
(
padding:
const
EdgeInsets
.
all
(
16.0
),
children:
<
Widget
>[
Container
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
8.0
),
alignment:
Alignment
.
bottomLeft
,
child:
TextField
(
decoration:
const
InputDecoration
(
labelText:
'Event name'
,
filled:
true
,
),
style:
theme
.
textTheme
.
headline
,
onChanged:
(
String
value
)
{
setState
(()
{
_fromDateTime
=
value
;
_saveNeeded
=
true
;
_hasName
=
value
.
isNotEmpty
;
if
(
_hasName
)
{
_eventName
=
value
;
}
});
},
),
],
),
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
Text
(
'To'
,
style:
theme
.
textTheme
.
caption
),
DateTimeItem
(
dateTime:
_toDateTime
,
onChanged:
(
DateTime
value
)
{
),
Container
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
8.0
),
alignment:
Alignment
.
bottomLeft
,
child:
TextField
(
decoration:
const
InputDecoration
(
labelText:
'Location'
,
hintText:
'Where is the event?'
,
filled:
true
,
),
onChanged:
(
String
value
)
{
setState
(()
{
_toDateTime
=
value
;
_saveNeeded
=
true
;
_hasLocation
=
value
.
isNotEmpty
;
});
},
),
const
Text
(
'All-day'
),
],
),
Container
(
decoration:
BoxDecoration
(
border:
Border
(
bottom:
BorderSide
(
color:
theme
.
dividerColor
))
),
child:
Row
(
children:
<
Widget
>
[
Checkbox
(
value:
_allDayValue
,
onChanged:
(
bool
value
)
{
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
Text
(
'From'
,
style:
theme
.
textTheme
.
caption
),
DateTimeItem
(
dateTime:
_fromDateTime
,
onChanged:
(
DateTime
value
)
{
setState
(()
{
_fromDateTime
=
value
;
_saveNeeded
=
true
;
});
},
),
],
),
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
Text
(
'To'
,
style:
theme
.
textTheme
.
caption
),
DateTimeItem
(
dateTime:
_toDateTime
,
onChanged:
(
DateTime
value
)
{
setState
(()
{
_
allDayValu
e
=
value
;
_
toDateTim
e
=
value
;
_saveNeeded
=
true
;
});
},
...
...
@@ -249,16 +232,35 @@ class FullScreenDialogDemoState extends State<FullScreenDialogDemo> {
const
Text
(
'All-day'
),
],
),
),
]
.
map
<
Widget
>((
Widget
child
)
{
return
Container
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
8.0
),
height:
96.0
,
child:
child
,
);
})
.
toList
(),
Container
(
decoration:
BoxDecoration
(
border:
Border
(
bottom:
BorderSide
(
color:
theme
.
dividerColor
))
),
child:
Row
(
children:
<
Widget
>
[
Checkbox
(
value:
_allDayValue
,
onChanged:
(
bool
value
)
{
setState
(()
{
_allDayValue
=
value
;
_saveNeeded
=
true
;
});
},
),
const
Text
(
'All-day'
),
],
),
),
]
.
map
<
Widget
>((
Widget
child
)
{
return
Container
(
padding:
const
EdgeInsets
.
symmetric
(
vertical:
8.0
),
height:
96.0
,
child:
child
,
);
})
.
toList
(),
),
),
),
);
...
...
This diff is collapsed.
Click to expand it.
examples/flutter_gallery/lib/demo/material/icons_demo.dart
View file @
d759197d
...
...
@@ -58,13 +58,15 @@ class IconsDemoState extends State<IconsDemo> {
child:
SafeArea
(
top:
false
,
bottom:
false
,
child:
ListView
(
padding:
const
EdgeInsets
.
all
(
24.0
),
children:
<
Widget
>[
_IconsDemoCard
(
handleIconButtonPress
,
Icons
.
face
),
// direction-agnostic icon
const
SizedBox
(
height:
24.0
),
_IconsDemoCard
(
handleIconButtonPress
,
Icons
.
battery_unknown
),
// direction-aware icon
],
child:
Scrollbar
(
child:
ListView
(
padding:
const
EdgeInsets
.
all
(
24.0
),
children:
<
Widget
>[
_IconsDemoCard
(
handleIconButtonPress
,
Icons
.
face
),
// direction-agnostic icon
const
SizedBox
(
height:
24.0
),
_IconsDemoCard
(
handleIconButtonPress
,
Icons
.
battery_unknown
),
// direction-aware icon
],
),
),
),
),
...
...
This diff is collapsed.
Click to expand it.
examples/flutter_gallery/lib/demo/material/leave_behind_demo.dart
View file @
d759197d
...
...
@@ -130,16 +130,18 @@ class LeaveBehindDemoState extends State<LeaveBehindDemo> {
),
);
}
else
{
body
=
ListView
(
children:
leaveBehindItems
.
map
<
Widget
>((
LeaveBehindItem
item
)
{
return
_LeaveBehindListItem
(
confirmDismiss:
_confirmDismiss
,
item:
item
,
onArchive:
_handleArchive
,
onDelete:
_handleDelete
,
dismissDirection:
_dismissDirection
,
);
}).
toList
(),
body
=
Scrollbar
(
child:
ListView
(
children:
leaveBehindItems
.
map
<
Widget
>((
LeaveBehindItem
item
)
{
return
_LeaveBehindListItem
(
confirmDismiss:
_confirmDismiss
,
item:
item
,
onArchive:
_handleArchive
,
onDelete:
_handleDelete
,
dismissDirection:
_dismissDirection
,
);
}).
toList
(),
),
);
}
...
...
This diff is collapsed.
Click to expand it.
examples/flutter_gallery/lib/demo/material/overscroll_demo.dart
View file @
d759197d
...
...
@@ -62,18 +62,20 @@ class OverscrollDemoState extends State<OverscrollDemo> {
body:
RefreshIndicator
(
key:
_refreshIndicatorKey
,
onRefresh:
_handleRefresh
,
child:
ListView
.
builder
(
padding:
kMaterialListPadding
,
itemCount:
_items
.
length
,
itemBuilder:
(
BuildContext
context
,
int
index
)
{
final
String
item
=
_items
[
index
];
return
ListTile
(
isThreeLine:
true
,
leading:
CircleAvatar
(
child:
Text
(
item
)),
title:
Text
(
'This item represents
$item
.'
),
subtitle:
const
Text
(
'Even more additional list item information appears on line three.'
),
);
},
child:
Scrollbar
(
child:
ListView
.
builder
(
padding:
kMaterialListPadding
,
itemCount:
_items
.
length
,
itemBuilder:
(
BuildContext
context
,
int
index
)
{
final
String
item
=
_items
[
index
];
return
ListTile
(
isThreeLine:
true
,
leading:
CircleAvatar
(
child:
Text
(
item
)),
title:
Text
(
'This item represents
$item
.'
),
subtitle:
const
Text
(
'Even more additional list item information appears on line three.'
),
);
},
),
),
),
);
...
...
This diff is collapsed.
Click to expand it.
examples/flutter_gallery/lib/demo/material/text_form_field_demo.dart
View file @
d759197d
...
...
@@ -182,116 +182,118 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> {
key:
_formKey
,
autovalidate:
_autovalidate
,
onWillPop:
_warnUserAboutInvalidData
,
child:
SingleChildScrollView
(
dragStartBehavior:
DragStartBehavior
.
down
,
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
16.0
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
children:
<
Widget
>[
const
SizedBox
(
height:
24.0
),
TextFormField
(
textCapitalization:
TextCapitalization
.
words
,
decoration:
const
InputDecoration
(
border:
UnderlineInputBorder
(),
filled:
true
,
icon:
Icon
(
Icons
.
person
),
hintText:
'What do people call you?'
,
labelText:
'Name *'
,
child:
Scrollbar
(
child:
SingleChildScrollView
(
dragStartBehavior:
DragStartBehavior
.
down
,
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
16.0
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
children:
<
Widget
>[
const
SizedBox
(
height:
24.0
),
TextFormField
(
textCapitalization:
TextCapitalization
.
words
,
decoration:
const
InputDecoration
(
border:
UnderlineInputBorder
(),
filled:
true
,
icon:
Icon
(
Icons
.
person
),
hintText:
'What do people call you?'
,
labelText:
'Name *'
,
),
onSaved:
(
String
value
)
{
person
.
name
=
value
;
},
validator:
_validateName
,
),
onSaved:
(
String
value
)
{
person
.
name
=
value
;
},
validator:
_validateName
,
),
const
SizedBox
(
height:
24.0
),
TextFormField
(
decoration:
const
InputDecoration
(
border:
UnderlineInputBorder
(),
filled:
true
,
icon:
Icon
(
Icons
.
phone
),
hintText:
'Where can we reach you?'
,
labelText:
'Phone Number *'
,
prefixText:
'+1'
,
const
SizedBox
(
height:
24.0
),
TextFormField
(
decoration:
const
InputDecoration
(
border:
UnderlineInputBorder
(),
filled:
true
,
icon:
Icon
(
Icons
.
phone
),
hintText:
'Where can we reach you?'
,
labelText:
'Phone Number *'
,
prefixText:
'+1'
,
),
keyboardType:
TextInputType
.
phone
,
onSaved:
(
String
value
)
{
person
.
phoneNumber
=
value
;
},
validator:
_validatePhoneNumber
,
// TextInputFormatters are applied in sequence.
inputFormatters:
<
TextInputFormatter
>
[
WhitelistingTextInputFormatter
.
digitsOnly
,
// Fit the validating format.
_phoneNumberFormatter
,
],
),
keyboardType:
TextInputType
.
phone
,
onSaved:
(
String
value
)
{
person
.
phoneNumber
=
value
;
},
validator:
_validatePhoneNumber
,
// TextInputFormatters are applied in sequence.
inputFormatters:
<
TextInputFormatter
>
[
WhitelistingTextInputFormatter
.
digitsOnly
,
// Fit the validating format.
_phoneNumberFormatter
,
],
),
const
SizedBox
(
height:
24.0
),
TextFormField
(
decoration:
const
InputDecoration
(
border:
UnderlineInputBorder
(),
filled:
true
,
icon:
Icon
(
Icons
.
email
),
hintText:
'Your email address'
,
labelText:
'E-mail'
,
const
SizedBox
(
height:
24.0
),
TextFormField
(
decoration:
const
InputDecoration
(
border:
UnderlineInputBorder
(),
filled:
true
,
icon:
Icon
(
Icons
.
email
),
hintText:
'Your email address'
,
labelText:
'E-mail'
,
),
keyboardType:
TextInputType
.
emailAddress
,
onSaved:
(
String
value
)
{
person
.
email
=
value
;
},
),
keyboardType:
TextInputType
.
emailAddress
,
onSaved:
(
String
value
)
{
person
.
email
=
value
;
},
),
const
SizedBox
(
height:
24.0
),
TextFormField
(
decoration:
const
InputDecoration
(
border:
OutlineInputBorder
(),
hintText:
'Tell us about yourself (e.g., write down what you do or what hobbies you have)'
,
helperText:
'Keep it short, this is just a demo.'
,
labelText:
'Life story'
,
const
SizedBox
(
height:
24.0
),
TextFormField
(
decoration:
const
InputDecoration
(
border:
OutlineInputBorder
(),
hintText:
'Tell us about yourself (e.g., write down what you do or what hobbies you have)'
,
helperText:
'Keep it short, this is just a demo.'
,
labelText:
'Life story'
,
),
maxLines:
3
,
),
maxLines:
3
,
),
const
SizedBox
(
height:
24.0
)
,
TextFormField
(
keyboardType:
TextInputType
.
number
,
decoration:
const
InputDecoration
(
border:
OutlineInputBorder
()
,
labelText:
'Salary
'
,
prefixText:
'
\$
'
,
suffixText:
'USD'
,
suffixStyle:
TextStyle
(
color:
Colors
.
green
)
,
const
SizedBox
(
height:
24.0
)
,
TextFormField
(
keyboardType:
TextInputType
.
number
,
decoration:
const
InputDecoration
(
border:
OutlineInputBorder
()
,
labelText:
'Salary'
,
prefixText:
'
\$
'
,
suffixText:
'USD
'
,
suffixStyle:
TextStyle
(
color:
Colors
.
green
)
,
)
,
maxLines:
1
,
),
maxLines:
1
,
),
const
SizedBox
(
height:
24.0
),
PasswordField
(
fieldKey:
_passwordFieldKey
,
helperText:
'No more than 8 characters.'
,
labelText:
'Password *'
,
onFieldSubmitted:
(
String
value
)
{
setState
(()
{
person
.
password
=
value
;
});
},
),
const
SizedBox
(
height:
24.0
),
TextFormField
(
enabled:
person
.
password
!=
null
&&
person
.
password
.
isNotEmpty
,
decoration:
const
InputDecoration
(
border:
UnderlineInputBorder
(),
filled:
true
,
labelText:
'Re-type password'
,
const
SizedBox
(
height:
24.0
),
PasswordField
(
fieldKey:
_passwordFieldKey
,
helperText:
'No more than 8 characters.'
,
labelText:
'Password *'
,
onFieldSubmitted:
(
String
value
)
{
setState
(()
{
person
.
password
=
value
;
});
},
),
maxLength:
8
,
obscureText:
true
,
validator:
_validatePassword
,
),
const
SizedBox
(
height:
24.0
),
Center
(
child:
RaisedButton
(
child:
const
Text
(
'SUBMIT'
),
onPressed:
_handleSubmitted
,
const
SizedBox
(
height:
24.0
),
TextFormField
(
enabled:
person
.
password
!=
null
&&
person
.
password
.
isNotEmpty
,
decoration:
const
InputDecoration
(
border:
UnderlineInputBorder
(),
filled:
true
,
labelText:
'Re-type password'
,
),
maxLength:
8
,
obscureText:
true
,
validator:
_validatePassword
,
),
),
const
SizedBox
(
height:
24.0
),
Text
(
'* indicates required field'
,
style:
Theme
.
of
(
context
).
textTheme
.
caption
,
),
const
SizedBox
(
height:
24.0
),
],
const
SizedBox
(
height:
24.0
),
Center
(
child:
RaisedButton
(
child:
const
Text
(
'SUBMIT'
),
onPressed:
_handleSubmitted
,
),
),
const
SizedBox
(
height:
24.0
),
Text
(
'* indicates required field'
,
style:
Theme
.
of
(
context
).
textTheme
.
caption
,
),
const
SizedBox
(
height:
24.0
),
],
),
),
),
),
...
...
This diff is collapsed.
Click to expand it.
examples/flutter_gallery/lib/demo/typography_demo.dart
View file @
d759197d
...
...
@@ -73,7 +73,7 @@ class TypographyDemo extends StatelessWidget {
body:
SafeArea
(
top:
false
,
bottom:
false
,
child:
ListView
(
children:
styleItems
),
child:
Scrollbar
(
child:
ListView
(
children:
styleItems
)
),
),
);
}
...
...
This diff is collapsed.
Click to expand it.
examples/flutter_gallery/lib/demo/video_demo.dart
View file @
d759197d
...
...
@@ -405,19 +405,21 @@ class _VideoDemoState extends State<VideoDemo> with SingleTickerProviderStateMix
),
body:
isSupported
?
ConnectivityOverlay
(
child:
ListView
(
children:
<
Widget
>[
VideoCard
(
title:
'Butterfly'
,
subtitle:
'… flutters by'
,
controller:
butterflyController
,
),
VideoCard
(
title:
'Bee'
,
subtitle:
'… gently buzzing'
,
controller:
beeController
,
),
],
child:
Scrollbar
(
child:
ListView
(
children:
<
Widget
>[
VideoCard
(
title:
'Butterfly'
,
subtitle:
'… flutters by'
,
controller:
butterflyController
,
),
VideoCard
(
title:
'Bee'
,
subtitle:
'… gently buzzing'
,
controller:
beeController
,
),
],
),
),
connectedCompleter:
connectedCompleter
,
scaffoldKey:
scaffoldKey
,
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment