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

Labels, links, steps and screenshots for Flutter widget and integration tests, reported to Qualflare.

example/lib/main.dart

import 'package:flutter/material.dart';

void main() => runApp(const CheckoutApp());

class CheckoutApp extends StatelessWidget {
  const CheckoutApp({super.key});

  @override
  Widget build(BuildContext context) => MaterialApp(
        title: 'Checkout',
        theme: ThemeData(colorSchemeSeed: Colors.indigo, useMaterial3: true),
        home: const CheckoutScreen(),
      );
}

class CheckoutScreen extends StatefulWidget {
  const CheckoutScreen({super.key});

  @override
  State<CheckoutScreen> createState() => _CheckoutScreenState();
}

class _CheckoutScreenState extends State<CheckoutScreen> {
  static const _items = {'Notebook': 12, 'Pen set': 8};
  final _promo = TextEditingController();
  bool _paid = false;

  int get _total =>
      _items.values.fold(0, (a, b) => a + b) - (_promo.text == 'SAVE5' ? 5 : 0);

  @override
  void dispose() {
    _promo.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) => Scaffold(
        appBar: AppBar(title: const Text('Checkout')),
        body: Padding(
          padding: const EdgeInsets.all(16),
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              for (final e in _items.entries) Text('${e.key}: \$${e.value}'),
              const SizedBox(height: 16),
              TextField(
                controller: _promo,
                decoration: const InputDecoration(labelText: 'Promo code'),
                onChanged: (_) => setState(() {}),
              ),
              const SizedBox(height: 16),
              Text('Total: \$$_total'),
              const SizedBox(height: 16),
              FilledButton(
                onPressed: () => setState(() => _paid = true),
                child: const Text('Pay'),
              ),
              if (_paid) const Text('Order confirmed'),
            ],
          ),
        ),
      );
}
0
likes
150
points
36
downloads

Documentation

API reference

Publisher

verified publisherqualflare.com

Weekly Downloads

Labels, links, steps and screenshots for Flutter widget and integration tests, reported to Qualflare.

Homepage
Repository (GitHub)
View/report issues

Topics

#testing #test-reporting #integration-test #widget-test

License

unknown (license)

Dependencies

flutter, flutter_test, integration_test, leak_tracker_testing, meta, test_api

More

Packages that depend on qualflare_flutter