Skip to content

Commit 10aa6f7

Browse files
committed
works
1 parent 872d491 commit 10aa6f7

4 files changed

Lines changed: 29 additions & 66 deletions

File tree

Lines changed: 27 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,46 @@
1+
// Copyright 2014 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
15
import 'package:flutter/material.dart';
26

37
void main() {
4-
runApp(const MyApp());
8+
runApp(const ResizeApp());
59
}
610

7-
/// The main application widget for the Fruit Catalog.
8-
class MyApp extends StatefulWidget {
9-
/// Creates the [MyApp].
10-
const MyApp({super.key});
11+
class ResizeApp extends StatefulWidget {
12+
/// Creates the [ResizeApp].
13+
const ResizeApp({super.key});
1114

1215
@override
13-
State<MyApp> createState() => _MyAppState();
16+
State<ResizeApp> createState() => _ResizeAppState();
1417
}
1518

16-
class _MyAppState extends State<MyApp> {
17-
int _counter = 1;
18-
void _incrementCounter() {
19+
class _ResizeAppState extends State<ResizeApp> {
20+
int _listSize = 1;
21+
void _addToList() {
1922
setState(() {
20-
if (_counter > 40) {
21-
_counter = 1;
22-
}
23-
_counter++;
23+
_listSize++;
2424
});
2525
}
2626

2727
@override
2828
Widget build(BuildContext context) {
29-
30-
return Center(
31-
heightFactor: 1,
32-
child: Directionality(
33-
textDirection: TextDirection.ltr,
34-
child: Column(
35-
mainAxisAlignment: MainAxisAlignment.end,
36-
children: [
37-
for (int i = 0; i < _counter; i++)
38-
Text(
39-
"Hello from Flutter $i",
40-
style: TextStyle(color: Colors.pink),
41-
),
42-
Padding(
43-
padding: const EdgeInsets.fromLTRB(8.0, 50, 8.0, 8.0),
44-
child: ElevatedButton(
45-
onPressed: _incrementCounter,
46-
child: Text("Add to list"),
47-
),
48-
),
49-
50-
],
29+
return GestureDetector(
30+
onTap: _addToList, // The tap anywhere logic
31+
child: Center(
32+
heightFactor: 1,
33+
child: Directionality(
34+
textDirection: TextDirection.ltr,
35+
child: Column(
36+
mainAxisSize: MainAxisSize.min,
37+
children: <Widget>[
38+
for (int i = 0; i < _listSize; i++)
39+
Container(color: HSVColor.fromAHSV(1, (10.0 * i), 1, 1).toColor(), height: 50, width: 100),
40+
],
41+
),
5142
),
5243
),
5344
);
5445
}
55-
}
46+
}

add_to_app/ios_content_resizing/flutter_module/test/widget_test.dart

Lines changed: 0 additions & 30 deletions
This file was deleted.

add_to_app/ios_content_resizing/ios_content_resizing/ios_content_resizing/ViewController.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class ViewController: UIViewController {
1515
let stackView = UIStackView()
1616
stackView.axis = .vertical
1717
stackView.distribution = .fill
18+
stackView.backgroundColor = .yellow
1819
stackView.translatesAutoresizingMaskIntoConstraints = false
1920

2021
let engine1 = FlutterEngine(name: "one")
@@ -27,6 +28,7 @@ class ViewController: UIViewController {
2728
addChild(flutterViewController)
2829
stackView.addArrangedSubview(flutterViewController.view)
2930
flutterViewController.didMove(toParent: self)
31+
3032
} else {
3133
let label = UILabel()
3234
label.text = "Hello from iOS \(index)"

0 commit comments

Comments
 (0)