Skip to content

Commit

Permalink
Merge branch 'chore/mix-code-gen'
Browse files Browse the repository at this point in the history
  • Loading branch information
leoafarias committed Jul 24, 2024
2 parents c698a62 + 243a181 commit 94e03a4
Show file tree
Hide file tree
Showing 57 changed files with 2,919 additions and 1,862 deletions.
3 changes: 1 addition & 2 deletions .fvmrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"flutter": "stable",
"flavors": {}
"flutter": "stable"
}
7 changes: 1 addition & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,7 @@ migrate_working_dir/

# Ignoring native folders of the example as they can be re-generated easily using:
# flutter create --platforms=android,ios,web,windows,macos .
**/example/android/
**/example/ios/
**/example/web/
**/example/windows/
**/example/macos/
**/example/linux/


# Flutter/Dart/Pub related
**/doc/api/
Expand Down
22 changes: 21 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,25 @@
"search.exclude": {
"**/.fvm/versions": true,
"**/.fvm/flutter_sdk": true
}
},
"workbench.colorCustomizations": {
"activityBar.activeBackground": "#2f7c47",
"activityBar.background": "#2f7c47",
"activityBar.foreground": "#e7e7e7",
"activityBar.inactiveForeground": "#e7e7e799",
"activityBarBadge.background": "#422c74",
"activityBarBadge.foreground": "#e7e7e7",
"commandCenter.border": "#e7e7e799",
"sash.hoverBorder": "#2f7c47",
"statusBar.background": "#215732",
"statusBar.foreground": "#e7e7e7",
"statusBarItem.hoverBackground": "#2f7c47",
"statusBarItem.remoteBackground": "#215732",
"statusBarItem.remoteForeground": "#e7e7e7",
"titleBar.activeBackground": "#215732",
"titleBar.activeForeground": "#e7e7e7",
"titleBar.inactiveBackground": "#21573299",
"titleBar.inactiveForeground": "#e7e7e799"
},
"peacock.color": "#215732"
}
3 changes: 0 additions & 3 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ analyzer:
plugins:
- custom_lint
exclude:
- '**.freezed.dart'
- '**.g.dart'
- '**.gr.dart'
- '**.mapper.dart'
- '**/generated_plugin_registrant.dart'
linter:
Expand Down
Binary file modified assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 14 additions & 1 deletion build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,20 @@ targets:
builders:
dart_mappable_builder:
generate_for:
- lib/**/*.dart
- lib/**/*_model.dart
mix_generator|spec:
generate_for:
- lib/**/*_spec.dart
mix_generator|dto:
generate_for:
- lib/**/*_spec.dart
mix_generator|enum_utility:
generate_for:
- lib/**/*_spec.dart
mix_generator|class_utility:
generate_for:
- lib/**/*_spec.dart

global_options:
dart_mappable_builder:
options:
Expand Down
131 changes: 73 additions & 58 deletions example/lib/src/style.dart
Original file line number Diff line number Diff line change
@@ -1,98 +1,113 @@
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:superdeck/styles/style_util.dart';
import 'package:superdeck/superdeck.dart';

final _util = SlideSpecUtility.self;
final _h1 = _util.h1;
final _h2 = _util.h2;
final _h3 = _util.h3;

final _h6 = _util.h6;

final _paragraph = _util.paragraph;

final _code = _util.code;
final _blockquote = _util.blockquote;

final _outerContainer = _util.outerContainer;
final _contentContainer = _util.contentContainer;

final _textStyle = _util.textStyle;
final _innerContainer = _util.innerContainer;

