in add_to_app/books/flutter_module_books/lib/main.dart [109:202]
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Book Details'),
leading: IconButton(
icon: const Icon(Icons.clear),
// Pressing clear cancels the edit and leaves the activity without
// modification.
onPressed: () {
hostApi.cancel();
clear();
},
),
actions: [
IconButton(
icon: const Icon(Icons.check),
// Pressing save sends the updated book to the platform.
onPressed: () {
hostApi.finishEditingBook(book);
clear();
},
),
],
),
body: book == null
// Draw a spinner until the platform gives us the book to show details
// for.
? const Center(child: CircularProgressIndicator())
: Focus(
focusNode: textFocusNode,
child: ListView(
padding: const EdgeInsets.all(24),
children: [
TextField(
controller: titleTextController,
decoration: const InputDecoration(
border: OutlineInputBorder(),
filled: true,
hintText: "Title",
labelText: "Title",
),
),
const SizedBox(height: 24),
TextField(
controller: subtitleTextController,
maxLines: 2,
decoration: const InputDecoration(
border: OutlineInputBorder(),
filled: true,
hintText: "Subtitle",
labelText: "Subtitle",
),
),
const SizedBox(height: 24),
TextField(
controller: authorTextController,
decoration: const InputDecoration(
border: OutlineInputBorder(),
filled: true,
hintText: "Author",
labelText: "Author",
),
),
const SizedBox(height: 32),
const Divider(),
Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'${book.pageCount} pages ~ published ${book.publishDate}'),
),
),
const Divider(),
const SizedBox(height: 32),
const Center(
child: Text(
'BOOK DESCRIPTION',
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
decoration: TextDecoration.underline,
),
),
),
const SizedBox(height: 12),
Text(
book.summary,
style: TextStyle(color: Colors.grey.shade600, height: 1.24),
),
],
),
),
);
}