Skip to content

Commit

Permalink
feat: make height width non required
Browse files Browse the repository at this point in the history
  • Loading branch information
bharat-1809 committed May 21, 2024
1 parent daa6c30 commit bce5916
Show file tree
Hide file tree
Showing 15 changed files with 230 additions and 242 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run: flutter analyze --no-pub

- name: Run Tests
run: flutter test --no-pub --coverage
run: flutter test --update-goldens --no-pub --coverage

- name: Upload coverage to Codecov
if: ${{ matrix.channel == 'stable' }}
Expand Down
2 changes: 1 addition & 1 deletion example/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
<string>12.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '11.0'
# platform :ios, '12.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
6 changes: 3 additions & 3 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/path_provider_foundation/darwin"

SPEC CHECKSUMS:
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943

PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
PODFILE CHECKSUM: c4c93c5f6502fe2754f48404d3594bf779584011

COCOAPODS: 1.12.0
COCOAPODS: 1.15.0
8 changes: 4 additions & 4 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1430;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down Expand Up @@ -343,7 +343,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down Expand Up @@ -420,7 +420,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -469,7 +469,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
54 changes: 28 additions & 26 deletions example/lib/card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,36 +19,38 @@ class BankCard extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(
child: GlassContainer.frostedGlass(
child: SizedBox(
height: 200,
width: 350,
borderRadius: BorderRadius.circular(25.0),
borderWidth: 1.5,
blur: 15.0,
frostedOpacity: 0.06,
gradient: LinearGradient(
colors: [
Colors.white.withOpacity(0.40),
Colors.white.withOpacity(0.06),
],
begin: Alignment(-0.10, -1.0),
end: Alignment(0.00, 1.0),
),
borderGradient: LinearGradient(
child: GlassContainer.frostedGlass(
borderRadius: BorderRadius.circular(25.0),
borderWidth: 1.5,
blur: 15.0,
frostedOpacity: 0.06,
gradient: LinearGradient(
colors: [
Colors.white.withOpacity(0.70),
Colors.white.withOpacity(0.0),
Colors.grey.withOpacity(0.0),
Colors.grey.withOpacity(0.60),
Colors.white.withOpacity(0.40),
Colors.white.withOpacity(0.06),
],
begin: Alignment(0.35, -1.0),
end: Alignment.bottomRight,
stops: [0.0, 0.30, 0.31, 1.0]
// stops: []
),
padding: EdgeInsets.symmetric(horizontal: 25.0, vertical: 25.0),
elevation: 5.0,
child: CardChild(),
begin: Alignment(-0.10, -1.0),
end: Alignment(0.00, 1.0),
),
borderGradient: LinearGradient(
colors: [
Colors.white.withOpacity(0.70),
Colors.white.withOpacity(0.0),
Colors.grey.withOpacity(0.0),
Colors.grey.withOpacity(0.60),
],
begin: Alignment(0.35, -1.0),
end: Alignment.bottomRight,
stops: [0.0, 0.30, 0.31, 1.0]
// stops: []
),
padding: EdgeInsets.symmetric(horizontal: 25.0, vertical: 25.0),
elevation: 5.0,
child: CardChild(),
),
),
);
}
Expand Down
65 changes: 29 additions & 36 deletions example/lib/ios_home/glass_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,41 @@ import 'package:flutter/material.dart';
import 'package:glass_kit/glass_kit.dart';

