Skip to content

Commit 0ecff9c

Browse files
authored
Merge pull request #30 from mafreud/align
Align
2 parents aed0e5d + f9f18de commit 0ecff9c

File tree

6 files changed

+141
-8
lines changed

6 files changed

+141
-8
lines changed

Diff for: assets/gif/align.gif

75.2 KB
Loading

Diff for: ios/Runner.xcodeproj/project.pbxproj

+7-7
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
1414
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
1515
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
16-
CCBB8D61264C283900794153 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = CCBB8D60264C283900794153 /* GoogleService-Info.plist */; };
1716
EB9A640C48010E96F4A69DF4 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1B32906E2026DBB8CE5C56CF /* Pods_Runner.framework */; };
17+
FD29DC90264D5D9F009458BF /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = FD29DC8F264D5D9F009458BF /* GoogleService-Info.plist */; };
1818
/* End PBXBuildFile section */
1919

2020
/* Begin PBXCopyFilesBuildPhase section */
@@ -49,7 +49,7 @@
4949
BFE9409BF44032D11BEFBB45 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
5050
C49CDC99BB445044651092B6 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
5151
CC89EDA1264437AD00BDDCD0 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
52-
CCBB8D60264C283900794153 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
52+
FD29DC8F264D5D9F009458BF /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
5353
/* End PBXFileReference section */
5454

5555
/* Begin PBXFrameworksBuildPhase section */
@@ -105,7 +105,7 @@
105105
97C146F01CF9000F007C117D /* Runner */ = {
106106
isa = PBXGroup;
107107
children = (
108-
CCBB8D60264C283900794153 /* GoogleService-Info.plist */,
108+
FD29DC8F264D5D9F009458BF /* GoogleService-Info.plist */,
109109
CC89EDA1264437AD00BDDCD0 /* Runner.entitlements */,
110110
97C146FA1CF9000F007C117D /* Main.storyboard */,
111111
97C146FD1CF9000F007C117D /* Assets.xcassets */,
@@ -194,7 +194,7 @@
194194
files = (
195195
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
196196
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
197-
CCBB8D61264C283900794153 /* GoogleService-Info.plist in Resources */,
197+
FD29DC90264D5D9F009458BF /* GoogleService-Info.plist in Resources */,
198198
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
199199
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
200200
);
@@ -372,7 +372,7 @@
372372
"$(inherited)",
373373
"@executable_path/Frameworks",
374374
);
375-
MARKETING_VERSION = 1.5.1;
375+
MARKETING_VERSION = 1.6.0;
376376
PRODUCT_BUNDLE_IDENTIFIER = com.flutterproximity;
377377
PRODUCT_NAME = "$(TARGET_NAME)";
378378
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -508,7 +508,7 @@
508508
"$(inherited)",
509509
"@executable_path/Frameworks",
510510
);
511-
MARKETING_VERSION = 1.5.1;
511+
MARKETING_VERSION = 1.6.0;
512512
PRODUCT_BUNDLE_IDENTIFIER = com.flutterproximity;
513513
PRODUCT_NAME = "$(TARGET_NAME)";
514514
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -538,7 +538,7 @@
538538
"$(inherited)",
539539
"@executable_path/Frameworks",
540540
);
541-
MARKETING_VERSION = 1.5.1;
541+
MARKETING_VERSION = 1.6.0;
542542
PRODUCT_BUNDLE_IDENTIFIER = com.flutterproximity;
543543
PRODUCT_NAME = "$(TARGET_NAME)";
544544
PROVISIONING_PROFILE_SPECIFIER = "";

Diff for: lib/app/algolia/algolia_page.dart

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:algolia/algolia.dart';
22
import 'package:flutter/material.dart';
3+
import 'package:proximity/app/align/align_page.dart';
34

