Skip to content

Commit f04cec1

Browse files
committed
Zoom in zoom out added
1 parent 9324fe0 commit f04cec1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1528
-17
lines changed

.flutter-plugins-dependencies

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"_info":"// This is a generated file; do not edit or check into version control.","dependencyGraph":[{"name":"path_provider","dependencies":[]},{"name":"sqflite","dependencies":[]}]}

android/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
gradle-wrapper.jar
2+
/.gradle
3+
/captures/
4+
/gradlew
5+
/gradlew.bat
6+
/local.properties
7+
GeneratedPluginRegistrant.java
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.example.FlutterUtilsCollection
2+
3+
import androidx.annotation.NonNull;
4+
import io.flutter.embedding.android.FlutterActivity
5+
import io.flutter.embedding.engine.FlutterEngine
6+
import io.flutter.plugins.GeneratedPluginRegistrant
7+
8+
class MainActivity: FlutterActivity() {
9+
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
10+
GeneratedPluginRegistrant.registerWith(flutterEngine);
11+
}
12+
}

android/gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
org.gradle.jvmargs=-Xmx1536M
22

3+
android.enableR8=true

ios/.gitignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
*.mode1v3
2+
*.mode2v3
3+
*.moved-aside
4+
*.pbxuser
5+
*.perspectivev3
6+
**/*sync/
7+
.sconsign.dblite
8+
.tags*
9+
**/.vagrant/
10+
**/DerivedData/
11+
Icon?
12+
**/Pods/
13+
**/.symlinks/
14+
profile
15+
xcuserdata
16+
**/.generated/
17+
Flutter/App.framework
18+
Flutter/Flutter.framework
19+
Flutter/Flutter.podspec
20+
Flutter/Generated.xcconfig
21+
Flutter/app.flx
22+
Flutter/app.zip
23+
Flutter/flutter_assets/
24+
Flutter/flutter_export_environment.sh
25+
ServiceDefinitions.json
26+
Runner/GeneratedPluginRegistrant.*
27+
28+
# Exceptions to above rules.
29+
!default.mode1v3
30+
!default.mode2v3
31+
!default.pbxuser
32+
!default.perspectivev3

ios/Runner/AppDelegate.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import UIKit
2+
import Flutter
3+
4+
@UIApplicationMain
5+
@objc class AppDelegate: FlutterAppDelegate {
6+
override func application(
7+
_ application: UIApplication,
8+
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9+
) -> Bool {
10+
GeneratedPluginRegistrant.register(with: self)
11+
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12+
}
13+
}

ios/Runner/Runner-Bridging-Header.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#import "GeneratedPluginRegistrant.h"

lib/main.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutterutils/size_page.dart';
3+
import 'package:flutterutils/zoom_page.dart';
34

45
void main() => runApp(MyApp());
56

@@ -12,7 +13,7 @@ class MyApp extends StatelessWidget {
1213
theme: ThemeData(
1314
primarySwatch: Colors.blue,
1415
),
15-
home: SizePositionPage(),
16+
home: ZoomPage(),
1617
);
1718
}
1819
}

lib/zoom_page.dart

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import 'package:cached_network_image/cached_network_image.dart';
2+
import 'package:flutter/material.dart';
3+
import 'package:vector_math/vector_math_64.dart' show Vector3;
4+
5+
class ZoomPage extends StatefulWidget {
6+
@override
7+
_ZoomPageState createState() => _ZoomPageState();
8+
}
9+
10+
class _ZoomPageState extends State<ZoomPage> {
11+
double _scale = 1.0;
12+
double _previousScale = 1.0;
13+
@override
14+
Widget build(BuildContext context) {
15+
return Scaffold(
16+
appBar: AppBar(
17+
title: Text("Zoom Page"),
18+
),
19+
body: Center(
20+
child: GestureDetector(
21+
onScaleStart: (ScaleStartDetails details) {
22+
print(details);
23+
_previousScale = _scale;
24+
setState(() {});
25+
},
26+
onScaleUpdate: (ScaleUpdateDetails details) {
27+
print(details);
28+
_scale = _previousScale * details.scale;
29+
setState(() {});
30+
},
31+
onScaleEnd: (ScaleEndDetails details) {
32+
print(details);
33+
34+
_previousScale = 1.0;
35+
setState(() {});
36+
},
37+
child: RotatedBox(
38+
quarterTurns: 0,
39+
child: Padding(
40+
padding: const EdgeInsets.all(8.0),
41+
child: Transform(
42+
alignment: FractionalOffset.center,
43+
transform: Matrix4.diagonal3(Vector3(_scale, _scale, _scale)),
44+
child: CachedNetworkImage(
45+
imageUrl:
46+
"https://images.unsplash.com/photo-1578253809350-d493c964357f?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1400&q=80",
47+
),
48+
),
49+
),
50+
),
51+
),
52+
),
53+
);
54+
}
55+
}