class GlassWidget extends StatelessWidget {
GlassWidget({
required this.height,
required this.width,
this.child,
});
GlassWidget({this.child});

final double height;
final double width;
final Widget? child;

@override
Widget build(BuildContext context) {
return Center(
child: GlassContainer(
height: height,
width: width,
isFrostedGlass: true,
frostedOpacity: 0.05,
blur: 20,
gradient: LinearGradient(
colors: [
Colors.white.withOpacity(0.25),
Colors.white.withOpacity(0.05),
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
borderGradient: LinearGradient(
colors: [
Colors.white.withOpacity(0.60),
Colors.white.withOpacity(0.0),
Colors.white.withOpacity(0.0),
Colors.white.withOpacity(0.60),
],
stops: [0.0, 0.45, 0.55, 1.0],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
borderRadius: BorderRadius.circular(25.0),
child: child,
padding: EdgeInsets.all(16.0),
return GlassContainer(
isFrostedGlass: true,
frostedOpacity: 0.05,
blur: 20,
gradient: LinearGradient(
colors: [
Colors.white.withOpacity(0.25),
Colors.white.withOpacity(0.05),
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
borderGradient: LinearGradient(
colors: [
Colors.white.withOpacity(0.60),
Colors.white.withOpacity(0.0),
Colors.white.withOpacity(0.0),
Colors.white.withOpacity(0.60),
],
stops: [0.0, 0.45, 0.55, 1.0],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
boxShadow: [
BoxShadow(color: Colors.black.withOpacity(0.10), blurRadius: 20.0)
],
borderRadius: BorderRadius.circular(25.0),
padding: EdgeInsets.all(16.0),
child: child,
);
}
}
16 changes: 4 additions & 12 deletions example/lib/ios_home/ios_home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class IosBody extends StatelessWidget {
children: [
SizedBox(height: 40),
GridView.count(
mainAxisSpacing: 10.0,
mainAxisSpacing: 20.0,
crossAxisSpacing: 20.0,
crossAxisCount: 2,
shrinkWrap: true,
children: [
Expand All @@ -44,7 +45,8 @@ class IosBody extends StatelessWidget {
],
),
SizedBox(height: 20.0),
WeatherWidget()
Flexible(child: WeatherWidget()),
const Spacer(),
],
),
);
Expand All @@ -61,8 +63,6 @@ class TimeWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return GlassWidget(
height: MediaQuery.of(context).size.width * 0.40,
width: MediaQuery.of(context).size.width * 0.40,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start,
Expand All @@ -86,8 +86,6 @@ class BatteryWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return GlassWidget(
height: MediaQuery.of(context).size.width * 0.40,
width: MediaQuery.of(context).size.width * 0.40,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
Expand All @@ -114,8 +112,6 @@ class CalendarWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return GlassWidget(
height: MediaQuery.of(context).size.width * 0.40,
width: MediaQuery.of(context).size.width * 0.40,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
Expand Down Expand Up @@ -151,8 +147,6 @@ class GoogleWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return GlassWidget(
height: MediaQuery.of(context).size.width * 0.40,
width: MediaQuery.of(context).size.width * 0.40,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
Expand Down Expand Up @@ -206,8 +200,6 @@ class WeatherWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return GlassWidget(
height: MediaQuery.of(context).size.width * 0.45,
width: MediaQuery.of(context).size.width * 0.85,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
Expand Down
57 changes: 28 additions & 29 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,42 +21,41 @@ class HomePage extends StatelessWidget {
return Scaffold(
backgroundColor: Colors.black87,
body: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/bg_1.jpg'),
fit: BoxFit.cover,
),
),
child: Center(
child: GlassContainer(
height: 200,
width: 350,
gradient: LinearGradient(
colors: [
Colors.white.withOpacity(0.40),
Colors.white.withOpacity(0.10),
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
borderGradient: LinearGradient(
colors: [
Colors.white.withOpacity(0.60),
Colors.white.withOpacity(0.10),
Colors.purpleAccent.withOpacity(0.05),
Colors.purpleAccent.withOpacity(0.60),
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
stops: [0.0, 0.39, 0.40, 1.0],
),
blur: 20,
borderRadius: BorderRadius.circular(24.0),
borderWidth: 1.0,
elevation: 3.0,
isFrostedGlass: true,
shadowColor: Colors.purple.withOpacity(0.20),
child: GlassContainer(
height: 200,
width: 350,
gradient: LinearGradient(
colors: [
Colors.white.withOpacity(0.40),
Colors.white.withOpacity(0.10),
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
borderGradient: LinearGradient(
colors: [
Colors.white.withOpacity(0.60),
Colors.white.withOpacity(0.10),
Colors.purpleAccent.withOpacity(0.05),
Colors.purpleAccent.withOpacity(0.60),
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
stops: [0.0, 0.39, 0.40, 1.0],
),
blur: 20,
borderRadius: BorderRadius.circular(24.0),
borderWidth: 1.0,
elevation: 3.0,
isFrostedGlass: true,
shadowColor: Colors.purple.withOpacity(0.20),
),
),
);
Expand Down
Loading

0 comments on commit bce5916

Please sign in to comment.