9
This commit is contained in:
47
lib/cases/guess/guess_app_bar.dart
Normal file
47
lib/cases/guess/guess_app_bar.dart
Normal file
@@ -0,0 +1,47 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
class GuessAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
final VoidCallback onCheck;
|
||||
final TextEditingController controller;
|
||||
|
||||
const GuessAppBar({
|
||||
Key? key,
|
||||
required this.onCheck,
|
||||
required this.controller,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AppBar(
|
||||
leading: Icon(Icons.menu, color: Colors.black),
|
||||
actions: [
|
||||
IconButton(
|
||||
splashRadius: 20,
|
||||
onPressed: onCheck,
|
||||
icon: Icon(
|
||||
Icons.run_circle_outlined,
|
||||
color: Colors.blue,
|
||||
))
|
||||
],
|
||||
title: TextField(
|
||||
controller: controller,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: InputDecoration(
|
||||
filled: true,
|
||||
fillColor: Color(0xffF3F6F9),
|
||||
constraints: BoxConstraints(maxHeight: 34), //约束信息
|
||||
contentPadding: EdgeInsets.only(top: -14,left: 10),
|
||||
border: UnderlineInputBorder(
|
||||
borderSide: BorderSide.none,
|
||||
borderRadius: BorderRadius.all(Radius.circular(6)),
|
||||
),
|
||||
hintText: "输入 0~99 数字",
|
||||
hintStyle: TextStyle(fontSize: 14)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
|
||||
}
|
||||
Reference in New Issue
Block a user