|
| 1 | +// Copyright 2014 The Flutter Authors. All rights reserved. |
| 2 | +// Use of this source code is governed by a BSD-style license that can be |
| 3 | +// found in the LICENSE file. |
| 4 | + |
| 5 | +import 'package:flutter/material.dart'; |
| 6 | + |
| 7 | +class PictureCacheComplexityScoringPage extends StatelessWidget { |
| 8 | + const PictureCacheComplexityScoringPage({Key? key}) : super(key: key); |
| 9 | + |
| 10 | + static const List<String> kTabNames = <String>['1', '2']; |
| 11 | + |
| 12 | + @override |
| 13 | + Widget build(BuildContext context) { |
| 14 | + return DefaultTabController( |
| 15 | + length: kTabNames.length, // This is the number of tabs. |
| 16 | + child: Scaffold( |
| 17 | + appBar: AppBar( |
| 18 | + title: const Text('Picture Cache Complexity Scoring'), |
| 19 | + // pinned: true, |
| 20 | + // expandedHeight: 50.0, |
| 21 | + // forceElevated: innerBoxIsScrolled, |
| 22 | + bottom: TabBar( |
| 23 | + tabs: kTabNames.map((String name) => Tab(text: name)).toList(), |
| 24 | + ), |
| 25 | + ), |
| 26 | + body: TabBarView( |
| 27 | + key: const Key('tabbar_view_complexity'), // this key is used by the driver test |
| 28 | + children: kTabNames.map((String name) { |
| 29 | + return _buildComplexityScoringWidgets(name); |
| 30 | + }).toList(), |
| 31 | + ), |
| 32 | + ), |
| 33 | + ); |
| 34 | + } |
| 35 | + |
| 36 | + // For now we just test a single case where the widget being cached is actually |
| 37 | + // relatively cheap to rasterise, and so should not be in the cache. |
| 38 | + // |
| 39 | + // Eventually we can extend this to add new test cases based on the tab name. |
| 40 | + Widget _buildComplexityScoringWidgets(String name) { |
| 41 | + return Column(children: <Widget>[ |
| 42 | + Slider(value: 50, label: 'Slider 1', onChanged: (double _) {}, max: 100, divisions: 10,), |
| 43 | + Slider(value: 50, label: 'Slider 2', onChanged: (double _) {}, max: 100, divisions: 10,), |
| 44 | + Slider(value: 50, label: 'Slider 3', onChanged: (double _) {}, max: 100, divisions: 10,), |
| 45 | + ]); |
| 46 | + } |
| 47 | +} |
0 commit comments