mirror of
				https://github.com/flame-engine/flame.git
				synced 2025-10-31 17:06:50 +08:00 
			
		
		
		
	 380781e126
			
		
	
	380781e126
	
	
	
		
			
			* Add * Adding SpriteWidgetBuilder * Adding SpriteButtonBuilder * Add NineTileBoxBuilder * a few adjustments on the docs * Adding error and loading builders to the widgets * Improving APIs for the widget review Co-authored-by: Luan Nico <luanpotter27@gmail.com>
		
			
				
	
	
		
			28 lines
		
	
	
		
			783 B
		
	
	
	
		
			Dart
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			783 B
		
	
	
	
		
			Dart
		
	
	
	
	
	
| import 'package:dashbook/dashbook.dart';
 | |
| import 'package:flame/extensions.dart';
 | |
| import 'package:flame/widgets.dart';
 | |
| import 'package:flutter/widgets.dart';
 | |
| 
 | |
| Widget spriteButtonBuilder(DashbookContext ctx) {
 | |
|   return Container(
 | |
|     padding: const EdgeInsets.all(20),
 | |
|     child: SpriteButton.asset(
 | |
|       path: 'buttons.png',
 | |
|       pressedPath: 'buttons.png',
 | |
|       srcPosition: Vector2(0, 0),
 | |
|       srcSize: Vector2(60, 20),
 | |
|       pressedSrcPosition: Vector2(0, 20),
 | |
|       pressedSrcSize: Vector2(60, 20),
 | |
|       onPressed: () {
 | |
|         print('Pressed');
 | |
|       },
 | |
|       label: const Text(
 | |
|         'Sprite Button',
 | |
|         style: TextStyle(color: Color(0xFF5D275D)),
 | |
|       ),
 | |
|       width: ctx.numberProperty('width', 250),
 | |
|       height: ctx.numberProperty('height', 75),
 | |
|     ),
 | |
|   );
 | |
| }
 |