mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-01 10:38:17 +08:00
Reverting doc rename
This commit is contained in:
72
doc/examples/widgets/.gitignore
vendored
Normal file
72
doc/examples/widgets/.gitignore
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
# Miscellaneous
|
||||
*.class
|
||||
*.log
|
||||
*.pyc
|
||||
*.swp
|
||||
.DS_Store
|
||||
.atom/
|
||||
.buildlog/
|
||||
.history
|
||||
.svn/
|
||||
|
||||
# IntelliJ related
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
.idea/
|
||||
|
||||
# Visual Studio Code related
|
||||
.vscode/
|
||||
|
||||
# Flutter/Dart/Pub related
|
||||
**/doc/api/
|
||||
.dart_tool/
|
||||
.flutter-plugins
|
||||
.packages
|
||||
.pub-cache/
|
||||
.pub/
|
||||
/build/
|
||||
|
||||
# Android related
|
||||
**/android/**/gradle-wrapper.jar
|
||||
**/android/.gradle
|
||||
**/android/captures/
|
||||
**/android/gradlew
|
||||
**/android/gradlew.bat
|
||||
**/android/local.properties
|
||||
**/android/**/GeneratedPluginRegistrant.java
|
||||
|
||||
# iOS/XCode related
|
||||
**/ios/**/*.mode1v3
|
||||
**/ios/**/*.mode2v3
|
||||
**/ios/**/*.moved-aside
|
||||
**/ios/**/*.pbxuser
|
||||
**/ios/**/*.perspectivev3
|
||||
**/ios/**/*sync/
|
||||
**/ios/**/.sconsign.dblite
|
||||
**/ios/**/.tags*
|
||||
**/ios/**/.vagrant/
|
||||
**/ios/**/DerivedData/
|
||||
**/ios/**/Icon?
|
||||
**/ios/**/Pods/
|
||||
**/ios/**/.symlinks/
|
||||
**/ios/**/profile
|
||||
**/ios/**/xcuserdata
|
||||
**/ios/.generated/
|
||||
**/ios/Flutter/App.framework
|
||||
**/ios/Flutter/Flutter.framework
|
||||
**/ios/Flutter/Generated.xcconfig
|
||||
**/ios/Flutter/app.flx
|
||||
**/ios/Flutter/app.zip
|
||||
**/ios/Flutter/flutter_assets/
|
||||
**/ios/ServiceDefinitions.json
|
||||
**/ios/Runner/GeneratedPluginRegistrant.*
|
||||
|
||||
# Exceptions to above rules.
|
||||
!**/ios/**/default.mode1v3
|
||||
!**/ios/**/default.mode2v3
|
||||
!**/ios/**/default.pbxuser
|
||||
!**/ios/**/default.perspectivev3
|
||||
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
|
||||
|
||||
.flutter-plugins-dependencies
|
||||
10
doc/examples/widgets/.metadata
Normal file
10
doc/examples/widgets/.metadata
Normal file
@ -0,0 +1,10 @@
|
||||
# This file tracks properties of this Flutter project.
|
||||
# Used by Flutter tool to assess capabilities and perform upgrades etc.
|
||||
#
|
||||
# This file should be version controlled and should not be manually edited.
|
||||
|
||||
version:
|
||||
revision: 0aed0b61a1789ed06c9fa05a6c5fcfbd398c4811
|
||||
channel: master
|
||||
|
||||
project_type: app
|
||||
3
doc/examples/widgets/README.md
Normal file
3
doc/examples/widgets/README.md
Normal file
@ -0,0 +1,3 @@
|
||||
# Widgets
|
||||
|
||||
A Flutter project showcasing Flame's widgets.
|
||||
BIN
doc/examples/widgets/assets/images/buttons.png
Normal file
BIN
doc/examples/widgets/assets/images/buttons.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 235 B |
BIN
doc/examples/widgets/assets/images/nine_tile_box.png
Normal file
BIN
doc/examples/widgets/assets/images/nine_tile_box.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 318 B |
66
doc/examples/widgets/lib/main.dart
Normal file
66
doc/examples/widgets/lib/main.dart
Normal file
@ -0,0 +1,66 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flame/flame.dart';
|
||||
import 'package:flame/spritesheet.dart';
|
||||
import 'package:dashbook/dashbook.dart';
|
||||
|
||||
import 'package:flame/widgets/nine_tile_box.dart';
|
||||
import 'package:flame/widgets/sprite_button.dart';
|
||||
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
final nineTileBoxImage = await Flame.images.load('nine_tile_box.png');
|
||||
await Flame.images.load('buttons.png');
|
||||
|
||||
final _buttons = SpriteSheet(
|
||||
imageName: 'buttons.png',
|
||||
textureHeight: 20,
|
||||
textureWidth: 60,
|
||||
columns: 1,
|
||||
rows: 2,
|
||||
);
|
||||
|
||||
final dashbook = Dashbook();
|
||||
|
||||
dashbook.storiesOf('NineTileBox').decorator(CenterDecorator()).add(
|
||||
'default',
|
||||
(ctx) => Container(
|
||||
width: ctx.numberProperty('width', 200),
|
||||
height: ctx.numberProperty('height', 200),
|
||||
child: NineTileBox(
|
||||
image: nineTileBoxImage,
|
||||
tileSize: 16,
|
||||
destTileSize: 50,
|
||||
child: const Center(
|
||||
child: const Text(
|
||||
'Cool label',
|
||||
style: const TextStyle(
|
||||
color: const Color(0xFFFFFFFF),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
));
|
||||
|
||||
dashbook.storiesOf('SpriteButton').decorator(CenterDecorator()).add(
|
||||
'default',
|
||||
(ctx) => Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: SpriteButton(
|
||||
onPressed: () {
|
||||
print('Pressed');
|
||||
},
|
||||
label: const Text(
|
||||
'Sprite Button',
|
||||
style: const TextStyle(color: const Color(0xFF5D275D)),
|
||||
),
|
||||
sprite: _buttons.getSprite(0, 0),
|
||||
pressedSprite: _buttons.getSprite(1, 0),
|
||||
width: ctx.numberProperty('width', 250),
|
||||
height: ctx.numberProperty('height', 75),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
runApp(dashbook);
|
||||
}
|
||||
21
doc/examples/widgets/pubspec.yaml
Normal file
21
doc/examples/widgets/pubspec.yaml
Normal file
@ -0,0 +1,21 @@
|
||||
name: widgets
|
||||
description: A Flutter project showcasing Flame's widgets.
|
||||
|
||||
version: 1.0.0+1
|
||||
|
||||
environment:
|
||||
sdk: ">=2.1.0 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
flame:
|
||||
path: ../../../
|
||||
dashbook: ^0.0.4
|
||||
|
||||
cupertino_icons: ^0.1.2
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
assets:
|
||||
- assets/images/nine_tile_box.png
|
||||
- assets/images/buttons.png
|
||||
Reference in New Issue
Block a user