flutter_shape_matcher 0.0.3 copy "flutter_shape_matcher: ^0.0.3" to clipboard
flutter_shape_matcher: ^0.0.3 copied to clipboard

This Flutter package serves as a vital parental gate for children under 5, combining entertainment and education.

example/lib/main.dart

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

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

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

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

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(),
      body: SizedBox(
        width: MediaQuery.of(context).size.width,
        height: MediaQuery.of(context).size.height,
        child: Column(
          children: [
            Padding(
              padding: const EdgeInsets.all(8.0),
              child: SizedBox(
                height: MediaQuery.of(context).size.height * .45,
                child: ShapeMatcher(
                  onSuccess: () => showSnackBar(context, 'Correct'),
                  onFailure: () => showSnackBar(context, 'Wrong'),
                ),
              ),
            )
          ],
        ),
      ),
    );
  }

  /// This is a function that populate the snackbar
  /// [context]: BuildContext
  /// [message]: String value
  void showSnackBar(BuildContext context, String message) {
    final scaffoldMessenger = ScaffoldMessenger.of(context);
    scaffoldMessenger.showSnackBar(
      SnackBar(
        content: Text(message),
        duration: const Duration(seconds: 3),
      ),
    );
  }
}
4
likes
130
points
21
downloads

Publisher

verified publisherwhoisvisal.com

Weekly Downloads

This Flutter package serves as a vital parental gate for children under 5, combining entertainment and education.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_shape_matcher