45
import '../animated_switcher/animated_switcher.dart';
56
import '../customized_widgets/list_tile_card.dart';
@@ -113,6 +114,10 @@ class _AlgoliaPageState extends State<AlgoliaPage> {
113114

114115
Widget retrieveWidget(String widgetName) {
115116
switch (widgetName) {
117+
case 'Align':
118+
{
119+
return AlignPage();
120+
}
116121
case 'FractionallySizedBox':
117122
{
118123
return FractionallySizedBoxPage();

Diff for: lib/app/align/align_page.dart

+119
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
import 'package:flutter/material.dart';
2+
3+
import '../customized_widgets/custom_app_bar.dart';
4+
5+
class AlignPage extends StatefulWidget {
6+
@override
7+
_AlignPageState createState() => _AlignPageState();
8+
}
9+
10+
enum SampleAlignment {
11+
bottomCenter,
12+
bottomLeft,
13+
bottomRight,
14+
center,
15+
centerLeft,
16+
centerRight,
17+
topCenter,
18+
topLeft,
19+
topRight
20+
}
21+
22+
class _AlignPageState extends State<AlignPage> {
23+
SampleAlignment? _position = SampleAlignment.center;
24+
25+
@override
26+
Widget build(BuildContext context) {
27+
final screenWidth = MediaQuery.of(context).size.width;
28+
final screenHeight = MediaQuery.of(context).size.height;
29+
return Scaffold(
30+
appBar: CustomAppBar(
31+
title: 'Align',
32+
documentUrl: 'https://api.flutter.dev/flutter/widgets/Align-class.html',
33+
videoUrl: 'https://youtu.be/g2E7yl3MwMk',
34+
),
35+
body: Center(
36+
child: Column(
37+
children: [
38+
SizedBox(
39+
height: screenHeight / 17,
40+
),
41+
Flexible(
42+
flex: 1,
43+
child: Container(
44+
decoration: BoxDecoration(
45+
border: Border.all(color: Colors.blue, width: 2),
46+
),
47+
width: screenWidth * 0.4,
48+
height: screenHeight * 0.2,
49+
child: Align(
50+
alignment: getAlignment(_position!),
51+
child: Container(
52+
color: Colors.white,
53+
height: screenWidth / 7,
54+
width: screenWidth / 7,
55+
),
56+
),
57+
),
58+
),
59+
SizedBox(
60+
height: screenHeight / 17,
61+
),
62+
Flexible(
63+
flex: 2,
64+
child: Padding(
65+
padding: EdgeInsets.symmetric(horizontal: screenWidth / 5),
66+
child: Scrollbar(
67+
child: ListView.builder(
68+
shrinkWrap: true,
69+
itemCount: SampleAlignment.values.length,
70+
itemBuilder: (context, index) {
71+
return RadioListTile<SampleAlignment>(
72+
title: Text(SampleAlignment.values[index]
73+
.toString()
74+
.split('.')
75+
.last),
76+
value: SampleAlignment.values[index],
77+
groupValue: _position,
78+
onChanged: (SampleAlignment? value) {
79+
setState(() {
80+
_position = value;
81+
});
82+
},
83+
);
84+
},
85+
),
86+
),
87+
),
88+
)
89+
],
90+
),
91+
),
92+
);
93+
}
94+
95+
Alignment getAlignment(SampleAlignment input) {
96+
switch (input) {
97+
case SampleAlignment.bottomCenter:
98+
return Alignment.bottomCenter;
99+
case SampleAlignment.bottomLeft:
100+
return Alignment.bottomLeft;
101+
case SampleAlignment.bottomRight:
102+
return Alignment.bottomRight;
103+
case SampleAlignment.center:
104+
return Alignment.center;
105+
case SampleAlignment.centerLeft:
106+
return Alignment.centerLeft;
107+
case SampleAlignment.centerRight:
108+
return Alignment.centerRight;
109+
case SampleAlignment.topCenter:
110+
return Alignment.topCenter;
111+
case SampleAlignment.topLeft:
112+
return Alignment.topLeft;
113+
case SampleAlignment.topRight:
114+
return Alignment.topRight;
115+
default:
116+
return Alignment.center;
117+
}
118+
}
119+
}

Diff for: lib/app/home/home_page.dart

+9
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import 'dart:io';
22

33
import 'package:flutter/material.dart';
44
import 'package:flutter_riverpod/flutter_riverpod.dart';
5+
import 'package:proximity/app/align/align_page.dart';
56

67
import '../algolia/algolia_page.dart';
78
import '../animated_switcher/animated_switcher.dart';
@@ -48,6 +49,14 @@ class HomePage extends ConsumerWidget {
4849
body: SingleChildScrollView(
4950
child: Column(
5051
children: [
52+
ListTileCard(
53+
page: AlignPage(),
54+
title: 'Align',
55+
text:
56+
'A widget that aligns its child within itself and optionally sizes itself based on the child\'s size.',
57+
chipList: ['null safety', 'video', 'widget'],
58+
gif: 'assets/gif/align.gif',
59+
),
5160
ListTileCard(
5261
page: FractionallySizedBoxPage(),
5362
title: 'FractionallySizedBox',

Diff for: pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: A new Flutter project.
55
# pub.dev using `pub publish`. This is preferred for private packages.
66
publish_to: "none" # Remove this line if you wish to publish to pub.dev
77

8-
version: 1.5.1+8
8+
version: 1.6.0+9
99

1010
environment:
1111
sdk: ">=2.12.0 <3.0.0"

0 commit comments

Comments
 (0)