iridescent_color 0.1.2 copy "iridescent_color: ^0.1.2" to clipboard
iridescent_color: ^0.1.2 copied to clipboard

Flutter package for exempting iridescent effect as color.

example/lib/main.dart

import 'dart:async';

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

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

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

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title: "IridescentColor Demo",
      home: IridescentColorDemo(),
    );
  }
}

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

  @override
  State<IridescentColorDemo> createState() => _IridescentColorDemoState();
}

class _IridescentColorDemoState extends State<IridescentColorDemo> {
  IridescentColor iridescentColor = IridescentColor();
  Color iridescentColorRainbow = Colors.transparent; //rainbow standby color
  Color iridescentColorCustom = Colors.transparent; //custom standby color

  bool iridescentColorRainbowLock = false;
  bool iridescentColorCustomLock = false;

  ///
  @override
  void initState() {
    super.initState();
    iridescentColor.init(
      () => setState(
        () {
          iridescentColorRainbow = iridescentColor.rainbow(
            lockColor: iridescentColorRainbowLock,
          );
          iridescentColorCustom = iridescentColor.custom(
            colorList: [
              Colors.white,
              Colors.red,
              Colors.green,
              Colors.blue,
            ],
            lockColor: iridescentColorCustomLock,
          );
        },
      ),
    );
  }

  ///
  @override
  void dispose() {
    super.dispose();
    iridescentColor.dispose();
  }

  ///
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.black,
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Column(
              children: [
                Text(
                  "RAINBOW",
                  style: TextStyle(
                    color: iridescentColorRainbow,
                    fontWeight: FontWeight.bold,
                    fontSize: 64,
                  ),
                ),
                ElevatedButton(
                  onPressed: () => setState(() =>
                      iridescentColorRainbowLock = !iridescentColorRainbowLock),
                  style: ElevatedButton.styleFrom(
                    backgroundColor: iridescentColorRainbow,
                  ),
                  child: const Text("LOCK RAINBOW"),
                ),
              ],
            ),
            Column(
              children: [
                Text(
                  "CUSTOM",
                  style: TextStyle(
                    color: iridescentColorCustom,
                    fontWeight: FontWeight.bold,
                    fontSize: 64,
                  ),
                ),
                ElevatedButton(
                  onPressed: () => setState(() =>
                      iridescentColorCustomLock = !iridescentColorCustomLock),
                  style: ElevatedButton.styleFrom(
                    backgroundColor: iridescentColorCustom,
                  ),
                  child: const Text("LOCK CUSTOM"),
                ),
              ],
            ),
          ],
        ),
      ),
    );
  }
}
1
likes
140
pub points
22%
popularity

Publisher

verified publisherspikeystudio.com

Flutter package for exempting iridescent effect as color.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter, motion_sensors

More

Packages that depend on iridescent_color