conditional 0.0.1 copy "conditional: ^0.0.1" to clipboard
conditional: ^0.0.1 copied to clipboard

A convenience widget that provides a way to use different widgets based on the condition

example/lib/main.dart

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

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Coditional Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Material(
      child: Conditional(
        condition: 2 < 3,
        onConditionTrue: Center(
          child: Text('2 is less than 3'),
        ),
        onConditionFalse: Center(
          child: Text('2 is greater than 3'),
        ),
      ),
    );
  }
}
5
likes
40
pub points
49%
popularity

Publisher

unverified uploader

A convenience widget that provides a way to use different widgets based on the condition

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on conditional