123456789101112131415161718192021222324252627282930 |
- import 'package:flutter/material.dart';
- import 'package:flutter/widgets.dart';
- import 'package:flutter_2048/views/number_text.dart';
- import 'package:flutter_2048/views/block/base_block.dart';
- import 'package:flutter_2048/model/block_info.dart';
- class StaticBlock extends BaseBlock {
- final BlockInfo info;
- StaticBlock({
- Key key,
- this.info,
- AnimationController controller,
- }) : super(
- key: key,
- animation:
- new Tween<double>(begin: 0.0, end: 0.0).animate(controller),
- );
- @override
- Widget buildBlock(BuildContext context, BlockProps props) {
- return Positioned(
- top:
- (info.current ~/ props.mode) * (props.blockWidth + props.borderWidth),
- left:
- (info.current % props.mode) * (props.blockWidth + props.borderWidth),
- child: NumberText(value: this.info.value, size: props.blockWidth),
- );
- }
- }
|