Skip to content

Commit 106a063

Browse files
committed
fixes
1 parent 3118ee7 commit 106a063

3 files changed

Lines changed: 31 additions & 36 deletions

File tree

add_to_app/ios_content_resizing/flutter_module/lib/main.dart

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ void main() {
99
}
1010

1111
class ResizeApp extends StatefulWidget {
12-
/// Creates the [ResizeApp].
1312
const ResizeApp({super.key});
1413

1514
@override
@@ -26,19 +25,26 @@ class _ResizeAppState extends State<ResizeApp> {
2625

2726
@override
2827
Widget build(BuildContext context) {
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-
),
28+
return Center(
29+
heightFactor: 1,
30+
child: Directionality(
31+
textDirection: TextDirection.ltr,
32+
child: Column(
33+
mainAxisSize: MainAxisSize.min,
34+
children: <Widget>[
35+
for (int i = 0; i < _listSize; i++)
36+
Container(color: HSVColor.fromAHSV(1, (10.0 * i), 1, 1).toColor(), height: 50, width: 200,
37+
child: Center(
38+
child: Text(
39+
'Flutter Widget $i',
40+
style: const TextStyle(fontSize: 16, color: Colors.black),
41+
),
42+
)),
43+
TextButton(
44+
onPressed: _addToList,
45+
child: Text('Listception!'),
46+
)
47+
],
4248
),
4349
),
4450
);

add_to_app/ios_content_resizing/ios_content_resizing/ios_content_resizing.xcodeproj/project.pbxproj

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,15 @@
6565
};
6666
F23EDFE92EE0E81C00A217AA /* ios_content_resizingTests */ = {
6767
isa = PBXFileSystemSynchronizedRootGroup;
68+
exceptions = (
69+
);
6870
path = ios_content_resizingTests;
6971
sourceTree = "<group>";
7072
};
7173
F23EDFF32EE0E81C00A217AA /* ios_content_resizingUITests */ = {
7274
isa = PBXFileSystemSynchronizedRootGroup;
75+
exceptions = (
76+
);
7377
path = ios_content_resizingUITests;
7478
sourceTree = "<group>";
7579
};
@@ -292,11 +296,7 @@
292296
buildActionMask = 2147483647;
293297
files = (
294298
);
295-
inputPaths = (
296-
);
297299
name = "[CP-User] Run Flutter Build flutter_module Script";
298-
outputPaths = (
299-
);
300300
runOnlyForDeploymentPostprocessing = 0;
301301
shellPath = /bin/sh;
302302
shellScript = "set -e\nset -u\nsource \"${SRCROOT}/../flutter_module/.ios/Flutter/flutter_export_environment.sh\"\nexport VERBOSE_SCRIPT_LOGGING=1 && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/xcode_backend.sh build";
@@ -328,11 +328,7 @@
328328
buildActionMask = 2147483647;
329329
files = (
330330
);
331-
inputPaths = (
332-
);
333331
name = "[CP-User] Embed Flutter Build flutter_module Script";
334-
outputPaths = (
335-
);
336332
runOnlyForDeploymentPostprocessing = 0;
337333
shellPath = /bin/sh;
338334
shellScript = "set -e\nset -u\nsource \"${SRCROOT}/../flutter_module/.ios/Flutter/flutter_export_environment.sh\"\nexport VERBOSE_SCRIPT_LOGGING=1 && \"$FLUTTER_ROOT\"/packages/flutter_tools/bin/xcode_backend.sh embed_and_thin";

add_to_app/ios_content_resizing/ios_content_resizing/ios_content_resizing/ViewController.swift

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,19 @@ class ViewController: UIViewController {
1212
let scrollView = UIScrollView()
1313
let stackView = UIStackView()
1414
stackView.axis = .vertical
15-
stackView.spacing = 12 // Spacing between the "cards"
15+
stackView.spacing = 12
1616

17-
let engine1 = FlutterEngine(name: "one")
18-
engine1.run()
17+
let engine = FlutterEngine()
18+
engine.run()
1919

2020
for index in 1...50 {
21-
if index == 10 {
22-
// This is our Flutter view
23-
let flutterViewController = FlutterViewController(engine: engine1, nibName: nil, bundle: nil)
21+
if index == 1 {
22+
let flutterViewController = FlutterViewController(engine: engine, nibName: nil, bundle: nil)
2423
flutterViewController.isAutoResizable = true
2524
addChild(flutterViewController)
26-
27-
// The Flutter view's background should be clear to see the card behind it
25+
2826
flutterViewController.view.backgroundColor = .clear
2927

30-
// Wrap the Flutter view in a styled container "card"
3128
let cardView = UIView()
3229
cardView.backgroundColor = .systemBackground
3330
cardView.layer.cornerRadius = 12
@@ -48,7 +45,7 @@ class ViewController: UIViewController {
4845

4946
} else {
5047
let label = UILabel()
51-
label.text = "It's me, iOS \(index)"
48+
label.text = "iOS Label \(index)"
5249
label.translatesAutoresizingMaskIntoConstraints = false
5350

5451
let cardView = UIView()
@@ -67,26 +64,22 @@ class ViewController: UIViewController {
6764
}
6865
}
6966

70-
// --- Auto Layout Setup ---
7167
scrollView.translatesAutoresizingMaskIntoConstraints = false
7268
stackView.translatesAutoresizingMaskIntoConstraints = false
7369

7470
view.addSubview(scrollView)
7571
scrollView.addSubview(stackView)
7672

77-
// Set constraints for the scroll view to fill the main view
7873
NSLayoutConstraint.activate([
7974
scrollView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor),
8075
scrollView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor),
8176
scrollView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor),
8277
scrollView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor)
8378
])
8479

85-
// Set constraints for the stack view within the scroll view
8680
NSLayoutConstraint.activate([
8781
stackView.topAnchor.constraint(equalTo: scrollView.contentLayoutGuide.topAnchor, constant: 20),
8882
stackView.bottomAnchor.constraint(equalTo: scrollView.contentLayoutGuide.bottomAnchor, constant: -20),
89-
// Inset the stack view horizontally for the grouped look
9083
stackView.leadingAnchor.constraint(equalTo: scrollView.frameLayoutGuide.leadingAnchor, constant: 20),
9184
stackView.trailingAnchor.constraint(equalTo: scrollView.frameLayoutGuide.trailingAnchor, constant: -20)
9285
])

0 commit comments

Comments
 (0)