macos/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Flutter-related
2+
**/Flutter/ephemeral/
3+
**/Pods/
4+
5+
# Xcode-related
6+
**/xcuserdata/

macos/Flutter/Flutter-Debug.xcconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2+
#include "ephemeral/Flutter-Generated.xcconfig"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2+
#include "ephemeral/Flutter-Generated.xcconfig"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
//
2+
// Generated file. Do not edit.
3+
//
4+
5+
import FlutterMacOS
6+
import Foundation
7+
8+
9+
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
10+
}

macos/Podfile

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
platform :osx, '10.11'
2+
3+
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
4+
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
5+
6+
project 'Runner', {
7+
'Debug' => :debug,
8+
'Profile' => :release,
9+
'Release' => :release,
10+
}
11+
12+
def parse_KV_file(file, separator='=')
13+
file_abs_path = File.expand_path(file)
14+
if !File.exists? file_abs_path
15+
return [];
16+
end
17+
pods_ary = []
18+
skip_line_start_symbols = ["#", "/"]
19+
File.foreach(file_abs_path) { |line|
20+
next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
21+
plugin = line.split(pattern=separator)
22+
if plugin.length == 2
23+
podname = plugin[0].strip()
24+
path = plugin[1].strip()
25+
podpath = File.expand_path("#{path}", file_abs_path)
26+
pods_ary.push({:name => podname, :path => podpath});
27+
else
28+
puts "Invalid plugin specification: #{line}"
29+
end
30+
}
31+
return pods_ary
32+
end
33+
34+
def pubspec_supports_macos(file)
35+
file_abs_path = File.expand_path(file)
36+
if !File.exists? file_abs_path
37+
return false;
38+
end
39+
File.foreach(file_abs_path) { |line|
40+
return true if line =~ /^\s*macos:/
41+
}
42+
return false
43+
end
44+
45+
target 'Runner' do
46+
use_frameworks!
47+
use_modular_headers!
48+
49+
# Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
50+
# referring to absolute paths on developers' machines.
51+
ephemeral_dir = File.join('Flutter', 'ephemeral')
52+
symlink_dir = File.join(ephemeral_dir, '.symlinks')
53+
symlink_plugins_dir = File.join(symlink_dir, 'plugins')
54+
system("rm -rf #{symlink_dir}")
55+
system("mkdir -p #{symlink_plugins_dir}")
56+
57+
# Flutter Pods
58+
generated_xcconfig = parse_KV_file(File.join(ephemeral_dir, 'Flutter-Generated.xcconfig'))
59+
if generated_xcconfig.empty?
60+
puts "Flutter-Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
61+
end
62+
generated_xcconfig.map { |p|
63+
if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
64+
symlink = File.join(symlink_dir, 'flutter')
65+
File.symlink(File.dirname(p[:path]), symlink)
66+
pod 'FlutterMacOS', :path => File.join(symlink, File.basename(p[:path]))
67+
end
68+
}
69+
70+
# Plugin Pods
71+
plugin_pods = parse_KV_file('../.flutter-plugins')
72+
plugin_pods.map { |p|
73+
symlink = File.join(symlink_plugins_dir, p[:name])
74+
File.symlink(p[:path], symlink)
75+
if pubspec_supports_macos(File.join(symlink, 'pubspec.yaml'))
76+
pod p[:name], :path => File.join(symlink, 'macos')
77+
end
78+
}
79+
end
80+
81+
# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
82+
install! 'cocoapods', :disable_input_output_paths => true

0 commit comments

Comments
 (0)