1
0
mirror of https://github.com/flutter/samples.git synced 2026-04-04 10:41:55 +00:00

Add content resizing sample (#2756)

Add a content resizing sample for iOS to support
https://github.com/flutter/flutter/pull/177410

## Pre-launch Checklist

- [x] I read the [Flutter Style Guide] _recently_, and have followed its
advice.
- [x] I signed the [CLA].
- [x] I read the [Contributors Guide].
- [x] I have added sample code updates to the [changelog].
- [x] I updated/added relevant documentation (doc comments with `///`).

If you need help, consider asking for advice on the #hackers-devrel
channel on [Discord].

<!-- Links -->
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md
[CLA]: https://cla.developers.google.com/
[Discord]:
https://github.com/flutter/flutter/blob/master/docs/contributing/Chat.md
[Contributors Guide]:
https://github.com/flutter/samples/blob/main/CONTRIBUTING.md
[changelog]: ../CHANGELOG.md

---------

Co-authored-by: Eric Windmill <eric@ericwindmill.com>
This commit is contained in:
LouiseHsu
2025-12-10 08:38:54 -08:00
committed by GitHub
parent ebdd823c3f
commit c586d727b9
99 changed files with 5335 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
void main() {
runApp(const ResizeApp());
}
class ResizeApp extends StatefulWidget {
const ResizeApp({super.key});
@override
State<ResizeApp> createState() => _ResizeAppState();
}
class _ResizeAppState extends State<ResizeApp> {
int _listSize = 1;
void _addToList() {
setState(() {
_listSize++;
});
}
@override
Widget build(BuildContext context) {
return Center(
heightFactor: 1,
child: Directionality(
textDirection: TextDirection.ltr,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
for (int i = 0; i < _listSize; i++)
Container(color: HSVColor.fromAHSV(1, (10.0 * i), 1, 1).toColor(), height: 50, width: 200,
child: Center(
child: Text(
'Flutter Widget $i',
style: const TextStyle(fontSize: 16, color: Colors.black),
),
)),
TextButton(
onPressed: _addToList,
child: Text('Listception!'),
)
],
),
),
);
}
}