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 | /// Flutter code sample for [InteractiveViewer]. |
8 | |
9 | void main() => runApp(const InteractiveViewerExampleApp()); |
10 | |
11 | class InteractiveViewerExampleApp extends StatelessWidget { |
12 | const InteractiveViewerExampleApp({super.key}); |
13 | |
14 | @override |
15 | Widget build(BuildContext context) { |
16 | return MaterialApp( |
17 | home: Scaffold( |
18 | appBar: AppBar(title: const Text('InteractiveViewer Sample')), |
19 | body: const InteractiveViewerExample(), |
20 | ), |
21 | ); |
22 | } |
23 | } |
24 | |
25 | class InteractiveViewerExample extends StatelessWidget { |
26 | const InteractiveViewerExample({super.key}); |
27 | |
28 | @override |
29 | Widget build(BuildContext context) { |
30 | return Center( |
31 | child: InteractiveViewer( |
32 | boundaryMargin: const EdgeInsets.all(20.0), |
33 | minScale: 0.1, |
34 | maxScale: 1.6, |
35 | child: Container( |
36 | decoration: const BoxDecoration( |
37 | gradient: LinearGradient( |
38 | begin: Alignment.topCenter, |
39 | end: Alignment.bottomCenter, |
40 | colors: <Color>[Colors.orange, Colors.red], |
41 | stops: <double>[0.0, 1.0], |
42 | ), |
43 | ), |
44 | ), |
45 | ), |
46 | ); |
47 | } |
48 | } |
49 |