mirror of
https://github.com/flutter/samples.git
synced 2026-03-31 00:33:02 +00:00
I got carried away with Gemini and basically rewrote CI and the release process for the new LLM reality. This work was largely completed by Gemini. - Bump all SDK versions to the current beta (3.9.0-0) - Run `flutter channel beta` - Wrote `ci_script.dart` to replace the bash scripts - Converted repository to pub workspace #2499 - Added llm.md and release.md - Added redirect for deprecated Samples Index ## Pre-launch Checklist - [x] I read the [Flutter Style Guide] _recently_, and have followed its advice. - [x] I signed the [CLA]. - [x] I read the [Contributors Guide]. - [x] I have added sample code updates to the [changelog]. - [x] I updated/added relevant documentation (doc comments with `///`).
82 lines
2.3 KiB
Dart
82 lines
2.3 KiB
Dart
// Copyright 2020 The Flutter team. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
import 'package:platform_channels/src/pet_list_message_channel.dart';
|
|
|
|
/// Demonstrates how to use [BasicMessageChannel] to send a message to platform.
|
|
///
|
|
/// The widget uses [TextField] and [RadioListTile] to take the [PetDetails.breed] and
|
|
/// [PetDetails.petType] from the user respectively.
|
|
class AddPetDetails extends StatefulWidget {
|
|
const AddPetDetails({super.key});
|
|
|
|
@override
|
|
State<AddPetDetails> createState() => _AddPetDetailsState();
|
|
}
|
|
|
|
class _AddPetDetailsState extends State<AddPetDetails> {
|
|
final breedTextController = TextEditingController();
|
|
String petType = 'Dog';
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text('Add Pet Details'),
|
|
actions: [
|
|
IconButton(
|
|
icon: const Icon(Icons.add),
|
|
onPressed: () {
|
|
PetListMessageChannel.addPetDetails(
|
|
PetDetails(
|
|
petType: petType,
|
|
breed: breedTextController.text,
|
|
),
|
|
);
|
|
|
|
context.pop();
|
|
},
|
|
),
|
|
],
|
|
),
|
|
body: Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: RadioGroup(
|
|
groupValue: petType,
|
|
onChanged: (value) {
|
|
setState(() {
|
|
petType = value!;
|
|
});
|
|
},
|
|
child: Column(
|
|
children: [
|
|
const SizedBox(height: 8),
|
|
TextField(
|
|
controller: breedTextController,
|
|
decoration: const InputDecoration(
|
|
border: OutlineInputBorder(),
|
|
filled: true,
|
|
hintText: 'Breed of pet',
|
|
labelText: 'Breed',
|
|
),
|
|
),
|
|
const SizedBox(height: 8),
|
|
RadioListTile<String>(
|
|
title: const Text('Dog'),
|
|
value: 'Dog',
|
|
),
|
|
RadioListTile<String>(
|
|
title: const Text('Cat'),
|
|
value: 'Cat',
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|