- 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.
		
			
				
	
	
		
			138 lines
		
	
	
		
			4.0 KiB
		
	
	
	
		
			Dart
		
	
	
	
	
	
			
		
		
	
	
			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}';
 | |
|   }
 | |
| }
 |