Vaibhav Surve 99902e743c Flutter application
- Created generated_plugin_registrant.cc and generated_plugin_registrant.h to manage plugin registration.
- Added generated_plugins.cmake for plugin configuration in CMake.
- Implemented CMakeLists.txt for the Windows runner, defining build settings and dependencies.
- Created Runner.rc for application resources including versioning and icons.
- Developed flutter_window.cpp and flutter_window.h to manage the Flutter window lifecycle.
- Implemented main.cpp as the entry point for the Windows application.
- Added resource.h for resource definitions.
- Included app icon in resources.
- Created runner.exe.manifest for application settings.
- Developed utils.cpp and utils.h for console management and command line argument handling.
- Implemented win32_window.cpp and win32_window.h for high DPI-aware window management.
2025-04-17 12:30:38 +05:30

138 lines
4.0 KiB
Dart

// ignore_for_file: prefer_initializing_formals
import 'package:flutter/material.dart';
enum MyShadowPosition {
topLeft("Top Left"),
top("Top"),
topRight("Top Right"),
centerLeft("Center Left"),
center("Center"),
centerRight("Center Right"),
bottomLeft("Bottom Left"),
bottom("Bottom"),
bottomRight("Bottom Right");
final String humanReadable;
const MyShadowPosition(this.humanReadable);
}
class MyShadow {
late int alpha;
late double elevation, spreadRadius, blurRadius;
Offset? offset;
MyShadowPosition? position;
Color? color;
bool? darkShadow;
MyShadow(
{this.elevation = 3,
double? spreadRadius,
double? blurRadius,
Offset? offset,
MyShadowPosition position = MyShadowPosition.bottom,
int? alpha,
Color? color,
bool darkShadow = false}) {
this.spreadRadius = spreadRadius ?? elevation * 0.125;
this.blurRadius = blurRadius ?? elevation * 2;
this.alpha = alpha ?? (darkShadow ? 80 : 25);
this.offset = offset;
this.position = position;
this.color = color;
this.darkShadow = darkShadow;
if (offset == null) {
switch (position) {
case MyShadowPosition.topLeft:
this.offset = Offset(-elevation, -elevation);
break;
case MyShadowPosition.top:
this.offset = Offset(0, -elevation);
break;
case MyShadowPosition.topRight:
this.offset = Offset(elevation, -elevation);
break;
//TODO: Shadow problem
case MyShadowPosition.centerLeft:
this.offset = Offset(-elevation, elevation * 0.25);
break;
case MyShadowPosition.center:
this.offset = Offset(0, 0);
break;
//TODO: Shadow problem
case MyShadowPosition.centerRight:
this.offset = Offset(elevation, elevation * 0.25);
break;
case MyShadowPosition.bottomLeft:
this.offset = Offset(-elevation, elevation);
break;
case MyShadowPosition.bottom:
this.offset = Offset(0, elevation);
break;
case MyShadowPosition.bottomRight:
this.offset = Offset(elevation, elevation);
break;
}
}
}
MyShadow.none(
{this.elevation = 0,
double? spreadRadius,
double? blurRadius,
Offset? offset,
MyShadowPosition position = MyShadowPosition.bottom,
int? alpha,
Color? color,
bool darkShadow = false}) {
this.spreadRadius = spreadRadius ?? elevation * 0.125;
this.blurRadius = blurRadius ?? elevation * 2;
this.alpha = alpha ?? (darkShadow ? 100 : 36);
this.offset = offset;
this.position = position;
this.color = color;
this.darkShadow = darkShadow;
if (offset == null) {
switch (position) {
case MyShadowPosition.topLeft:
this.offset = Offset(-elevation, -elevation);
break;
case MyShadowPosition.top:
this.offset = Offset(0, -elevation);
break;
case MyShadowPosition.topRight:
this.offset = Offset(elevation, -elevation);
break;
//TODO: Shadow problem
case MyShadowPosition.centerLeft:
this.offset = Offset(-elevation, elevation * 0.25);
break;
case MyShadowPosition.center:
this.offset = Offset(0, 0);
break;
//TODO: Shadow problem
case MyShadowPosition.centerRight:
this.offset = Offset(elevation, elevation * 0.25);
break;
case MyShadowPosition.bottomLeft:
this.offset = Offset(-elevation, elevation);
break;
case MyShadowPosition.bottom:
this.offset = Offset(0, elevation);
break;
case MyShadowPosition.bottomRight:
this.offset = Offset(elevation, elevation);
break;
}
}
}
@override
String toString() {
return 'MyShadow{alpha: $alpha, elevation: $elevation, spreadRadius: $spreadRadius, blurRadius: $blurRadius, offset: $offset, position: $position, color: $color, darkShadow: $darkShadow}';
}
}