Skip to content

Commit

Permalink
add NestingScreen
Browse files Browse the repository at this point in the history
  • Loading branch information
bartekpacia committed Sep 4, 2024
1 parent 44a88c8 commit 11035a0
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:demo_app/form_test.dart';
import 'package:demo_app/issue_1619_repro.dart';
import 'package:demo_app/issue_1677_repro.dart';
import 'package:demo_app/nesting_screen.dart';
import 'package:demo_app/swipe_test.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
Expand Down Expand Up @@ -73,6 +74,14 @@ class _MyHomePageState extends State<MyHomePage> {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(builder: (_) => const NestingScreen()),
);
},
child: const Text('Nesting Test'),
),
ElevatedButton(
onPressed: () {
Navigator.of(context).push(
Expand Down
58 changes: 58 additions & 0 deletions lib/nesting_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import 'package:flutter/material.dart';

class NestingScreen extends StatefulWidget {
const NestingScreen({super.key});

@override
State<NestingScreen> createState() => _NestingScreenState();
}

class _NestingScreenState extends State<NestingScreen> {
int count = 0;

@override
Widget build(BuildContext context) {
const padding = EdgeInsets.symmetric(horizontal: 48, vertical: 64);

return Scaffold(
appBar: AppBar(
title: const Text('Nesting test screen'),
),
body: Stack(
children: [
Semantics(
identifier: 'level-0',
child: Container(
padding: padding,
child: Stack(
children: [
Semantics(
identifier: 'level-1',
child: Container(
color: Colors.blue,
padding: padding,
child: Stack(
children: [
Semantics(
identifier: 'level-2',
child: Container(
color: Colors.orange,
padding: padding,
),
),
const Text('Container at level 2'),
],
),
),
),
const Text('Container at level 1'),
],
),
),
),
const Text('Container at level 0'),
],
),
);
}
}

0 comments on commit 11035a0

Please sign in to comment.