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

outdated

A circular pad with 4 arrows which has a functionality of 4 buttons.

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Arrow Pad Example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const ArrowPadExample(),
    );
  }
}

class ArrowPadExample extends StatefulWidget {
  const ArrowPadExample({Key? key}) : super(key: key);

  @override
  _ArrowPadExampleState createState() => _ArrowPadExampleState();
}

class _ArrowPadExampleState extends State<ArrowPadExample> {
  String _secondArrowPadValue = 'With Functions';

  @override
  Widget build(BuildContext context) {
    double height = MediaQuery.of(context).size.height;
    double width = MediaQuery.of(context).size.width;

    return Scaffold(
      appBar: AppBar(
        title: const Text('Arrow Pad Example'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceEvenly,
              children: const [
                ArrowPad(),
                Text('Default Arrow Pad'),
              ],
            ),
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceEvenly,
              children: [
                ArrowPad(
                  padding: const EdgeInsets.all(8.0),
                  height: height / 5,
                  width: width / 4,
                  iconColor: Colors.white,
                  innerColor: Colors.red,
                  outerColor: const Color(0xFFCC0000),
                  splashColor: const Color(0xFFCC0000),
                  hoverColor: const Color(0xFFFF4D4D),
                  onPressedUp: () {
                    setState(() {
                      _secondArrowPadValue = 'Up Pressed';
                    });
                  },
                  onPressedDown: () {
                    setState(() {
                      _secondArrowPadValue = 'Down Pressed';
                    });
                  },
                  onPressedLeft: () {
                    setState(() {
                      _secondArrowPadValue = 'Left Pressed';
                    });
                  },
                  onPressedRight: () {
                    setState(() {
                      _secondArrowPadValue = 'Right Pressed';
                    });
                  },
                ),
                Text(_secondArrowPadValue),
              ],
            ),
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceEvenly,
              children: [
                ArrowPad(
                  padding: const EdgeInsets.all(8.0),
                  height: height / 5,
                  width: width / 4,
                  arrowPadIconStyle: ArrowPadIconStyle.arrow,
                  hoverColor: Colors.green,
                  iconColor: const Color(0xFF631739),
                  outerColor: const Color(0xFF86FC8A),
                ),
                const Text('Without Functions'),
              ],
            ),
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceEvenly,
              children: [
                ArrowPad(
                  height: height / 7,
                  width: width / 6,
                  innerColor: Colors.blue,
                  arrowPadIconStyle: ArrowPadIconStyle.arrow,
                ),
                const Text('Small Size'),
              ],
            ),
          ],
        ),
      ),
    );
  }
}
11
likes
0
pub points
66%
popularity

Publisher

verified publisherimmadisairaj.dev

A circular pad with 4 arrows which has a functionality of 4 buttons.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on arrow_pad