Chess.dart 321 B

1234567891011121314151617181920212223
  1. import 'dart:ui';
  2. import 'package:flutter/material.dart';
  3. /// 棋子的抽象类
  4. abstract class Chess{
  5. Color? _color;
  6. Color get color => _color!;
  7. }
  8. class BlackChess extends Chess{
  9. BlackChess() {
  10. _color = Colors.black;
  11. }
  12. }
  13. class WhiteChess extends Chess{
  14. WhiteChess() {
  15. _color = Colors.white;
  16. }
  17. }