mirror of
https://github.com/flutter/samples.git
synced 2026-05-11 09:27:08 +00:00
Landing beta changes in master for the new stable release (#747)
This commit is contained in:
@@ -14,8 +14,8 @@ class AnimatedPositionedDemo extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _AnimatedPositionedDemoState extends State<AnimatedPositionedDemo> {
|
||||
double topPosition;
|
||||
double leftPosition;
|
||||
late double topPosition;
|
||||
late double leftPosition;
|
||||
|
||||
double generateTopPosition(double top) => Random().nextDouble() * top;
|
||||
|
||||
@@ -41,40 +41,38 @@ class _AnimatedPositionedDemoState extends State<AnimatedPositionedDemo> {
|
||||
final appBar = AppBar(title: Text('AnimatedPositioned'));
|
||||
final topPadding = MediaQuery.of(context).padding.top;
|
||||
// AnimatedPositioned animates changes to a widget's position within a Stack
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
appBar: appBar,
|
||||
body: Container(
|
||||
height: size.height,
|
||||
width: size.width,
|
||||
child: Stack(
|
||||
children: [
|
||||
AnimatedPositioned(
|
||||
top: topPosition,
|
||||
left: leftPosition,
|
||||
duration: Duration(seconds: 1),
|
||||
child: InkWell(
|
||||
onTap: () => changePosition(
|
||||
size.height -
|
||||
(appBar.preferredSize.height + topPadding + 50),
|
||||
size.width - 150),
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
width: 150,
|
||||
height: 50,
|
||||
child: Text(
|
||||
'Click Me',
|
||||
style: TextStyle(
|
||||
color:
|
||||
Theme.of(context).buttonTheme.colorScheme.onPrimary,
|
||||
),
|
||||
return Scaffold(
|
||||
appBar: appBar,
|
||||
body: Container(
|
||||
height: size.height,
|
||||
width: size.width,
|
||||
child: Stack(
|
||||
children: [
|
||||
AnimatedPositioned(
|
||||
top: topPosition,
|
||||
left: leftPosition,
|
||||
duration: Duration(seconds: 1),
|
||||
child: InkWell(
|
||||
onTap: () => changePosition(
|
||||
size.height -
|
||||
(appBar.preferredSize.height + topPadding + 50),
|
||||
size.width - 150),
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
width: 150,
|
||||
height: 50,
|
||||
child: Text(
|
||||
'Click Me',
|
||||
style: TextStyle(
|
||||
color:
|
||||
Theme.of(context).buttonTheme.colorScheme!.onPrimary,
|
||||
),
|
||||
color: Theme.of(context).primaryColor,
|
||||
),
|
||||
color: Theme.of(context).primaryColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user