-
Notifications
You must be signed in to change notification settings - Fork 5
[Shapes] - Implement Rectangle widget (resolves #26) #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
matthew-carroll
merged 7 commits into
Flutter-Bounty-Hunters:main
from
suragch:issue_26_rectangle
Jun 12, 2024
Merged
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9c3bfef
implement minimal Rectangle functionality in Flutter
suragch 47fa3d8
completed basic Rectangle functionality
suragch 3bb3b91
cleanup
suragch 6653580
removed shape style
suragch 5844095
resolve all PR review issues besides Alignment
suragch e337cf7
add Alignment enum
suragch 97b5e0e
alignment and rectangle code review adjustments
suragch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
|
@@ -27,3 +27,6 @@ migrate_working_dir/ | |
**/doc/api/ | ||
.dart_tool/ | ||
build/ | ||
|
||
# Don't check in golden failure output. | ||
**/failures/*.png | ||
This file contains hidden or 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,13 @@ | ||
{ | ||
"configurations": [ | ||
{ | ||
"name": "Golden", | ||
"request": "launch", | ||
"type": "dart", | ||
"codeLens": { | ||
"for": ["run-test", "run-test-file"] | ||
}, | ||
"args": ["--update-goldens"] | ||
} | ||
] | ||
} |
This file contains hidden or 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 |
---|---|---|
@@ -1,2 +1,8 @@ | ||
## 0.0.2 | ||
|
||
- Added `HStack` widget. | ||
- Added `VStack` widget. | ||
- Added `Rectangle` widget. | ||
|
||
## 0.0.1 - Sept, 2023 | ||
Setting up the project structure. This release is not usable. |
This file contains hidden or 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 hidden or 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 hidden or 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
36 changes: 36 additions & 0 deletions
36
doc_swift_ui_gallery/swift_ui_gallery/swift_ui_gallery/shapes/RectangleExamples.swift
This file contains hidden or 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,36 @@ | ||
import SwiftUI | ||
|
||
struct RectanglePage: View { | ||
var body: some View { | ||
ScrollView { | ||
VStack(spacing: 20) { | ||
// Rectangle with solid fill | ||
Rectangle() | ||
.fill(Color.blue) | ||
.frame(width: 200, height: 100) | ||
|
||
// Rectangle with gradient fill | ||
Rectangle() | ||
.fill(LinearGradient(gradient: Gradient(colors: [.yellow, .orange]), startPoint: .leading, endPoint: .trailing)) | ||
.frame(width: 200, height: 100) | ||
|
||
// Rectangle with solid stroke | ||
Rectangle() | ||
.stroke(Color.red, lineWidth: 4) | ||
.frame(width: 200, height: 100) | ||
|
||
// Rectangle with gradient stroke | ||
Rectangle() | ||
.stroke(LinearGradient(gradient: Gradient(colors: [.yellow, .blue]), startPoint: .leading, endPoint: .trailing), lineWidth: 14) | ||
.frame(width: 200, height: 100) | ||
} | ||
} | ||
} | ||
} | ||
|
||
struct RectanglePage_Previews: PreviewProvider { | ||
static var previews: some View { | ||
RectanglePage() | ||
} | ||
} | ||
|
21 changes: 21 additions & 0 deletions
21
doc_swift_ui_gallery/swift_ui_gallery/swift_ui_gallery/shapes/ShapesPage.swift
This file contains hidden or 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,21 @@ | ||
import SwiftUI | ||
|
||
struct ShapesPage: View { | ||
var body: some View { | ||
NavigationStack { | ||
List() { | ||
NavigationLink { | ||
RectanglePage() | ||
} label: { | ||
Text("Rectangle") | ||
} | ||
}.navigationTitle("Shapes") | ||
} | ||
} | ||
} | ||
|
||
struct ShapesPage_Previews: PreviewProvider { | ||
static var previews: some View { | ||
ShapesPage() | ||
} | ||
} |
This file contains hidden or 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 hidden or 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,57 @@ | ||
import 'package:flutter/widgets.dart'; | ||
import 'package:swift_ui/swift_ui.dart'; | ||
|
||
class RectangleDemo extends StatelessWidget { | ||
const RectangleDemo({ | ||
super.key, | ||
}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return const VStack( | ||
[ | ||
// Rectangle with solid fill | ||
Frame( | ||
width: 200, | ||
height: 100, | ||
child: Rectangle( | ||
fillColor: Colors.blue, | ||
), | ||
), | ||
|
||
// Rectangle with gradient fill | ||
Frame( | ||
width: 200, | ||
height: 100, | ||
child: Rectangle( | ||
fillGradient: LinearGradient( | ||
colors: [Colors.yellow, Colors.orange], | ||
), | ||
), | ||
), | ||
|
||
// Rectangle with solid stroke | ||
Frame( | ||
width: 200, | ||
height: 100, | ||
child: Rectangle( | ||
strokeColor: Colors.red, | ||
strokeLineWidth: 4.0, | ||
), | ||
), | ||
|
||
// Rectangle with gradient stroke | ||
Frame( | ||
width: 200, | ||
height: 100, | ||
child: Rectangle( | ||
strokeGradient: LinearGradient( | ||
colors: [Colors.yellow, Colors.blue], | ||
), | ||
strokeLineWidth: 14.0, | ||
), | ||
), | ||
], | ||
); | ||
} | ||
} |
This file contains hidden or 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,25 @@ | ||
import 'package:example/demo_screen.dart'; | ||
import 'package:example/infrastructure/inventory_page.dart'; | ||
import 'package:example/shapes/rectangle.dart'; | ||
import 'package:flutter/cupertino.dart'; | ||
|
||
class ShapesPage extends StatelessWidget { | ||
const ShapesPage({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return InventoryPage( | ||
title: "Shapes", | ||
groups: [ | ||
InventoryGroup( | ||
items: [ | ||
InventoryItem( | ||
label: "Rectangle", | ||
pageBuilder: createDemo(const RectangleDemo()), | ||
), | ||
], | ||
), | ||
], | ||
); | ||
} | ||
} |
This file contains hidden or 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
2 changes: 1 addition & 1 deletion
2
example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
This file contains hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.