1// Copyright 2014 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5import 'package:flutter/material.dart';
6
7/// Flutter code sample for [InputDecoration.helper].
8
9void main() => runApp(const HelperExampleApp());
10
11class HelperExampleApp extends StatelessWidget {
12 const HelperExampleApp({super.key});
13
14 @override
15 Widget build(BuildContext context) {
16 return MaterialApp(
17 home: Scaffold(
18 appBar: AppBar(title: const Text('InputDecoration.helper Sample')),
19 body: const HelperExample(),
20 ),
21 );
22 }
23}
24
25class HelperExample extends StatelessWidget {
26 const HelperExample({super.key});
27
28 @override
29 Widget build(BuildContext context) {
30 return const Center(
31 child: TextField(
32 decoration: InputDecoration(
33 helper: Text.rich(
34 TextSpan(
35 children: <InlineSpan>[
36 WidgetSpan(child: Text('Helper Text ')),
37 WidgetSpan(child: Icon(Icons.help_outline, color: Colors.blue, size: 20.0)),
38 ],
39 ),
40 ),
41 ),
42 ),
43 );
44 }
45}
46

Provided by KDAB

Privacy Policy
Learn more about Flutter for embedded and desktop on industrialflutter.com