constants.dart 2.84 KB
Newer Older
1 2 3 4
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

5
import 'utils.dart';
6 7 8 9

class MaskConstant {
  const MaskConstant({required this.name, required this.value, required this.description});

10 11 12 13 14 15 16
  const MaskConstant.platform({required String platform, required int value})
    : this(
        name: '$platform Plane',
        value: value,
        description: 'The plane value for the private keys defined by the $platform embedding.'
      );

17 18
  final String name;
  final int value;
19 20 21 22 23 24 25 26 27 28 29 30 31
  final String description;

  String get upperCamelName {
    return name
      .split(' ')
      .map<String>((String word) => lowerCamelToUpperCamel(word.toLowerCase()))
      .join('');
  }

  String get lowerCamelName {
    final String upperCamel = upperCamelName;
    return upperCamel.substring(0, 1).toLowerCase() + upperCamel.substring(1);
  }
32 33
}

34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
const MaskConstant kValueMask = MaskConstant(
  name: 'Value Mask',
  value: 0x00FFFFFFFF,
  description: 'Mask for the 32-bit value portion of the key code.',
);

const MaskConstant kPlaneMask = MaskConstant(
  name: 'Plane Mask',
  value: 0xFF00000000,
  description: 'Mask for the plane prefix portion of the key code.',
);

const MaskConstant kUnicodePlane = MaskConstant(
  name: 'Unicode Plane',
  value: 0x0000000000,
  description: 'The plane value for keys which have a Unicode representation.',
);

const MaskConstant kUnprintablePlane = MaskConstant(
  name: 'Unprintable Plane',
  value: 0x0100000000,
  description: 'The plane value for keys defined by Chromium and does not have a Unicode representation.',
);

const MaskConstant kFlutterPlane = MaskConstant(
  name: 'Flutter Plane',
  value: 0x0200000000,
  description: 'The plane value for keys defined by Flutter.',
);

const MaskConstant kStartOfPlatformPlanes = MaskConstant(
  name: 'Start Of Platform Planes',
  value: 0x1100000000,
  description: 'The platform plane with the lowest mask value, beyond which the keys are considered autogenerated.',
);

const MaskConstant kAndroidPlane = MaskConstant.platform(
  platform: 'Android',
  value: 0x1100000000,
);

const MaskConstant kFuchsiaPlane = MaskConstant.platform(
  platform: 'Fuchsia',
  value: 0x1200000000,
);

const MaskConstant kIosPlane = MaskConstant.platform(
  platform: 'iOS',
  value: 0x1300000000,
);

const MaskConstant kMacosPlane = MaskConstant.platform(
  platform: 'macOS',
  value: 0x1400000000,
);

const MaskConstant kGtkPlane = MaskConstant.platform(
  platform: 'Gtk',
  value: 0x1500000000,
);

const MaskConstant kWindowsPlane = MaskConstant.platform(
  platform: 'Windows',
  value: 0x1600000000,
);

const MaskConstant kWebPlane = MaskConstant.platform(
  platform: 'Web',
  value: 0x1700000000,
);

const MaskConstant kGlfwPlane = MaskConstant.platform(
  platform: 'GLFW',
  value: 0x1800000000,
);