scales.dart 1.91 KB
Newer Older
Ian Hickson's avatar
Ian Hickson committed
1
// Copyright 2014 The Flutter Authors. All rights reserved.
2 3 4 5 6
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter/material.dart';

7
@immutable
8 9 10 11 12 13 14
class GalleryTextScaleValue {
  const GalleryTextScaleValue(this.scale, this.label);

  final double scale;
  final String label;

  @override
15 16
  bool operator ==(Object other) {
    if (other.runtimeType != runtimeType)
17
      return false;
18 19 20
    return other is GalleryTextScaleValue
        && other.scale == scale
        && other.label == label;
21 22 23 24 25 26 27 28 29 30 31 32
  }

  @override
  int get hashCode => hashValues(scale, label);

  @override
  String toString() {
    return '$runtimeType($label)';
  }

}

33 34 35 36 37 38
const List<GalleryTextScaleValue> kAllGalleryTextScaleValues = <GalleryTextScaleValue>[
  GalleryTextScaleValue(null, 'System Default'),
  GalleryTextScaleValue(0.8, 'Small'),
  GalleryTextScaleValue(1.0, 'Normal'),
  GalleryTextScaleValue(1.3, 'Large'),
  GalleryTextScaleValue(2.0, 'Huge'),
39
];
40

41
@immutable
42 43 44 45 46 47 48
class GalleryVisualDensityValue {
  const GalleryVisualDensityValue(this.visualDensity, this.label);

  final VisualDensity visualDensity;
  final String label;

  @override
49 50
  bool operator ==(Object other) {
    if (other.runtimeType != runtimeType)
51 52
      return false;
    return other is GalleryVisualDensityValue
53 54
        && other.visualDensity == visualDensity
        && other.label == label;
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
  }

  @override
  int get hashCode => hashValues(visualDensity, label);

  @override
  String toString() {
    return '$runtimeType($label)';
  }

}

const List<GalleryVisualDensityValue> kAllGalleryVisualDensityValues = <GalleryVisualDensityValue>[
  GalleryVisualDensityValue(VisualDensity(), 'System Default'),
  GalleryVisualDensityValue(VisualDensity.comfortable, 'Comfortable'),
  GalleryVisualDensityValue(VisualDensity.compact, 'Compact'),
  GalleryVisualDensityValue(VisualDensity(horizontal: -3, vertical: -3), 'Very Compact'),
];