@@ -2,31 +2,28 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flutter code sample for [InteractiveViewer].
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void main() => runApp(const MyApp());
|
||||
/// Flutter code sample for [InteractiveViewer].
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
void main() => runApp(const InteractiveViewerExampleApp());
|
||||
|
||||
static const String _title = 'Flutter Code Sample';
|
||||
class InteractiveViewerExampleApp extends StatelessWidget {
|
||||
const InteractiveViewerExampleApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: _title,
|
||||
home: Scaffold(
|
||||
appBar: AppBar(title: const Text(_title)),
|
||||
body: const MyStatelessWidget(),
|
||||
appBar: AppBar(title: const Text('InteractiveViewer Sample')),
|
||||
body: const InteractiveViewerExample(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MyStatelessWidget extends StatelessWidget {
|
||||
const MyStatelessWidget({super.key});
|
||||
class InteractiveViewerExample extends StatelessWidget {
|
||||
const InteractiveViewerExample({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flutter code sample for [InteractiveViewer.builder].
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:vector_math/vector_math_64.dart' show Quad, Vector3;
|
||||
|
||||
/// Flutter code sample for [InteractiveViewer.builder].
|
||||
|
||||
void main() => runApp(const IVBuilderExampleApp());
|
||||
|
||||
class IVBuilderExampleApp extends StatelessWidget {
|
||||
@@ -80,9 +80,7 @@ class _IVBuilderExampleState extends State<_IVBuilderExample> {
|
||||
return Container(
|
||||
height: _cellHeight,
|
||||
width: _cellWidth,
|
||||
color: row % 2 + column % 2 == 1
|
||||
? Colors.white
|
||||
: Colors.grey.withOpacity(0.1),
|
||||
color: row % 2 + column % 2 == 1 ? Colors.white : Colors.grey.withOpacity(0.1),
|
||||
child: Align(
|
||||
child: Text('$row x $column'),
|
||||
),
|
||||
@@ -97,8 +95,7 @@ class _IVBuilderExampleState extends State<_IVBuilderExample> {
|
||||
}
|
||||
}
|
||||
|
||||
typedef _CellBuilder = Widget Function(
|
||||
BuildContext context, int row, int column);
|
||||
typedef _CellBuilder = Widget Function(BuildContext context, int row, int column);
|
||||
|
||||
class _TableBuilder extends StatelessWidget {
|
||||
const _TableBuilder({
|
||||
|
||||
@@ -2,31 +2,28 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flutter code sample for [InteractiveViewer.constrained].
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void main() => runApp(const MyApp());
|
||||
/// Flutter code sample for [InteractiveViewer.constrained].
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
void main() => runApp(const ConstrainedExampleApp());
|
||||
|
||||
static const String _title = 'Flutter Code Sample';
|
||||
class ConstrainedExampleApp extends StatelessWidget {
|
||||
const ConstrainedExampleApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: _title,
|
||||
home: Scaffold(
|
||||
appBar: AppBar(title: const Text(_title)),
|
||||
body: const MyStatelessWidget(),
|
||||
appBar: AppBar(title: const Text('Constrained Sample')),
|
||||
body: const ConstrainedExample(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MyStatelessWidget extends StatelessWidget {
|
||||
const MyStatelessWidget({super.key});
|
||||
class ConstrainedExample extends StatelessWidget {
|
||||
const ConstrainedExample({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -39,8 +36,7 @@ class MyStatelessWidget extends StatelessWidget {
|
||||
scaleEnabled: false,
|
||||
child: Table(
|
||||
columnWidths: <int, TableColumnWidth>{
|
||||
for (int column = 0; column < columnCount; column += 1)
|
||||
column: const FixedColumnWidth(200.0),
|
||||
for (int column = 0; column < columnCount; column += 1) column: const FixedColumnWidth(200.0),
|
||||
},
|
||||
children: <TableRow>[
|
||||
for (int row = 0; row < rowCount; row += 1)
|
||||
@@ -49,9 +45,7 @@ class MyStatelessWidget extends StatelessWidget {
|
||||
for (int column = 0; column < columnCount; column += 1)
|
||||
Container(
|
||||
height: 26,
|
||||
color: row % 2 + column % 2 == 1
|
||||
? Colors.white
|
||||
: Colors.grey.withOpacity(0.1),
|
||||
color: row % 2 + column % 2 == 1 ? Colors.white : Colors.grey.withOpacity(0.1),
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text('$row x $column'),
|
||||
|
||||
@@ -2,39 +2,35 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flutter code sample for [InteractiveViewer.transformationController].
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void main() => runApp(const MyApp());
|
||||
/// Flutter code sample for [InteractiveViewer.transformationController].
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
void main() => runApp(const TransformationControllerExampleApp());
|
||||
|
||||
static const String _title = 'Flutter Code Sample';
|
||||
class TransformationControllerExampleApp extends StatelessWidget {
|
||||
const TransformationControllerExampleApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const MaterialApp(
|
||||
title: _title,
|
||||
home: MyStatefulWidget(),
|
||||
home: TransformationControllerExample(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MyStatefulWidget extends StatefulWidget {
|
||||
const MyStatefulWidget({super.key});
|
||||
class TransformationControllerExample extends StatefulWidget {
|
||||
const TransformationControllerExample({super.key});
|
||||
|
||||
@override
|
||||
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
|
||||
State<TransformationControllerExample> createState() => _TransformationControllerExampleState();
|
||||
}
|
||||
|
||||
/// [AnimationController]s can be created with `vsync: this` because of
|
||||
/// [TickerProviderStateMixin].
|
||||
class _MyStatefulWidgetState extends State<MyStatefulWidget>
|
||||
class _TransformationControllerExampleState extends State<TransformationControllerExample>
|
||||
with TickerProviderStateMixin {
|
||||
final TransformationController _transformationController =
|
||||
TransformationController();
|
||||
final TransformationController _transformationController = TransformationController();
|
||||
Animation<Matrix4>? _animationReset;
|
||||
late final AnimationController _controllerReset;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user