sections.dart 4.71 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Raw data for the animation demo.

import 'package:flutter/material.dart';

const Color _mariner = const Color(0xFF3B5F8F);
const Color _mediumPurple = const Color(0xFF8266D4);
const Color _tomato = const Color(0xFFF95B57);
const Color _mySin = const Color(0xFFF3A646);
const Color _deepCerise = const Color(0xFFD93F9B);

15 16
const String _kGalleryAssetsPackage = 'flutter_gallery_assets';

17
class SectionDetail {
18 19 20 21 22 23
  const SectionDetail({
    this.title,
    this.subtitle,
    this.imageAsset,
    this.imageAssetPackage,
  });
24 25 26
  final String title;
  final String subtitle;
  final String imageAsset;
27
  final String imageAssetPackage;
28 29 30
}

class Section {
31 32 33 34 35 36 37 38
  const Section({
    this.title,
    this.backgroundAsset,
    this.backgroundAssetPackage,
    this.leftColor,
    this.rightColor,
    this.details,
  });
39 40
  final String title;
  final String backgroundAsset;
41
  final String backgroundAssetPackage;
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
  final Color leftColor;
  final Color rightColor;
  final List<SectionDetail> details;

  @override
  bool operator==(Object other) {
    if (other is! Section)
      return false;
    final Section otherSection = other;
    return title == otherSection.title;
  }

  @override
  int get hashCode => title.hashCode;
}

// TODO(hansmuller): replace the SectionDetail images and text. Get rid of
// the const vars like _eyeglassesDetail and insert a variety of titles and
// image SectionDetails in the allSections list.

const SectionDetail _eyeglassesDetail = const SectionDetail(
63 64
  imageAsset: 'shrine/products/sunnies.png',
  imageAssetPackage: _kGalleryAssetsPackage,
65 66 67 68 69
  title: 'Flutter enables interactive animation',
  subtitle: '3K views - 5 days',
);

const SectionDetail _eyeglassesImageDetail = const SectionDetail(
70 71
  imageAsset: 'shrine/products/sunnies.png',
  imageAssetPackage: _kGalleryAssetsPackage,
72 73 74
);

const SectionDetail _seatingDetail = const SectionDetail(
75 76
  imageAsset: 'shrine/products/lawn_chair.png',
  imageAssetPackage: _kGalleryAssetsPackage,
77 78 79 80 81
  title: 'Flutter enables interactive animation',
  subtitle: '3K views - 5 days',
);

const SectionDetail _seatingImageDetail = const SectionDetail(
82 83
  imageAsset: 'shrine/products/lawn_chair.png',
  imageAssetPackage: _kGalleryAssetsPackage,
84 85 86
);

const SectionDetail _decorationDetail = const SectionDetail(
87 88
  imageAsset: 'shrine/products/lipstick.png',
  imageAssetPackage: _kGalleryAssetsPackage,
89 90 91 92 93
  title: 'Flutter enables interactive animation',
  subtitle: '3K views - 5 days',
);

const SectionDetail _decorationImageDetail = const SectionDetail(
94 95
  imageAsset: 'shrine/products/lipstick.png',
  imageAssetPackage: _kGalleryAssetsPackage,
96 97 98
);

const SectionDetail _protectionDetail = const SectionDetail(
99 100
  imageAsset: 'shrine/products/helmet.png',
  imageAssetPackage: _kGalleryAssetsPackage,
101 102 103 104 105
  title: 'Flutter enables interactive animation',
  subtitle: '3K views - 5 days',
);

const SectionDetail _protectionImageDetail = const SectionDetail(
106 107
  imageAsset: 'shrine/products/helmet.png',
  imageAssetPackage: _kGalleryAssetsPackage,
108 109 110 111 112 113 114
);

final List<Section> allSections = <Section>[
  const Section(
    title: 'EYEGLASSES',
    leftColor: _mediumPurple,
    rightColor: _mariner,
115 116
    backgroundAsset: 'shrine/products/sunnies.png',
    backgroundAssetPackage: _kGalleryAssetsPackage,
117 118 119 120 121 122 123 124 125 126 127 128 129
    details: const <SectionDetail>[
      _eyeglassesDetail,
      _eyeglassesImageDetail,
      _eyeglassesDetail,
      _eyeglassesDetail,
      _eyeglassesDetail,
      _eyeglassesDetail,
    ],
  ),
  const Section(
    title: 'SEATING',
    leftColor: _tomato,
    rightColor: _mediumPurple,
130 131
    backgroundAsset: 'shrine/products/lawn_chair.png',
    backgroundAssetPackage: _kGalleryAssetsPackage,
132 133 134 135 136 137 138 139 140 141 142 143 144
    details: const <SectionDetail>[
      _seatingDetail,
      _seatingImageDetail,
      _seatingDetail,
      _seatingDetail,
      _seatingDetail,
      _seatingDetail,
    ],
  ),
  const Section(
    title: 'DECORATION',
    leftColor: _mySin,
    rightColor: _tomato,
145 146
    backgroundAsset: 'shrine/products/lipstick.png',
    backgroundAssetPackage: _kGalleryAssetsPackage,
147 148 149 150 151 152 153 154 155 156 157 158 159
    details: const <SectionDetail>[
      _decorationDetail,
      _decorationImageDetail,
      _decorationDetail,
      _decorationDetail,
      _decorationDetail,
      _decorationDetail,
    ],
  ),
  const Section(
    title: 'PROTECTION',
    leftColor: Colors.white,
    rightColor: _tomato,
160 161
    backgroundAsset: 'shrine/products/helmet.png',
    backgroundAssetPackage: _kGalleryAssetsPackage,
162 163 164 165 166 167 168 169 170 171
    details: const <SectionDetail>[
      _protectionDetail,
      _protectionImageDetail,
      _protectionDetail,
      _protectionDetail,
      _protectionDetail,
      _protectionDetail,
    ],
  ),
];