-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
ef6b2e7
commit 70ac28f
Showing
31 changed files
with
824 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Validate pull requests | ||
on: [pull_request] | ||
jobs: | ||
analyze: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: ./ | ||
steps: | ||
# Checkout the PR branch | ||
- uses: actions/checkout@v3 | ||
|
||
# Setup Flutter environment | ||
- uses: subosito/flutter-action@v2 | ||
with: | ||
channel: "stable" | ||
architecture: x64 | ||
|
||
# Download all the packages that the app uses | ||
- run: flutter pub get | ||
|
||
# Enforce lint rules | ||
- run: flutter analyze | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: ./ | ||
steps: | ||
# Checkout the PR branch | ||
- uses: actions/checkout@v3 | ||
|
||
# Setup Flutter environment | ||
- uses: subosito/flutter-action@v2 | ||
with: | ||
channel: "stable" | ||
architecture: x64 | ||
|
||
# Download all the packages that the app uses | ||
- run: flutter pub get | ||
|
||
# Run all tests | ||
- run: flutter test --exclude-tags=golden | ||
|
||
test-goldens: | ||
runs-on: macos-latest | ||
defaults: | ||
run: | ||
working-directory: ./ | ||
steps: | ||
# Checkout the PR branch | ||
- uses: actions/checkout@v3 | ||
|
||
# Setup Flutter environment | ||
- uses: subosito/flutter-action@v2 | ||
with: | ||
channel: "stable" | ||
architecture: x64 | ||
|
||
# Download all the packages that the app uses | ||
- run: flutter pub get | ||
|
||
# Run all tests | ||
- run: flutter test --tags=golden |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
tags: | ||
golden: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
doc_swift_ui_gallery/swift_ui_gallery/swift_ui_gallery/layouts/HStackExamples.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import SwiftUI | ||
|
||
struct HStackLeadingAlignedPage : View { | ||
var body: some View { | ||
HStack(alignment: .top) { | ||
Text("First\nSecond") | ||
Text("Third") | ||
Text("Fourth\nFifth\nSixth") | ||
} | ||
} | ||
} | ||
|
||
struct HStackCenterAlignedPage : View { | ||
var body: some View { | ||
HStack(alignment: .center) { | ||
Text("First\nSecond") | ||
Text("Third") | ||
Text("Fourth\nFifth\nSixth") | ||
} | ||
} | ||
} | ||
|
||
struct HStackTrailingAlignedPage : View { | ||
var body: some View { | ||
HStack(alignment: .bottom) { | ||
Text("First\nSecond") | ||
Text("Third") | ||
Text("Fourth\nFifth\nSixth") | ||
} | ||
} | ||
} | ||
|
||
struct HStackExceedsAvailableSpacePage : View { | ||
var body: some View { | ||
HStack() { | ||
Rectangle() | ||
.foregroundColor(Color.red) | ||
.frame(width: 100, height: .infinity) | ||
Rectangle() | ||
.foregroundColor(Color.green) | ||
.frame(width: 100, height: .infinity) | ||
Rectangle() | ||
.foregroundColor(Color.blue) | ||
.frame(width: 100, height: .infinity) | ||
Rectangle() | ||
.foregroundColor(Color.purple) | ||
.frame(width: 100, height: .infinity) | ||
Rectangle() | ||
.foregroundColor(Color.orange) | ||
.frame(width: 100, height: .infinity) | ||
Rectangle() | ||
.foregroundColor(Color.cyan) | ||
.frame(width: 100, height: .infinity) | ||
} | ||
} | ||
} | ||
|
||
|
||
struct HStackTopAlignedPage_Previews: PreviewProvider { | ||
static var previews: some View { | ||
HStackLeadingAlignedPage() | ||
// HStackCenterAlignedPage() | ||
// HStackTrailingAlignedPage() | ||
// HStackExceedsAvailableSpacePage() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
doc_swift_ui_gallery/swift_ui_gallery/swift_ui_gallery/layouts/ZStackExamples.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import SwiftUI | ||
|
||
struct ZStackStaggeredSquares : View { | ||
let colors: [Color] = | ||
[.red, .orange, .yellow, .green, .blue, .purple] | ||
|
||
var body: some View { | ||
ZStack { | ||
ForEach(0..<colors.count) { | ||
Rectangle() | ||
.fill(colors[$0]) | ||
.frame(width: 100, height: 100) | ||
.offset(x: CGFloat($0) * 10.0, | ||
y: CGFloat($0) * 10.0) | ||
} | ||
} | ||
} | ||
} | ||
|
||
struct ZStackTopAlignedPage_Previews: PreviewProvider { | ||
static var previews: some View { | ||
ZStackStaggeredSquares() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import 'package:flutter/cupertino.dart'; | ||
|
||
WidgetBuilder createDemo(Widget child) { | ||
return (BuildContext context) { | ||
return DemoScreen(child: child); | ||
}; | ||
} | ||
|
||
class DemoScreen extends StatelessWidget { | ||
const DemoScreen({ | ||
super.key, | ||
required this.child, | ||
}); | ||
|
||
final Widget child; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return CupertinoPageScaffold( | ||
navigationBar: const CupertinoNavigationBar(), | ||
child: SafeArea( | ||
child: child, | ||
), | ||
); | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.