Download flutter/dev/benchmarks/macrobenchmarks/lib/src/heavy_grid_view.dart from luom2645/agent-workspace: direct link, hf CLI and curl.
- Browser
- Download file 948 Bytes
-
https://huggingface.co/luom2645/agent-workspace/resolve/7d4c5ffdb4518a5d7456ef06ab77458fcf42663a/flutter/dev/benchmarks/macrobenchmarks/lib/src/heavy_grid_view.dart
- Command line
-
hf download hf://luom2645/agent-workspace@7d4c5ffdb4518a5d7456ef06ab77458fcf42663a/flutter/dev/benchmarks/macrobenchmarks/lib/src/heavy_grid_view.dart
-
curl -L -o heavy_grid_view.dart https://huggingface.co/luom2645/agent-workspace/resolve/7d4c5ffdb4518a5d7456ef06ab77458fcf42663a/flutter/dev/benchmarks/macrobenchmarks/lib/src/heavy_grid_view.dart
948 Bytes
| // 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. | |
| import 'package:flutter/material.dart'; | |
| class HeavyGridViewPage extends StatelessWidget { | |
| const HeavyGridViewPage({super.key}); | |
| Widget build(BuildContext context) { | |
| return GridView.builder( | |
| itemCount: 1000, | |
| gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3), | |
| itemBuilder: (BuildContext context, int index) => HeavyWidget(index), | |
| ).build(context); | |
| } | |
| } | |
| class HeavyWidget extends StatelessWidget { | |
| HeavyWidget(this.index) : super(key: ValueKey<int>(index)); | |
| final int index; | |
| final List<int> _weight = List<int>.filled(1000000, 0); | |
| Widget build(BuildContext context) { | |
| return SizedBox( | |
| width: 200, | |
| height: 200, | |
| child: Text('$index: ${_weight.length}'), | |
| ); | |
| } | |
| } | |