Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • android/org.benoitharrault.puzzlegame
1 result
Show changes
Showing
with 19 additions and 317 deletions
import 'package:flutter_custom_toolbox/flutter_toolbox.dart';
import 'package:puzzlegame/config/default_game_settings.dart';
import 'package:puzzlegame/utils/tools.dart';
class GameSettings {
final String tilesetSize;
......
import 'package:flutter_custom_toolbox/flutter_toolbox.dart';
import 'package:puzzlegame/config/default_global_settings.dart';
import 'package:puzzlegame/utils/tools.dart';
class GlobalSettings {
String skin;
......
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_custom_toolbox/flutter_toolbox.dart';
import 'package:puzzlegame/cubit/game_cubit.dart';
import 'package:puzzlegame/models/game/game.dart';
......
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_custom_toolbox/flutter_toolbox.dart';
import 'package:puzzlegame/cubit/game_cubit.dart';
import 'package:puzzlegame/models/game/game.dart';
......
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_custom_toolbox/flutter_toolbox.dart';
import 'package:puzzlegame/cubit/game_cubit.dart';
import 'package:puzzlegame/models/game/game.dart';
......
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
class AppHeader extends StatelessWidget {
const AppHeader({super.key, required this.text});
final String text;
@override
Widget build(BuildContext context) {
return Text(
tr(text),
textAlign: TextAlign.start,
style: Theme.of(context).textTheme.headlineMedium!.apply(fontWeightDelta: 2),
);
}
}
class AppTitle extends StatelessWidget {
const AppTitle({super.key, required this.text});
final String text;
@override
Widget build(BuildContext context) {
return Text(
tr(text),
textAlign: TextAlign.start,
style: Theme.of(context).textTheme.titleLarge!.apply(fontWeightDelta: 2),
);
}
}
import 'package:flutter/material.dart';
import 'package:puzzlegame/utils/color_extensions.dart';
class OutlinedText extends StatelessWidget {
const OutlinedText({
super.key,
required this.text,
required this.fontSize,
required this.textColor,
this.outlineColor,
});
final String text;
final double fontSize;
final Color textColor;
final Color? outlineColor;
@override
Widget build(BuildContext context) {
final double delta = fontSize / 30;
return Text(
text,
style: TextStyle(
inherit: true,
fontSize: fontSize,
fontWeight: FontWeight.w600,
color: textColor,
shadows: [
Shadow(
offset: Offset(-delta, -delta),
color: outlineColor ?? textColor.darken(),
),
Shadow(
offset: Offset(delta, -delta),
color: outlineColor ?? textColor.darken(),
),
Shadow(
offset: Offset(delta, delta),
color: outlineColor ?? textColor.darken(),
),
Shadow(
offset: Offset(-delta, delta),
color: outlineColor ?? textColor.darken(),
),
],
),
);
}
}
import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/material.dart';
import 'package:puzzlegame/utils/color_extensions.dart';
class StyledButton extends StatelessWidget {
const StyledButton({
super.key,
required this.color,
required this.onPressed,
this.onLongPress,
required this.child,
});
final Color color;
final VoidCallback? onPressed;
final VoidCallback? onLongPress;
final Widget child;
factory StyledButton.text({
Key? key,
required VoidCallback? onPressed,
VoidCallback? onLongPress,
required String caption,
required Color color,
}) {
final Widget captionWidget = AutoSizeText(
caption,
maxLines: 1,
style: TextStyle(
inherit: true,
fontWeight: FontWeight.w900,
color: color.darken(60),
shadows: [
Shadow(
blurRadius: 5.0,
color: color.lighten(60),
offset: const Offset(2, 2),
),
Shadow(
blurRadius: 5.0,
color: color.lighten(60),
offset: const Offset(2, -2),
),
Shadow(
blurRadius: 5.0,
color: color.lighten(60),
offset: const Offset(-2, 2),
),
Shadow(
blurRadius: 5.0,
color: color.lighten(60),
offset: const Offset(-2, -2),
),
],
),
);
return StyledButton(
color: color,
onPressed: onPressed,
onLongPress: onLongPress,
child: captionWidget,
);
}
factory StyledButton.icon({
Key? key,
required VoidCallback? onPressed,
VoidCallback? onLongPress,
required Icon icon,
required Color color,
required double iconSize,
}) {
return StyledButton(
color: color,
onPressed: onPressed,
onLongPress: onLongPress,
child: Icon(
icon.icon,
color: icon.color ?? color.darken(60),
size: iconSize,
shadows: [
Shadow(
blurRadius: 5.0,
color: color.lighten(60),
offset: const Offset(2, 2),
),
Shadow(
blurRadius: 5.0,
color: color.lighten(60),
offset: const Offset(2, -2),
),
Shadow(
blurRadius: 5.0,
color: color.lighten(60),
offset: const Offset(-2, 2),
),
Shadow(
blurRadius: 5.0,
color: color.lighten(60),
offset: const Offset(-2, -2),
),
],
),
);
}
@override
Widget build(BuildContext context) {
const double borderWidth = 4;
final Color borderColor = color.darken(40);
const double borderRadius = 10;
return Container(
margin: const EdgeInsets.all(2),
padding: const EdgeInsets.all(2),
decoration: BoxDecoration(
color: color,
border: Border.all(
color: borderColor,
width: borderWidth,
),
borderRadius: BorderRadius.circular(borderRadius),
),
child: CustomPaint(
painter: StyledButtonPainter(
baseColor: color,
),
child: MaterialButton(
onPressed: onPressed,
onLongPress: onLongPress,
padding: const EdgeInsets.all(8),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
minWidth: 40,
child: child,
),
),
);
}
}
class StyledButtonPainter extends CustomPainter {
StyledButtonPainter({
required this.baseColor,
});
final Color baseColor;
@override
void paint(Canvas canvas, Size size) {
final Color lightColor = baseColor.lighten(20);
final Color darkColor = baseColor.darken(20);
final Paint paint = Paint()..style = PaintingStyle.fill;
const double cornerRadius = 6;
Path topPath = Path()
..moveTo(cornerRadius, 0)
..lineTo(size.width - cornerRadius, 0)
..arcToPoint(
Offset(size.width, cornerRadius),
radius: const Radius.circular(cornerRadius),
)
..lineTo(size.width, size.height * .35)
..quadraticBezierTo(
size.width * .4,
size.height * .1,
0,
size.height * .3,
)
..lineTo(0, cornerRadius)
..arcToPoint(
const Offset(cornerRadius, 0),
radius: const Radius.circular(cornerRadius),
);
Path bottomPath = Path()
..moveTo(cornerRadius, size.height)
..lineTo(size.width - cornerRadius, size.height)
..arcToPoint(
Offset(size.width, size.height - cornerRadius),
radius: const Radius.circular(cornerRadius),
clockwise: false,
)
..lineTo(size.width, size.height * .7)
..quadraticBezierTo(
size.width * .6,
size.height * .9,
0,
size.height * .7,
)
..lineTo(0, size.height - cornerRadius)
..arcToPoint(
Offset(cornerRadius, size.height),
radius: const Radius.circular(cornerRadius),
clockwise: false,
);
paint.color = lightColor;
canvas.drawPath(topPath, paint);
paint.color = darkColor;
canvas.drawPath(bottomPath, paint);
}
@override
bool shouldRepaint(CustomPainter oldDelegate) => false;
}
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_custom_toolbox/flutter_toolbox.dart';
import 'package:puzzlegame/cubit/game_cubit.dart';
import 'package:puzzlegame/models/game/game.dart';
......
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_custom_toolbox/flutter_toolbox.dart';
import 'package:puzzlegame/config/default_game_settings.dart';
import 'package:puzzlegame/config/default_global_settings.dart';
......
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter_custom_toolbox/flutter_toolbox.dart';
import 'package:puzzlegame/config/default_game_settings.dart';
import 'package:puzzlegame/models/settings/settings_game.dart';
import 'package:puzzlegame/models/settings/settings_global.dart';
import 'package:puzzlegame/utils/tools.dart';
class ParameterPainter extends CustomPainter {
const ParameterPainter({
......
import 'package:flutter/material.dart';
import 'package:flutter_custom_toolbox/flutter_toolbox.dart';
import 'package:puzzlegame/config/default_game_settings.dart';
import 'package:puzzlegame/config/default_global_settings.dart';
import 'package:puzzlegame/models/settings/settings_game.dart';
import 'package:puzzlegame/models/settings/settings_global.dart';
import 'package:puzzlegame/ui/helpers/styled_button.dart';
import 'package:puzzlegame/ui/parameters/parameter_painter.dart';
import 'package:puzzlegame/utils/tools.dart';
class ParameterWidget extends StatelessWidget {
const ParameterWidget({
......
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:puzzlegame/ui/helpers/app_titles.dart';
import 'package:flutter_custom_toolbox/flutter_toolbox.dart';
class PageAbout extends StatelessWidget {
const PageAbout({super.key});
......
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_custom_toolbox/flutter_toolbox.dart';
import 'package:puzzlegame/cubit/game_cubit.dart';
import 'package:puzzlegame/models/game/game.dart';
......
import 'package:flutter/material.dart';
import 'package:flutter_custom_toolbox/flutter_toolbox.dart';
import 'package:puzzlegame/ui/helpers/app_titles.dart';
import 'package:puzzlegame/ui/settings/settings_form.dart';
class PageSettings extends StatelessWidget {
......
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:unicons/unicons.dart';
import 'package:flutter_custom_toolbox/flutter_toolbox.dart';
import 'package:puzzlegame/ui/settings/theme_card.dart';
......
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_custom_toolbox/flutter_toolbox.dart';
import 'package:puzzlegame/cubit/theme_cubit.dart';
......
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_custom_toolbox/flutter_toolbox.dart';
import 'package:puzzlegame/config/menu.dart';
import 'package:puzzlegame/cubit/nav_cubit.dart';
......
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_custom_toolbox/flutter_toolbox.dart';
import 'package:puzzlegame/cubit/game_cubit.dart';
import 'package:puzzlegame/ui/helpers/styled_button.dart';
class DeleteSavedGameButton extends StatelessWidget {
const DeleteSavedGameButton({super.key});
......
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_custom_toolbox/flutter_toolbox.dart';
import 'package:puzzlegame/cubit/game_cubit.dart';
import 'package:puzzlegame/ui/helpers/styled_button.dart';
class QuitGameButton extends StatelessWidget {
const QuitGameButton({super.key});
......