-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ad6a8a4
commit 6a6844e
Showing
8 changed files
with
157 additions
and
9 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
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,46 @@ | ||
import 'dart:math'; | ||
|
||
import 'package:flutter/material.dart'; | ||
import 'package:ppp/widgets/fancy_container.dart'; | ||
import 'package:ppp/widgets/fancy_elevated_button.dart'; | ||
import 'package:ppp/widgets/fancy_image.dart'; | ||
|
||
class Widgets extends StatelessWidget { | ||
const Widgets({Key? key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return LayoutBuilder(builder: (context, constraints) { | ||
double minDim = min(constraints.maxHeight, constraints.maxWidth); | ||
|
||
return Stack( | ||
children: [ | ||
Positioned( | ||
top: minDim / 15, | ||
left: minDim / 15, | ||
child: FancyContainer(size: minDim), | ||
), | ||
Positioned( | ||
top: minDim / 5, | ||
right: minDim / 5, | ||
child: FancyElevatedButton(size: minDim), | ||
), | ||
Positioned( | ||
bottom: minDim / 10, | ||
left: constraints.maxWidth / 8, | ||
child: FancyImage( | ||
height: constraints.maxHeight, | ||
width: constraints.maxWidth, | ||
), | ||
), | ||
Center( | ||
child: Text( | ||
'Widgets', | ||
style: TextStyle(fontSize: constraints.maxWidth / 7), | ||
), | ||
), | ||
], | ||
); | ||
}); | ||
} | ||
} |
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,49 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class FancyContainer extends StatelessWidget { | ||
const FancyContainer({Key? key, required this.size}) : super(key: key); | ||
|
||
final double size; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Container( | ||
decoration: BoxDecoration( | ||
border: Border.all( | ||
color: Theme.of(context).colorScheme.inverseSurface, | ||
width: size / 75, | ||
strokeAlign: StrokeAlign.center, | ||
), | ||
gradient: LinearGradient( | ||
colors: [ | ||
Theme.of(context).colorScheme.primary, | ||
Theme.of(context).colorScheme.inversePrimary, | ||
], | ||
begin: Alignment.topLeft, | ||
end: Alignment.bottomRight, | ||
), | ||
shape: BoxShape.circle, | ||
boxShadow: [ | ||
BoxShadow( | ||
offset: Offset(size / 30, size / 30), | ||
color: Theme.of(context).colorScheme.secondary, | ||
blurRadius: 10, | ||
blurStyle: BlurStyle.outer, | ||
), | ||
], | ||
), | ||
child: SizedBox.square( | ||
dimension: size / 3.5, | ||
child: Center( | ||
child: Text( | ||
'Container', | ||
style: TextStyle( | ||
color: Theme.of(context).colorScheme.onPrimaryContainer, | ||
fontSize: size / 25, | ||
), | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
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,34 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class FancyElevatedButton extends StatelessWidget { | ||
const FancyElevatedButton({super.key, required this.size}); | ||
|
||
final double size; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return ElevatedButton( | ||
onPressed: () {}, | ||
style: ElevatedButton.styleFrom( | ||
visualDensity: VisualDensity.standard, | ||
shape: BeveledRectangleBorder( | ||
side: BorderSide( | ||
color: Theme.of(context).colorScheme.inverseSurface, | ||
width: size / 200, | ||
strokeAlign: StrokeAlign.center, | ||
), | ||
borderRadius: BorderRadius.circular(size / 30), | ||
), | ||
shadowColor: Theme.of(context).colorScheme.primaryContainer, | ||
elevation: 20, | ||
), | ||
child: Padding( | ||
padding: EdgeInsets.all(size / 50), | ||
child: Text( | ||
'ElevatedButton', | ||
style: TextStyle(fontSize: size / 20), | ||
), | ||
), | ||
); | ||
} | ||
} |
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,17 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class FancyImage extends StatelessWidget { | ||
const FancyImage({super.key, required this.width, required this.height}); | ||
|
||
final double width, height; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Image.network( | ||
'https://picsum.photos/${width * 3 ~/ 4}/${height * 2.3 ~/ 10}', | ||
color: Theme.of(context).colorScheme.primary, | ||
colorBlendMode: BlendMode.overlay, | ||
filterQuality: FilterQuality.high, | ||
); | ||
} | ||
} |
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