Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- class OverlayElevation {
- static const e1 = OverlayElevation._(0.05);
- static const e2 = OverlayElevation._(0.07);
- static const e3 = OverlayElevation._(0.08);
- static const e4 = OverlayElevation._(0.09);
- static const e6 = OverlayElevation._(0.11);
- static const values = [e1, e2, e3, e4, e6];
- const OverlayElevation._(this._opacity);
- final double _opacity;
- int get ordinal => values.indexOf(this);
- Color merge(Color fg, Color bg) {
- return Color.alphaBlend(fg.withOpacity(_opacity), bg);
- }
- }
- void foo() {
- blah(OverlayElevation.e4);
- }
- void blah(OverlayElevation e) {
- final color = e.merge(Colors.red, Colors.blue);
- print(color.value.toRadixString(16));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement