display single tile
This commit is contained in:
1
abc/lib/tutFun.dart
Symbolic link
1
abc/lib/tutFun.dart
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../src/tutFun.dart
|
||||||
@@ -1,22 +1,48 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import 'game.dart';
|
import 'game.dart';
|
||||||
|
import 'tutFun.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
runApp(const MainApp());
|
runApp(const MainApp());
|
||||||
}
|
}
|
||||||
|
|
||||||
class MainApp extends StatelessWidget {
|
class MainApp extends StatelessWidget {
|
||||||
const MainApp({super.key});
|
const MainApp({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return const MaterialApp(
|
return const MaterialApp(
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: Center(
|
body: Center(
|
||||||
child: Text('Wow, nice, Hello World!'),
|
//child: Text('Wow, nice, Hello World!'),
|
||||||
),
|
child: Tile("A", HitType.hit),
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
}
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Tile extends StatelessWidget {
|
||||||
|
const Tile(this.letter, this.hitType, {super.key});
|
||||||
|
|
||||||
|
final String letter;
|
||||||
|
final HitType hitType;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
letter.toUpperCase(),
|
||||||
|
style: Theme.of(context).textTheme.titleLarge,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
border: Border.all(color: Colors.grey.shade300),
|
||||||
|
color: tutTileColor(hitType),
|
||||||
|
),
|
||||||
|
height: 60,
|
||||||
|
width: 60,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
17
src/tutFun.dart
Normal file
17
src/tutFun.dart
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
library;
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'game.dart';
|
||||||
|
|
||||||
|
Color tutTileColor(HitType t) {
|
||||||
|
if (t == HitType.hit) {
|
||||||
|
return Colors.green;
|
||||||
|
}
|
||||||
|
if (t == HitType.partial) {
|
||||||
|
return Colors.yellow;
|
||||||
|
}
|
||||||
|
if (t == HitType.miss) {
|
||||||
|
return Colors.grey;
|
||||||
|
}
|
||||||
|
return Colors.white;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user