input_dialog 0.1.0 copy "input_dialog: ^0.1.0" to clipboard
input_dialog: ^0.1.0 copied to clipboard

The easiest way to prompt a user for text, good for prototyping

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:input_dialog/input_dialog.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: const MyHomePage(title: 'input_dialog Demo'),
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      title: 'input_dialog Demo',
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  String? _text;

  Future<void> _prompt() async {
    final result = await InputDialog.show(
      context: context,
      title: 'Enter Text',
    );

    setState(() {
      _text = result;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(_text ?? 'Click the button.'),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _prompt,
        tooltip: 'Show input_dialog',
        child: const Icon(Icons.open_in_new),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}
4
likes
160
pub points
65%
popularity

Publisher

verified publisherainkin.com

The easiest way to prompt a user for text, good for prototyping

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT-0 (license)

Dependencies

flutter

More

Packages that depend on input_dialog