Skip to content

Commit

Permalink
add widgets slide, remove inherit
Browse files Browse the repository at this point in the history
  • Loading branch information
werainkhatri committed Dec 4, 2022
1 parent ad6a8a4 commit 6a6844e
Show file tree
Hide file tree
Showing 8 changed files with 157 additions and 9 deletions.
7 changes: 6 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:ppp/slide_scaffold.dart';
import 'package:ppp/slides/about_me.dart';
import 'package:ppp/slides/fractals.dart';
import 'package:ppp/slides/thumbnail.dart';
import 'package:ppp/slides/widgets.dart';
import 'package:ppp/utils/colors.dart';

void main() => runApp(const MyApp());
Expand All @@ -16,11 +17,15 @@ class MyApp extends StatelessWidget {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Material App',
theme: FlexThemeData.dark(colorScheme: ColorScheme.fromSeed(seedColor: C.viren)),
theme: FlexThemeData.dark(
colorScheme: ColorScheme.fromSeed(seedColor: C.viren),
applyElevationOverlayColor: true,
),
home: SlideScaffold(
slides: [
const Thumbnail(),
for (int i in [0, 1, 2]) Fractals(state: i),
const Widgets(),
const AboutMe(),
],
),
Expand Down
2 changes: 1 addition & 1 deletion lib/slide_scaffold.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class _SlideScaffoldState extends State<SlideScaffold> {
initialRoute: _currentSlide.toString(),
onGenerateRoute: (settings) => PageRouteBuilder(
pageBuilder: (context, animation1, animation2) => DefaultTextStyle(
style: GoogleFonts.openSans(fontWeight: FontWeight.w600),
style: GoogleFonts.rubik(fontWeight: FontWeight.w600),
child: F.getSlideFromName(settings.name, widget.slides),
),
transitionsBuilder: (context, animation, secondaryAnimation, child) {
Expand Down
6 changes: 3 additions & 3 deletions lib/slides/about_me.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class AboutMe extends StatelessWidget {
children: [
Row(
children: const [
Text('Viren Khatri', style: TextStyle(fontSize: 50, inherit: true)),
Text('Viren Khatri', style: TextStyle(fontSize: 50)),
SizedBox(width: 10),
NullSafety(),
Spacer(),
Expand All @@ -28,7 +28,7 @@ class AboutMe extends StatelessWidget {
],
),
const SizedBox(height: 20),
const Text(S.oneLineAboutMe, style: TextStyle(fontSize: 20, inherit: true)),
const Text(S.oneLineAboutMe, style: TextStyle(fontSize: 20)),
const SizedBox(height: 50),
LayoutBuilder(builder: (_, constraints) {
final List<Widget> children = [
Expand Down Expand Up @@ -72,7 +72,7 @@ class _YouCanFindMe extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
Text('You can find me', style: TextStyle(fontSize: 30, inherit: true)),
Text('You can find me', style: TextStyle(fontSize: 30)),
SizedBox(height: 15),
LinkText(text: 'on YouTube', url: S.youtubeUrl),
Text('livestreaming my flutter contributions ⏯.'),
Expand Down
46 changes: 46 additions & 0 deletions lib/slides/widgets.dart
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),
),
),
],
);
});
}
}
49 changes: 49 additions & 0 deletions lib/widgets/fancy_container.dart
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,
),
),
),
),
);
}
}
34 changes: 34 additions & 0 deletions lib/widgets/fancy_elevated_button.dart
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),
),
),
);
}
}
17 changes: 17 additions & 0 deletions lib/widgets/fancy_image.dart
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,
);
}
}
5 changes: 1 addition & 4 deletions lib/widgets/link_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ class _LinkTextState extends State<LinkText> {
child: GestureDetector(
child: Text(
widget.text,
style: TextStyle(
color: isHovering ? C.flutterBlue : Colors.lightBlue,
inherit: true,
),
style: TextStyle(color: isHovering ? C.flutterBlue : Colors.lightBlue),
),
),
);
Expand Down

0 comments on commit 6a6844e

Please sign in to comment.