- Created CMakeLists.txt for Flutter and runner components. - Implemented resource script (Runner.rc) for application metadata. - Developed main entry point (main.cpp) for the Windows application. - Added FlutterWindow class to manage the Flutter view within a Win32 window. - Implemented utility functions for console management and command line argument parsing. - Established Win32Window class for high DPI-aware window handling. - Included application icon and manifest for proper Windows integration. - Set up build configurations and dependencies for the Flutter application on Windows.
198 lines
5.0 KiB
Dart
198 lines
5.0 KiB
Dart
import 'package:marco/helpers/theme/app_theme.dart';
|
|
import 'package:marco/helpers/widgets/my_constant.dart';
|
|
import 'package:marco/helpers/widgets/my_spacing.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class MyContainer extends StatelessWidget {
|
|
final Widget? child;
|
|
final BorderRadius? borderRadius;
|
|
final double? borderRadiusAll, paddingAll, marginAll;
|
|
final EdgeInsetsGeometry? padding, margin;
|
|
final Color? color;
|
|
final Color? borderColor;
|
|
final bool bordered;
|
|
final Border? border;
|
|
final Clip? clipBehavior;
|
|
final BoxShape shape;
|
|
final double? width, height;
|
|
final AlignmentGeometry? alignment;
|
|
final GestureTapCallback? onTap;
|
|
final Color? splashColor;
|
|
final bool enableBorderRadius;
|
|
|
|
const MyContainer(
|
|
{super.key,
|
|
this.child,
|
|
this.borderRadius,
|
|
this.padding,
|
|
this.borderRadiusAll,
|
|
this.paddingAll,
|
|
this.border,
|
|
this.bordered = false,
|
|
this.clipBehavior,
|
|
this.color,
|
|
this.shape = BoxShape.rectangle,
|
|
this.width,
|
|
this.height,
|
|
this.alignment,
|
|
this.enableBorderRadius = true,
|
|
this.onTap,
|
|
this.marginAll,
|
|
this.margin,
|
|
this.splashColor,
|
|
this.borderColor});
|
|
|
|
const MyContainer.transparent(
|
|
{super.key,
|
|
this.child,
|
|
this.borderRadius,
|
|
this.padding,
|
|
this.borderRadiusAll,
|
|
this.paddingAll,
|
|
this.border,
|
|
this.bordered = false,
|
|
this.clipBehavior,
|
|
this.color = Colors.transparent,
|
|
this.shape = BoxShape.rectangle,
|
|
this.width,
|
|
this.height,
|
|
this.alignment,
|
|
this.enableBorderRadius = true,
|
|
this.onTap,
|
|
this.marginAll,
|
|
this.margin,
|
|
this.splashColor,
|
|
this.borderColor});
|
|
|
|
const MyContainer.none(
|
|
{super.key,
|
|
this.child,
|
|
this.borderRadius,
|
|
this.padding,
|
|
this.borderRadiusAll = 0,
|
|
this.paddingAll = 0,
|
|
this.border,
|
|
this.bordered = false,
|
|
this.clipBehavior,
|
|
this.enableBorderRadius = true,
|
|
this.color,
|
|
this.shape = BoxShape.rectangle,
|
|
this.width,
|
|
this.height,
|
|
this.alignment,
|
|
this.onTap,
|
|
this.marginAll,
|
|
this.margin,
|
|
this.splashColor,
|
|
this.borderColor});
|
|
|
|
const MyContainer.bordered(
|
|
{super.key,
|
|
this.child,
|
|
this.borderRadius,
|
|
this.padding,
|
|
this.borderRadiusAll,
|
|
this.paddingAll,
|
|
this.border,
|
|
this.bordered = true,
|
|
this.enableBorderRadius = true,
|
|
this.clipBehavior,
|
|
this.color,
|
|
this.shape = BoxShape.rectangle,
|
|
this.width,
|
|
this.height,
|
|
this.alignment,
|
|
this.onTap,
|
|
this.marginAll,
|
|
this.margin,
|
|
this.splashColor,
|
|
this.borderColor});
|
|
|
|
const MyContainer.roundBordered(
|
|
{super.key,
|
|
this.child,
|
|
this.borderRadius,
|
|
this.padding,
|
|
this.borderRadiusAll,
|
|
this.enableBorderRadius = true,
|
|
this.paddingAll,
|
|
this.border,
|
|
this.bordered = true,
|
|
this.clipBehavior,
|
|
this.color,
|
|
this.shape = BoxShape.circle,
|
|
this.width,
|
|
this.height,
|
|
this.alignment,
|
|
this.onTap,
|
|
this.marginAll,
|
|
this.margin,
|
|
this.splashColor,
|
|
this.borderColor});
|
|
|
|
const MyContainer.rounded(
|
|
{super.key,
|
|
this.child,
|
|
this.borderRadius,
|
|
this.padding,
|
|
this.borderRadiusAll,
|
|
this.enableBorderRadius = true,
|
|
this.paddingAll,
|
|
this.border,
|
|
this.bordered = false,
|
|
this.clipBehavior = Clip.antiAliasWithSaveLayer,
|
|
this.color,
|
|
this.shape = BoxShape.circle,
|
|
this.width,
|
|
this.height,
|
|
this.alignment,
|
|
this.onTap,
|
|
this.marginAll,
|
|
this.margin,
|
|
this.splashColor,
|
|
this.borderColor});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
Widget base = Container(
|
|
width: width,
|
|
height: height,
|
|
alignment: alignment,
|
|
margin: margin ?? MySpacing.all(marginAll ?? 0),
|
|
decoration: BoxDecoration(
|
|
color: color ?? theme.cardTheme.color,
|
|
shape: shape,
|
|
borderRadius: enableBorderRadius
|
|
? (shape == BoxShape.rectangle
|
|
? borderRadius ??
|
|
BorderRadius.all(Radius.circular(borderRadiusAll ??
|
|
MyConstant.constant.containerRadius))
|
|
: null)
|
|
: null,
|
|
border: bordered
|
|
? border ??
|
|
Border.all(color: borderColor ?? theme.dividerColor, width: 1)
|
|
: null),
|
|
padding: padding ?? MySpacing.all(paddingAll ?? 16),
|
|
clipBehavior: clipBehavior ?? Clip.none,
|
|
child: child,
|
|
);
|
|
|
|
if (onTap != null) {
|
|
return InkWell(
|
|
borderRadius: shape != BoxShape.circle
|
|
? borderRadius ??
|
|
BorderRadius.all(Radius.circular(
|
|
borderRadiusAll ?? MyConstant.constant.containerRadius))
|
|
: null,
|
|
onTap: onTap,
|
|
splashColor: splashColor ?? Colors.transparent,
|
|
highlightColor: splashColor ?? Colors.transparent,
|
|
child: base,
|
|
);
|
|
} else {
|
|
return base;
|
|
}
|
|
}
|
|
}
|