arcane 3.1.0+1 copy "arcane: ^3.1.0+1" to clipboard
arcane: ^3.1.0+1 copied to clipboard

Speeds up Flutter App Stuff

example/lib/main.dart

import 'package:arcane/arcane.dart';
import 'package:arcane/component/dialog/command.dart';
import 'package:example/showcase/buttons.dart';
import 'package:example/showcase/cards.dart';
import 'package:example/showcase/text.dart';
import 'package:example/util/showcase.dart';

bool v = false;
String? vv;
void main() {
  runApp(const ExampleArcaneApp());
}

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

  @override
  Widget build(BuildContext context) => ArcaneApp(
        home: const Home(),
        theme: ArcaneTheme(
            surfaceOpacity: 1,
            scheme: ContrastedColorScheme.fromScheme(ColorSchemes.blue)),
      );
}

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

  @override
  State<Home> createState() => _HomeState();
}

class _HomeState extends State<Home> {
  bool searching = false;
  TextEditingController controller = TextEditingController();
  FocusNode focusNode = FocusNode();
  bool listed = false;

  List<ArcaneShowcase> get valid => searching
      ? showcases.where((element) => element.matches(controller.text)).toList()
      : showcases;

  @override
  Widget build(BuildContext context) => SliverScreen(
      header: Bar(
        headerText: searching ? null : "Arcane",
        title: searching
            ? TextField(
                controller: controller,
                onChanged: (v) {
                  setState(() {});
                },
                onSubmitted: (v) {},
                placeholder: "Search",
              )
            : const Text("Tome of Style"),
        trailing: [
          IconButton(
              icon: Icon(Icons.address_book),
              onPressed: () => DialogText(
                    onConfirm: (_) {},
                    title: "Arcane",
                    hint: "This is the hint",
                  ).open(context)),
          searching
              ? IconButton(
                  icon: const Icon(Icons.x),
                  onPressed: () {
                    setState(() {
                      searching = false;
                      controller.clear();
                    });
                    DialogCommand(
                      onConfirm: (_) {},
                    ).open(context);
                  })
              : IconButton(
                  icon: const Icon(Icons.search_ionic),
                  onPressed: () {
                    setState(() {
                      searching = true;
                      focusNode.requestFocus();
                    });
                  }),
        ],
      ),
      sliver: MultiSliver(
        children: [
          ...valid
              .whereType<SliverScreenArcaneShowcase>()
              .map((e) => BarSection(
                    leading: [
                      if (e.icon != null) Icon(e.icon),
                    ],
                    titleText: e.name,
                    subtitleText: e.description,
                    sliver: e.buildSliver(context),
                  )),
          SGridView(
            children: [
              ...valid
                  .where((e) => e is! SliverScreenArcaneShowcase)
                  .map((e) => e.buildCard(context))
            ],
          ),
        ],
      ));
}

const List<ArcaneShowcase> showcases = [
  TextShowcase(),
  ButtonsShowcase(),
  CardsShowcase()
];