mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 22:09:06 +00:00
Flutter 3.29 beta (#2571)
This commit is contained in:
@@ -62,8 +62,12 @@ class _CellState extends State<Cell> with WidgetsBindingObserver {
|
||||
Color randomLightColor() {
|
||||
_random ??= Random(cellNumber);
|
||||
|
||||
return Color.fromARGB(255, _random!.nextInt(50) + 205,
|
||||
_random!.nextInt(50) + 205, _random!.nextInt(50) + 205);
|
||||
return Color.fromARGB(
|
||||
255,
|
||||
_random!.nextInt(50) + 205,
|
||||
_random!.nextInt(50) + 205,
|
||||
_random!.nextInt(50) + 205,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -108,9 +112,10 @@ class _CellState extends State<Cell> with WidgetsBindingObserver {
|
||||
child: StreamBuilder<AccelerometerEvent>(
|
||||
// Don't continuously rebuild for nothing when the
|
||||
// cell isn't visible.
|
||||
stream: appLifecycleState == AppLifecycleState.resumed
|
||||
? accelerometerEventStream()
|
||||
: Stream.value(defaultPosition),
|
||||
stream:
|
||||
appLifecycleState == AppLifecycleState.resumed
|
||||
? accelerometerEventStream()
|
||||
: Stream.value(defaultPosition),
|
||||
initialData: defaultPosition,
|
||||
builder: (context, snapshot) {
|
||||
final data = snapshot.data;
|
||||
@@ -123,7 +128,8 @@ class _CellState extends State<Cell> with WidgetsBindingObserver {
|
||||
transform: Matrix4.rotationX(
|
||||
data.y / gravity * pi / 2,
|
||||
)..multiply(
|
||||
Matrix4.rotationY(data.x / gravity * pi / 2)),
|
||||
Matrix4.rotationY(data.x / gravity * pi / 2),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: const FlutterLogo(size: 72),
|
||||
);
|
||||
|
||||
@@ -17,12 +17,7 @@ void main() {
|
||||
|
||||
final model = CounterModel();
|
||||
|
||||
runApp(
|
||||
ChangeNotifierProvider.value(
|
||||
value: model,
|
||||
child: const MyApp(),
|
||||
),
|
||||
);
|
||||
runApp(ChangeNotifierProvider.value(value: model, child: const MyApp()));
|
||||
}
|
||||
|
||||
/// This is on alternate entrypoint for this module to display Flutter UI in
|
||||
@@ -92,9 +87,7 @@ class FullScreenView extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Full-screen Flutter with plugin'),
|
||||
),
|
||||
appBar: AppBar(title: const Text('Full-screen Flutter with plugin')),
|
||||
body: const Contents(showExit: true),
|
||||
);
|
||||
}
|
||||
@@ -128,10 +121,7 @@ class Contents extends StatelessWidget {
|
||||
const Positioned.fill(
|
||||
child: Opacity(
|
||||
opacity: .25,
|
||||
child: FittedBox(
|
||||
fit: BoxFit.cover,
|
||||
child: FlutterLogo(),
|
||||
),
|
||||
child: FittedBox(fit: BoxFit.cover, child: FlutterLogo()),
|
||||
),
|
||||
),
|
||||
Center(
|
||||
|
||||
Reference in New Issue
Block a user