VariantAttribute get radStyle {
return const SlideVariant('rad')(
$deck.h1.textStyle.as(GoogleFonts.poppins()),
$deck.h1.textStyle.fontSize(140),
$deck.code.decoration.border.all(
color: Colors.red,
width: 3,
_h1.textStyle.as(GoogleFonts.poppins()),
_h1.textStyle.fontSize(140),
_code.decoration.border.all(
color: Colors.white,
width: 1,
),
$deck.code.decoration(
color: Colors.black54,
),
$deck.code.padding.all(40),

$deck.outerContainer.margin.all(60),

$deck.innerContainer.borderRadius(25),
$deck.innerContainer.shadow(
_code.decoration.color.black(),
_code.padding.all(40),
_outerContainer.margin.all(60),
_innerContainer.borderRadius(25),
_innerContainer.shadow(
blurRadius: 0,
spreadRadius: 10,
color: Colors.red.withOpacity(1),
),
$deck.innerContainer.gradient.radial(
_innerContainer.gradient.radial(
stops: [0.0, 1.0],
radius: 0.7,
colors: [Colors.purple, Colors.deepPurple],
),

// Events
$on.focus(
_innerContainer.color.yellow(),
),
$on.hover.event((e) {
if (e == null) return const Style.empty();
final position = e.position;
final dx = position.x * 10;
final dy = position.y * 10;

return Style(
$deck.innerContainer.transform(_transformMatrix(position)),
$deck.innerContainer.shadow.offset(dx, dy),
$deck.innerContainer.gradient.radial(
_innerContainer.transform(_transformMatrix(position)),
_innerContainer.shadow.offset(dx, dy),
_innerContainer.gradient.radial(
center: position,
),
);
}),

($on.press | $on.longPress)(
$deck.innerContainer.shadow(
_innerContainer.shadow(
blurRadius: 5,
spreadRadius: 1,
offset: Offset.zero,
color: Colors.purpleAccent,
),
$deck.innerContainer.border.all(color: Colors.white, width: 1),
$deck.innerContainer.gradient.radial
_innerContainer.border.all(color: Colors.white, width: 1),
_innerContainer.gradient.radial
.colors([Colors.purpleAccent, Colors.purpleAccent]),
),
);
}

VariantAttribute get customStyle {
return const SlideVariant('custom')(
$deck.textStyle.as(GoogleFonts.poppins()),
$deck.h1.textStyle.as(GoogleFonts.smooch()),
$deck.h1.textStyle.fontSize(200),
$deck.h1.textStyle.height(0),
$deck.h1.textStyle.shadow(
_textStyle.as(GoogleFonts.poppins()),
_h1.textStyle.as(GoogleFonts.smooch()),
_h1.textStyle.fontSize(200),
_h1.textStyle.height(0),
_h1.textStyle.shadow(
color: Colors.deepOrange,
blurRadius: 20,
),
$deck.h2.textStyle.fontSize(36),
$deck.contentContainer.borderRadius(25),
$deck.innerContainer.gradient.linear(
_h2.textStyle.fontSize(36),
_contentContainer.borderRadius(25),
_innerContainer.gradient.linear(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Colors.black.withOpacity(0.5),
Colors.deepPurple.withOpacity(0.9),
],
),
$deck.contentContainer.padding.vertical(0),
$deck.outerContainer.padding(40),
$deck.outerContainer.gradient.linear(
_contentContainer.padding.vertical(0),
_outerContainer.padding(40),
_outerContainer.gradient.linear(
colors: [
Colors.red,
Colors.redAccent,
],
),
$deck.innerContainer.borderRadius(25),
$deck.innerContainer.border.all(
_innerContainer.borderRadius(25),
_innerContainer.border.all(
color: Colors.deepOrange,
width: 4,
),
$deck.innerContainer.shadow(
_innerContainer.shadow(
color: Colors.black.withOpacity(0.4),
blurRadius: 20,
spreadRadius: 5,
Expand All @@ -102,9 +117,9 @@ VariantAttribute get customStyle {

VariantAttribute get coverStyle {
return const SlideVariant('cover')(
$deck.h1.textStyle.as(GoogleFonts.poppins()),
$deck.h1.textStyle.fontSize(100),
$deck.contentContainer.gradient.linear(
_h1.textStyle.as(GoogleFonts.poppins()),
_h1.textStyle.fontSize(100),
_contentContainer.gradient.linear(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Expand All @@ -117,15 +132,15 @@ VariantAttribute get coverStyle {

VariantAttribute get announcementStyle {
return const SlideVariant('announcement')(
$deck.textStyle.height(0.6),
$deck.h1.textStyle.fontSize(140),
$deck.h1.textStyle.bold(),
$deck.h1.textStyle.color(Colors.yellow),
$deck.h2.textStyle.fontSize(140),
$deck.h3.textStyle.fontSize(60),
$deck.h3.textStyle.color(Colors.white),
$deck.h3.textStyle.fontWeight(FontWeight.w100),
$deck.contentContainer.gradient.linear(
_textStyle.height(0.6),
_h1.textStyle.fontSize(140),
_h1.textStyle.bold(),
_h1.textStyle.color(Colors.yellow),
_h2.textStyle.fontSize(140),
_h3.textStyle.fontSize(60),
_h3.textStyle.color(Colors.white),
_h3.textStyle.fontWeight(FontWeight.w100),
_contentContainer.gradient.linear(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Expand All @@ -138,20 +153,20 @@ VariantAttribute get announcementStyle {

VariantAttribute get quoteStyle {
return const SlideVariant('quote')(
$deck.blockquote.textStyle.as(GoogleFonts.notoSerif()),
$deck.blockquote.decoration.border.left(
_blockquote.textStyle.as(GoogleFonts.notoSerif()),
_blockquote.decoration.border.left(
width: 4,
color: Colors.red,
),
$deck.paragraph.textStyle.fontSize(32),
$deck.h6.textStyle.as(GoogleFonts.notoSerif()),
$deck.h6.textStyle.fontSize(20),
_paragraph.textStyle.fontSize(32),
_h6.textStyle.as(GoogleFonts.notoSerif()),
_h6.textStyle.fontSize(20),
);
}

VariantAttribute get showSectionsStyle {
return const SlideVariant('show_sections')(
$deck.contentContainer.border.all(
_contentContainer.border.all(
color: Colors.blue,
width: 2,
),
Expand All @@ -160,14 +175,14 @@ VariantAttribute get showSectionsStyle {

Style get style {
return Style(
$deck.textStyle.as(GoogleFonts.poppins()),
_textStyle.as(GoogleFonts.poppins()),
customStyle,
quoteStyle,
showSectionsStyle,
coverStyle,
announcementStyle,
radStyle,
);
).animate();
}

Matrix4 _transformMatrix(Alignment alignment) {
Expand Down
9 changes: 6 additions & 3 deletions example/lib/src/widget/mix_demo.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'dart:math' as math;

import 'package:flutter/material.dart';
import 'package:superdeck/schema/schema.dart';
import 'package:superdeck/schema/schema_model.dart';
import 'package:superdeck/superdeck.dart';

const purpleAccent = Color.fromARGB(255, 95, 44, 188);
Expand Down Expand Up @@ -51,6 +51,10 @@ Style get _style => Style(
);
}),

$on.hover(
$box.color.black(),
),

($on.press | $on.longPress)(
$box.shadow(
blurRadius: 5,
Expand Down Expand Up @@ -110,8 +114,7 @@ class MixExample extends ExampleWidget<ExampleOptions> {
Widget build(ExampleOptions args) {
return Builder(builder: (context) {
return Center(
child: PressableBox(
onPress: () {},
child: Box(
style: Style(
_style(),
$box.height(args.height),
Expand Down
Loading

0 comments on commit 94e03a4

Please sign in to comment.