├── example ├── ios │ ├── Flutter │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── AppFrameworkInfo.plist │ ├── Runner │ │ ├── Runner-Bridging-Header.h │ │ ├── Assets.xcassets │ │ │ ├── LaunchImage.imageset │ │ │ │ ├── LaunchImage.png │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ ├── README.md │ │ │ │ └── Contents.json │ │ │ └── AppIcon.appiconset │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ │ └── Contents.json │ │ ├── AppDelegate.swift │ │ ├── Base.lproj │ │ │ ├── Main.storyboard │ │ │ └── LaunchScreen.storyboard │ │ └── Info.plist │ ├── Runner.xcworkspace │ │ └── contents.xcworkspacedata │ └── Runner.xcodeproj │ │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ │ ├── xcshareddata │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ │ └── project.pbxproj ├── android │ ├── gradle.properties │ ├── app │ │ ├── src │ │ │ ├── main │ │ │ │ ├── res │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── values │ │ │ │ │ │ └── styles.xml │ │ │ │ │ └── drawable │ │ │ │ │ │ └── launch_background.xml │ │ │ │ ├── kotlin │ │ │ │ │ └── io │ │ │ │ │ │ └── suy │ │ │ │ │ │ └── geopattern_example │ │ │ │ │ │ └── example │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ └── AndroidManifest.xml │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ └── profile │ │ │ │ └── AndroidManifest.xml │ │ └── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ ├── settings.gradle │ └── build.gradle ├── pubspec.yaml ├── .metadata ├── pubspec.lock ├── .gitignore └── lib │ └── main.dart ├── doc └── readme │ └── images │ ├── plaid.png │ ├── chevrons.png │ ├── diamonds.png │ ├── hexagons.png │ ├── octagons.png │ ├── simple.png │ ├── squares.png │ ├── plus_signs.png │ ├── sine_waves.png │ ├── triangles.png │ ├── mosaic_squares.png │ ├── nested_squares.png │ ├── concentric_circles.png │ ├── overlapping_rings.png │ └── overlapping_circles.png ├── .editorconfig ├── CHANGELOG.md ├── lib ├── patterns │ ├── pattern.dart │ ├── overlapping_circles.dart │ ├── squares.dart │ ├── overlapping_rings.dart │ ├── diamonds.dart │ ├── nested_squares.dart │ ├── octagons.dart │ ├── concentric_circles.dart │ ├── triangles.dart │ ├── plus_signs.dart │ ├── sine_waves.dart │ ├── hexagons.dart │ ├── chevrons.dart │ ├── plaid.dart │ └── mosaic_squares.dart └── geopattern_flutter.dart ├── .metadata ├── pubspec.yaml ├── LICENSE ├── .gitignore ├── pubspec.lock ├── README.md └── test └── geopattern_flutter_test.dart /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | 3 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/ios/Runner/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" -------------------------------------------------------------------------------- /doc/readme/images/plaid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/doc/readme/images/plaid.png -------------------------------------------------------------------------------- /doc/readme/images/chevrons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/doc/readme/images/chevrons.png -------------------------------------------------------------------------------- /doc/readme/images/diamonds.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/doc/readme/images/diamonds.png -------------------------------------------------------------------------------- /doc/readme/images/hexagons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/doc/readme/images/hexagons.png -------------------------------------------------------------------------------- /doc/readme/images/octagons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/doc/readme/images/octagons.png -------------------------------------------------------------------------------- /doc/readme/images/simple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/doc/readme/images/simple.png -------------------------------------------------------------------------------- /doc/readme/images/squares.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/doc/readme/images/squares.png -------------------------------------------------------------------------------- /doc/readme/images/plus_signs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/doc/readme/images/plus_signs.png -------------------------------------------------------------------------------- /doc/readme/images/sine_waves.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/doc/readme/images/sine_waves.png -------------------------------------------------------------------------------- /doc/readme/images/triangles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/doc/readme/images/triangles.png -------------------------------------------------------------------------------- /doc/readme/images/mosaic_squares.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/doc/readme/images/mosaic_squares.png -------------------------------------------------------------------------------- /doc/readme/images/nested_squares.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/doc/readme/images/nested_squares.png -------------------------------------------------------------------------------- /doc/readme/images/concentric_circles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/doc/readme/images/concentric_circles.png -------------------------------------------------------------------------------- /doc/readme/images/overlapping_rings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/doc/readme/images/overlapping_rings.png -------------------------------------------------------------------------------- /doc/readme/images/overlapping_circles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/doc/readme/images/overlapping_circles.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [0.1.1] - Fix example preview on pub 2 | 3 | ## [0.1.0] - Maintainence suggestions from pub 4 | 5 | ## [0.0.2] - Fix README 6 | 7 | ## [0.0.1] - Initial Release 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suyash/geopattern/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip 7 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: geopattern_example 2 | description: A new Flutter project. 3 | version: 1.0.0+1 4 | 5 | environment: 6 | sdk: ">=2.1.0 <3.0.0" 7 | 8 | dependencies: 9 | flutter: 10 | sdk: flutter 11 | geopattern_flutter: 12 | path: ../ 13 | 14 | flutter: 15 | uses-material-design: false 16 | -------------------------------------------------------------------------------- /lib/patterns/pattern.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | /// base class for all patterns 4 | abstract class Pattern { 5 | /// paint renders a single instance of the pattern on the passed canvas 6 | /// at the specified offset. 7 | void paint(Canvas canvas, Offset offset); 8 | 9 | /// the size of the current pattern 10 | Size get size; 11 | } 12 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 7a4c33425ddd78c54aba07d86f3f9a4a0051769b 8 | channel: stable 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: b712a172f9694745f50505c93340883493b505e5 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: geopattern_flutter 2 | description: Geometric patterns for flutter, based on geo_pattern ruby library. 3 | version: 0.1.1 4 | author: Suyash 5 | homepage: https://github.com/suyash/geopattern 6 | 7 | environment: 8 | sdk: ">=2.1.0 <3.0.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | 14 | dev_dependencies: 15 | flutter_test: 16 | sdk: flutter 17 | 18 | flutter: 19 | uses-material-design: false 20 | -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/io/suy/geopattern_example/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package io.suy.geopattern_example.example 2 | 3 | import android.os.Bundle 4 | 5 | import io.flutter.app.FlutterActivity 6 | import io.flutter.plugins.GeneratedPluginRegistrant 7 | 8 | class MainActivity: FlutterActivity() { 9 | override fun onCreate(savedInstanceState: Bundle?) { 10 | super.onCreate(savedInstanceState) 11 | GeneratedPluginRegistrant.registerWith(this) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.2.71' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:3.2.1' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /lib/geopattern_flutter.dart: -------------------------------------------------------------------------------- 1 | library geopattern_flutter; 2 | 3 | import 'package:flutter/widgets.dart'; 4 | 5 | import 'patterns/pattern.dart'; 6 | 7 | /// A CustomPainter that takes a single pattern and draws it across the entire canvas. 8 | class FullPainter extends CustomPainter { 9 | Color background; 10 | Pattern pattern; 11 | 12 | FullPainter({@required this.pattern, @required this.background}) 13 | : assert(pattern != null && background != null); 14 | 15 | @override 16 | void paint(Canvas canvas, Size size) { 17 | canvas.drawColor(background, BlendMode.color); 18 | for (var i = 0.0; i < size.height; i += pattern.size.height) { 19 | for (var j = 0.0; j < size.width; j += pattern.size.width) { 20 | pattern.paint(canvas, Offset(j, i)); 21 | } 22 | } 23 | } 24 | 25 | @override 26 | bool shouldRepaint(CustomPainter oldDelegate) => false; 27 | } 28 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2019- Suyash 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | collection: 5 | dependency: transitive 6 | description: 7 | name: collection 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "1.14.11" 11 | flutter: 12 | dependency: "direct main" 13 | description: flutter 14 | source: sdk 15 | version: "0.0.0" 16 | geopattern_flutter: 17 | dependency: "direct main" 18 | description: 19 | path: ".." 20 | relative: true 21 | source: path 22 | version: "0.1.1" 23 | meta: 24 | dependency: transitive 25 | description: 26 | name: meta 27 | url: "https://pub.dartlang.org" 28 | source: hosted 29 | version: "1.1.6" 30 | sky_engine: 31 | dependency: transitive 32 | description: flutter 33 | source: sdk 34 | version: "0.0.99" 35 | typed_data: 36 | dependency: transitive 37 | description: 38 | name: typed_data 39 | url: "https://pub.dartlang.org" 40 | source: hosted 41 | version: "1.1.6" 42 | vector_math: 43 | dependency: transitive 44 | description: 45 | name: vector_math 46 | url: "https://pub.dartlang.org" 47 | source: hosted 48 | version: "2.0.8" 49 | sdks: 50 | dart: ">=2.2.2 <3.0.0" 51 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # Visual Studio Code related 19 | .vscode/ 20 | 21 | # Flutter/Dart/Pub related 22 | **/doc/api/ 23 | .dart_tool/ 24 | .flutter-plugins 25 | .packages 26 | .pub-cache/ 27 | .pub/ 28 | build/ 29 | 30 | # Android related 31 | **/android/**/gradle-wrapper.jar 32 | **/android/.gradle 33 | **/android/captures/ 34 | **/android/gradlew 35 | **/android/gradlew.bat 36 | **/android/local.properties 37 | **/android/**/GeneratedPluginRegistrant.java 38 | 39 | # iOS/XCode related 40 | **/ios/**/*.mode1v3 41 | **/ios/**/*.mode2v3 42 | **/ios/**/*.moved-aside 43 | **/ios/**/*.pbxuser 44 | **/ios/**/*.perspectivev3 45 | **/ios/**/*sync/ 46 | **/ios/**/.sconsign.dblite 47 | **/ios/**/.tags* 48 | **/ios/**/.vagrant/ 49 | **/ios/**/DerivedData/ 50 | **/ios/**/Icon? 51 | **/ios/**/Pods/ 52 | **/ios/**/.symlinks/ 53 | **/ios/**/profile 54 | **/ios/**/xcuserdata 55 | **/ios/.generated/ 56 | **/ios/Flutter/App.framework 57 | **/ios/Flutter/Flutter.framework 58 | **/ios/Flutter/Generated.xcconfig 59 | **/ios/Flutter/app.flx 60 | **/ios/Flutter/app.zip 61 | **/ios/Flutter/flutter_assets/ 62 | **/ios/ServiceDefinitions.json 63 | **/ios/Runner/GeneratedPluginRegistrant.* 64 | 65 | # Exceptions to above rules. 66 | !**/ios/**/default.mode1v3 67 | !**/ios/**/default.mode2v3 68 | !**/ios/**/default.pbxuser 69 | !**/ios/**/default.perspectivev3 70 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 71 | -------------------------------------------------------------------------------- /lib/patterns/overlapping_circles.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:flutter/widgets.dart'; 4 | 5 | import 'pattern.dart'; 6 | 7 | /// https://github.com/suyash/geopattern_flutter/blob/master/examples/images/overlapping_circles.png 8 | class OverlappingCircles extends Pattern { 9 | final double radius; 10 | final int nx; 11 | final int ny; 12 | final List fillColors; 13 | 14 | OverlappingCircles( 15 | {@required this.radius, 16 | @required this.nx, 17 | @required this.ny, 18 | @required this.fillColors}) 19 | : assert(fillColors.length == nx * ny); 20 | 21 | OverlappingCircles.fromHash(String hash) 22 | : assert(hash.length == 40), 23 | radius = int.parse(hash[0], radix: 16) / 16.0 * 50 + 30, 24 | nx = 6, 25 | ny = 6, 26 | fillColors = hash.split("").map((String c) { 27 | final v = int.parse(c, radix: 16); 28 | final g = 50 + (v % 1) * 150; 29 | return Color.fromARGB(((v / 16.0) * 100 + 50).round(), g, g, g); 30 | }).toList(); 31 | 32 | void paint(Canvas canvas, Offset offset) { 33 | for (var y = 0; y < ny; y++) { 34 | for (var x = 0; x < nx; x++) { 35 | final i = y * nx + x; 36 | 37 | final cx = radius * x; 38 | final cy = radius * y; 39 | 40 | final fillPaint = Paint() 41 | ..style = PaintingStyle.fill 42 | ..color = this.fillColors[i]; 43 | 44 | canvas.drawCircle( 45 | Offset(offset.dx + cx, offset.dy + cy), radius, fillPaint); 46 | 47 | // NOTE: not doing boundaries for now 48 | } 49 | } 50 | } 51 | 52 | Size get size => Size(radius * nx, radius * ny); 53 | } 54 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | example 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | .dart_tool/ 26 | .flutter-plugins 27 | .packages 28 | .pub-cache/ 29 | .pub/ 30 | /build/ 31 | 32 | # Android related 33 | **/android/**/gradle-wrapper.jar 34 | **/android/.gradle 35 | **/android/captures/ 36 | **/android/gradlew 37 | **/android/gradlew.bat 38 | **/android/local.properties 39 | **/android/**/GeneratedPluginRegistrant.java 40 | 41 | # iOS/XCode related 42 | **/ios/**/*.mode1v3 43 | **/ios/**/*.mode2v3 44 | **/ios/**/*.moved-aside 45 | **/ios/**/*.pbxuser 46 | **/ios/**/*.perspectivev3 47 | **/ios/**/*sync/ 48 | **/ios/**/.sconsign.dblite 49 | **/ios/**/.tags* 50 | **/ios/**/.vagrant/ 51 | **/ios/**/DerivedData/ 52 | **/ios/**/Icon? 53 | **/ios/**/Pods/ 54 | **/ios/**/.symlinks/ 55 | **/ios/**/profile 56 | **/ios/**/xcuserdata 57 | **/ios/.generated/ 58 | **/ios/Flutter/App.framework 59 | **/ios/Flutter/Flutter.framework 60 | **/ios/Flutter/Generated.xcconfig 61 | **/ios/Flutter/app.flx 62 | **/ios/Flutter/app.zip 63 | **/ios/Flutter/flutter_assets/ 64 | **/ios/ServiceDefinitions.json 65 | **/ios/Runner/GeneratedPluginRegistrant.* 66 | 67 | # Exceptions to above rules. 68 | !**/ios/**/default.mode1v3 69 | !**/ios/**/default.mode2v3 70 | !**/ios/**/default.pbxuser 71 | !**/ios/**/default.perspectivev3 72 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 73 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | 13 | 20 | 24 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /lib/patterns/squares.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:flutter/widgets.dart'; 4 | 5 | import 'pattern.dart'; 6 | 7 | /// A nx x ny repeating grid of squares 8 | /// 9 | /// https://github.com/suyash/geopattern_flutter/blob/master/examples/images/squares.png 10 | class Squares extends Pattern { 11 | final double side; 12 | final int nx; 13 | final int ny; 14 | final List fillColors; 15 | final Color strokeColor; 16 | 17 | Squares( 18 | {@required this.side, 19 | @required this.nx, 20 | @required this.ny, 21 | @required this.fillColors, 22 | @required this.strokeColor}) 23 | : assert(fillColors.length == nx * ny); 24 | 25 | Squares.fromHash(String hash) 26 | : assert(hash.length == 40), 27 | side = int.parse(hash[0], radix: 16) / 16.0 * 50 + 10, 28 | nx = 6, 29 | ny = 6, 30 | fillColors = hash.split("").map((String c) { 31 | final v = int.parse(c, radix: 16); 32 | final g = 50 + (v % 1) * 150; 33 | return Color.fromARGB(((v / 16.0) * 100 + 50).round(), g, g, g); 34 | }).toList(), 35 | strokeColor = Color.fromARGB(50, 0, 0, 0); 36 | 37 | void paint(Canvas canvas, Offset offset) { 38 | final strokePaint = Paint() 39 | ..style = PaintingStyle.stroke 40 | ..color = this.strokeColor; 41 | for (var y = 0; y < ny; y++) { 42 | for (var x = 0; x < nx; x++) { 43 | final i = y * nx + x; 44 | final fillPaint = Paint() 45 | ..style = PaintingStyle.fill 46 | ..color = this.fillColors[i]; 47 | final rect = Rect.fromLTWH( 48 | x * side + offset.dx, y * side + offset.dy, side, side); 49 | canvas.drawRect(rect, strokePaint); 50 | canvas.drawRect(rect, fillPaint); 51 | } 52 | } 53 | } 54 | 55 | Size get size => Size(nx * side, ny * side); 56 | } 57 | -------------------------------------------------------------------------------- /lib/patterns/overlapping_rings.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:flutter/widgets.dart'; 4 | 5 | import 'pattern.dart'; 6 | 7 | /// https://github.com/suyash/geopattern_flutter/blob/master/examples/images/overlapping_rings.png 8 | class OverlappingRings extends Pattern { 9 | final double radius; 10 | final double strokeWidth; 11 | final int nx; 12 | final int ny; 13 | final List strokeColors; 14 | 15 | OverlappingRings( 16 | {@required this.radius, 17 | @required this.strokeWidth, 18 | @required this.nx, 19 | @required this.ny, 20 | @required this.strokeColors}) 21 | : assert(strokeColors.length == nx * ny); 22 | 23 | OverlappingRings.fromHash(String hash) 24 | : assert(hash.length == 40), 25 | radius = int.parse(hash[0], radix: 16) / 16.0 * 50 + 30, 26 | strokeWidth = (int.parse(hash[0], radix: 16) / 16.0 * 50 + 30) / 5, 27 | nx = 6, 28 | ny = 6, 29 | strokeColors = hash.split("").map((String c) { 30 | final v = int.parse(c, radix: 16); 31 | final g = 50 + (v % 1) * 150; 32 | return Color.fromARGB(((v / 16.0) * 100 + 50).round(), g, g, g); 33 | }).toList(); 34 | 35 | void paint(Canvas canvas, Offset offset) { 36 | for (var y = 0; y < ny; y++) { 37 | for (var x = 0; x < nx; x++) { 38 | final i = y * nx + x; 39 | 40 | final cx = radius * x; 41 | final cy = radius * y; 42 | 43 | final fillPaint = Paint() 44 | ..style = PaintingStyle.stroke 45 | ..color = strokeColors[i] 46 | ..strokeWidth = strokeWidth; 47 | 48 | canvas.drawCircle(Offset(offset.dx + cx, offset.dy + cy), 49 | radius - strokeWidth / 2, fillPaint); 50 | 51 | // NOTE: not doing boundaries for now 52 | } 53 | } 54 | } 55 | 56 | Size get size => Size(radius * nx, radius * ny); 57 | } 58 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion 28 30 | 31 | sourceSets { 32 | main.java.srcDirs += 'src/main/kotlin' 33 | } 34 | 35 | lintOptions { 36 | disable 'InvalidPackage' 37 | } 38 | 39 | defaultConfig { 40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 41 | applicationId "io.suy.geopattern_example.example" 42 | minSdkVersion 16 43 | targetSdkVersion 28 44 | versionCode flutterVersionCode.toInteger() 45 | versionName flutterVersionName 46 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 47 | } 48 | 49 | buildTypes { 50 | release { 51 | // TODO: Add your own signing config for the release build. 52 | // Signing with the debug keys for now, so `flutter run --release` works. 53 | signingConfig signingConfigs.debug 54 | } 55 | } 56 | } 57 | 58 | flutter { 59 | source '../..' 60 | } 61 | 62 | dependencies { 63 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 64 | testImplementation 'junit:junit:4.12' 65 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 66 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 67 | } 68 | -------------------------------------------------------------------------------- /lib/patterns/diamonds.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:flutter/widgets.dart'; 4 | 5 | import 'pattern.dart'; 6 | 7 | /// A grid of diamonds with each extending w units wide and h units high 8 | /// 9 | /// https://github.com/suyash/geopattern_flutter/blob/master/examples/images/diamonds.png 10 | class Diamonds extends Pattern { 11 | final double w; 12 | final double h; 13 | final int nx; 14 | final int ny; 15 | final List fillColors; 16 | final Color strokeColor; 17 | 18 | Diamonds( 19 | {@required this.w, 20 | @required this.h, 21 | @required this.nx, 22 | @required this.ny, 23 | @required this.fillColors, 24 | @required this.strokeColor}) 25 | : assert(fillColors.length == nx * ny); 26 | 27 | Diamonds.fromHash(String hash) 28 | : assert(hash.length == 40), 29 | w = int.parse(hash[0], radix: 16) / 16.0 * 50 + 30, 30 | h = int.parse(hash[1], radix: 16) / 16.0 * 50 + 30, 31 | nx = 6, 32 | ny = 6, 33 | fillColors = hash.split("").map((String c) { 34 | final v = int.parse(c, radix: 16); 35 | final g = 50 + (v % 1) * 150; 36 | return Color.fromARGB(((v / 16.0) * 100 + 50).round(), g, g, g); 37 | }).toList(), 38 | strokeColor = Color.fromARGB(50, 0, 0, 0); 39 | 40 | void paint(Canvas canvas, Offset offset) { 41 | final strokePaint = Paint() 42 | ..style = PaintingStyle.stroke 43 | ..color = this.strokeColor; 44 | 45 | for (var y = 0; y < ny; y++) { 46 | for (var x = 0; x < nx; x++) { 47 | final i = y * nx + x; 48 | 49 | final fillPaint = Paint() 50 | ..style = PaintingStyle.fill 51 | ..color = this.fillColors[i]; 52 | 53 | final dx = y % 2 == 1 ? w / 2 : 0; 54 | 55 | final diamond = _createDiamond(Offset( 56 | offset.dx + dx + x * w - w / 2, offset.dy + (y - 1) * h / 2)); 57 | canvas.drawPath(diamond, strokePaint); 58 | canvas.drawPath(diamond, fillPaint); 59 | 60 | // NOTE: not painting edges for now 61 | } 62 | } 63 | } 64 | 65 | Path _createDiamond(Offset offset) { 66 | return Path() 67 | ..moveTo(offset.dx + w / 2.0, offset.dy) 68 | ..lineTo(offset.dx + w, offset.dy + h / 2.0) 69 | ..lineTo(offset.dx + w / 2.0, offset.dy + h) 70 | ..lineTo(offset.dx, offset.dy + h / 2.0) 71 | ..lineTo(offset.dx + w / 2.0, offset.dy); 72 | } 73 | 74 | Size get size => Size(w * nx, (h * ny / 2).ceil() * 1.0); 75 | } 76 | -------------------------------------------------------------------------------- /lib/patterns/nested_squares.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:flutter/widgets.dart'; 4 | 5 | import 'pattern.dart'; 6 | 7 | /// A nx x ny grid of a smaller square inside a larger square 8 | /// 9 | /// https://github.com/suyash/geopattern_flutter/blob/master/examples/images/nested_squares.png 10 | class NestedSquares extends Pattern { 11 | final double side; 12 | final double outerside; 13 | final int nx; 14 | final int ny; 15 | final List strokeColors; 16 | 17 | NestedSquares( 18 | {@required this.side, 19 | @required this.outerside, 20 | @required this.nx, 21 | @required this.ny, 22 | @required this.strokeColors}) 23 | : assert(strokeColors.length == nx * ny), 24 | assert(outerside > side); 25 | 26 | NestedSquares.fromHash(String hash) 27 | : assert(hash.length == 40), 28 | side = int.parse(hash[0], radix: 16) / 16.0 * 5 + 4, 29 | outerside = (int.parse(hash[0], radix: 16) / 16.0 * 5 + 4) * 7, 30 | nx = 6, 31 | ny = 6, 32 | strokeColors = hash.split("").map((String c) { 33 | final v = int.parse(c, radix: 16); 34 | final g = 50 + (v % 1) * 150; 35 | return Color.fromARGB(((v / 16.0) * 100 + 50).round(), g, g, g); 36 | }).toList(); 37 | 38 | void paint(Canvas canvas, Offset offset) { 39 | for (var y = 0; y < ny; y++) { 40 | for (var x = 0; x < nx; x++) { 41 | final i = y * nx + x; 42 | 43 | final strokePaint = Paint() 44 | ..style = PaintingStyle.stroke 45 | ..color = this.strokeColors[i] 46 | ..strokeWidth = side; 47 | 48 | final rect = Rect.fromLTWH( 49 | x * (2 * side + outerside) + side / 2 + offset.dx, 50 | y * (2 * side + outerside) + side / 2 + offset.dy, 51 | outerside, 52 | outerside); 53 | 54 | canvas.drawRect(rect, strokePaint); 55 | 56 | final outerStrokePaint = Paint() 57 | ..style = PaintingStyle.stroke 58 | ..color = this.strokeColors[i] 59 | ..strokeWidth = side; 60 | 61 | final outerRect = Rect.fromLTWH( 62 | x * (2 * side + outerside) + side * 2.5 + offset.dx, 63 | y * (2 * side + outerside) + side * 2.5 + offset.dy, 64 | side * 3, 65 | side * 3); 66 | 67 | canvas.drawRect(outerRect, outerStrokePaint); 68 | } 69 | } 70 | } 71 | 72 | Size get size => 73 | Size(nx * (2 * side + outerside), ny * (2 * side + outerside)); 74 | } 75 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /lib/patterns/octagons.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:flutter/widgets.dart'; 4 | 5 | import 'pattern.dart'; 6 | 7 | /// https://github.com/jasonlong/geo_pattern/blob/master/lib/geo_pattern/structure_generators/octagons_generator.rb 8 | /// 9 | /// https://github.com/suyash/geopattern_flutter/blob/master/examples/images/octagons.png 10 | class Octagons extends Pattern { 11 | final double side; 12 | final int nx; 13 | final int ny; 14 | final List fillColors; 15 | final Color strokeColor; 16 | 17 | Octagons( 18 | {@required this.side, 19 | @required this.nx, 20 | @required this.ny, 21 | @required this.fillColors, 22 | @required this.strokeColor}) 23 | : assert(fillColors.length == nx * ny); 24 | 25 | Octagons.fromHash(String hash) 26 | : assert(hash.length == 40), 27 | side = int.parse(hash[0], radix: 16) / 16.0 * 20 + 20, 28 | nx = 6, 29 | ny = 6, 30 | fillColors = hash.split("").map((String c) { 31 | final v = int.parse(c, radix: 16); 32 | final g = 50 + (v % 1) * 150; 33 | return Color.fromARGB(((v / 16.0) * 100 + 50).round(), g, g, g); 34 | }).toList(), 35 | strokeColor = Color.fromARGB(50, 0, 0, 0); 36 | 37 | void paint(Canvas canvas, Offset offset) { 38 | final strokePaint = Paint() 39 | ..style = PaintingStyle.stroke 40 | ..color = this.strokeColor; 41 | 42 | for (var y = 0; y < ny; y++) { 43 | for (var x = 0; x < nx; x++) { 44 | final i = y * nx + x; 45 | 46 | final fillPaint = Paint() 47 | ..style = PaintingStyle.fill 48 | ..color = this.fillColors[i]; 49 | 50 | final oct = 51 | _createOctagon(Offset(offset.dx + x * side, offset.dy + y * side)); 52 | canvas.drawPath(oct, fillPaint); 53 | canvas.drawPath(oct, strokePaint); 54 | } 55 | } 56 | } 57 | 58 | Path _createOctagon(Offset offset) { 59 | return Path() 60 | ..moveTo(offset.dx + side / 3, offset.dy + 0) 61 | ..lineTo(offset.dx + 2 * side / 3, offset.dy + 0) 62 | ..lineTo(offset.dx + side, offset.dy + side / 3) 63 | ..lineTo(offset.dx + side, offset.dy + 2 * side / 3) 64 | ..lineTo(offset.dx + 2 * side / 3, offset.dy + side) 65 | ..lineTo(offset.dx + side / 3, offset.dy + side) 66 | ..lineTo(offset.dx + 0, offset.dy + 2 * side / 3) 67 | ..lineTo(offset.dx + 0, offset.dy + side / 3) 68 | ..lineTo(offset.dx + side / 3, offset.dy + 0); 69 | } 70 | 71 | Size get size => Size(side * nx, side * ny); 72 | } 73 | -------------------------------------------------------------------------------- /lib/patterns/concentric_circles.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:flutter/widgets.dart'; 4 | 5 | import 'pattern.dart'; 6 | 7 | /// A nw x nh repeating grid of circles 8 | /// 9 | /// https://github.com/suyash/geopattern_flutter/blob/master/examples/images/concentric_circles.png 10 | class ConcentricCircles extends Pattern { 11 | final double radius; 12 | final double strokeWidth; 13 | final int nx; 14 | final int ny; 15 | final List strokeColors; 16 | final List fillColors; 17 | 18 | ConcentricCircles( 19 | {@required this.radius, 20 | @required this.strokeWidth, 21 | @required this.nx, 22 | @required this.ny, 23 | @required this.strokeColors, 24 | @required this.fillColors}) 25 | : assert(strokeColors.length == nx * ny), 26 | assert(fillColors.length == nx * ny); 27 | 28 | ConcentricCircles.fromHash(String hash) 29 | : assert(hash.length == 40), 30 | radius = int.parse(hash[0], radix: 16) / 16.0 * 50 + 10, 31 | strokeWidth = (int.parse(hash[0], radix: 16) / 16.0 * 50 + 10) / 5, 32 | nx = 6, 33 | ny = 6, 34 | fillColors = hash.split("").map((String c) { 35 | final v = int.parse(c, radix: 16); 36 | final g = 50 + (v % 1) * 150; 37 | return Color.fromARGB(((v / 16.0) * 100 + 50).round(), g, g, g); 38 | }).toList(), 39 | strokeColors = hash.split("").map((String c) { 40 | final v = int.parse(c, radix: 16); 41 | final g = 50 + (v % 1) * 150; 42 | return Color.fromARGB(((v / 16.0) * 100 + 50).round(), g, g, g); 43 | }).toList(); 44 | 45 | void paint(Canvas canvas, Offset offset) { 46 | for (var y = 0; y < ny; y++) { 47 | for (var x = 0; x < nx; x++) { 48 | final i = y * nx + x; 49 | 50 | final cx = (radius + strokeWidth) * (x + 0.5); 51 | final cy = (radius + strokeWidth) * (y + 0.5); 52 | 53 | final strokePaint = Paint() 54 | ..style = PaintingStyle.stroke 55 | ..color = this.strokeColors[i] 56 | ..strokeWidth = strokeWidth; 57 | canvas.drawCircle( 58 | Offset(offset.dx + cx, offset.dy + cy), radius / 2, strokePaint); 59 | 60 | final fillPaint = Paint() 61 | ..style = PaintingStyle.fill 62 | ..color = this.fillColors[i]; 63 | canvas.drawCircle( 64 | Offset(offset.dx + cx, offset.dy + cy), radius / 4, fillPaint); 65 | } 66 | } 67 | } 68 | 69 | Size get size => 70 | Size((radius + strokeWidth) * nx, (radius + strokeWidth) * ny); 71 | } 72 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:geopattern_flutter/geopattern_flutter.dart'; 5 | import 'package:geopattern_flutter/patterns/overlapping_circles.dart'; 6 | 7 | void main() => runApp(App()); 8 | 9 | class App extends StatelessWidget { 10 | @override 11 | Widget build(BuildContext context) { 12 | return MaterialApp( 13 | home: Scaffold( 14 | body: CustomScrollView( 15 | slivers: [ 16 | SliverAppBar( 17 | backgroundColor: Colors.yellow, 18 | expandedHeight: 256, 19 | pinned: true, 20 | flexibleSpace: FlexibleSpaceBar( 21 | title: const Text("AppBar"), 22 | background: Stack( 23 | fit: StackFit.expand, 24 | children: [ 25 | AppBarBackground(), 26 | const DecoratedBox( 27 | decoration: BoxDecoration( 28 | gradient: LinearGradient( 29 | begin: Alignment(0.0, -1.0), 30 | end: Alignment(0.0, -0.4), 31 | colors: [Color(0x60000000), Color(0x00000000)], 32 | ), 33 | ), 34 | ), 35 | ], 36 | ), 37 | ), 38 | ), 39 | SliverList( 40 | delegate: SliverChildListDelegate([ 41 | Card(child: Container(height: 200)), 42 | Card(child: Container(height: 200)), 43 | Card(child: Container(height: 200)), 44 | Card(child: Container(height: 200)), 45 | Card(child: Container(height: 200)), 46 | Card(child: Container(height: 200)), 47 | ])) 48 | ], 49 | ), 50 | )); 51 | } 52 | } 53 | 54 | class AppBarBackground extends StatelessWidget { 55 | @override 56 | Widget build(BuildContext context) { 57 | return LayoutBuilder(builder: (context, constraints) { 58 | final gen = Random(); 59 | final pattern = OverlappingCircles( 60 | radius: 60, 61 | nx: 6, 62 | ny: 6, 63 | fillColors: List.generate( 64 | 36, 65 | (int i) => Color.fromARGB( 66 | 10 + (gen.nextDouble() * 100).round(), 67 | 50 + gen.nextInt(2) * 150, 68 | 50 + gen.nextInt(2) * 150, 69 | 50 + gen.nextInt(2) * 150))); 70 | return CustomPaint( 71 | size: Size(constraints.maxWidth, constraints.maxHeight), 72 | painter: FullPainter(pattern: pattern, background: Colors.yellow)); 73 | }); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /lib/patterns/triangles.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | import 'dart:ui'; 3 | 4 | import 'package:flutter/widgets.dart'; 5 | 6 | import 'pattern.dart'; 7 | 8 | /// https://github.com/suyash/geopattern_flutter/blob/master/examples/images/triangles.png 9 | class Triangles extends Pattern { 10 | final double side; 11 | final int nx; 12 | final int ny; 13 | final List fillColors; 14 | final Color strokeColor; 15 | 16 | final double _trih; 17 | 18 | Triangles( 19 | {@required this.side, 20 | @required this.nx, 21 | @required this.ny, 22 | @required this.fillColors, 23 | @required this.strokeColor}) 24 | : assert(fillColors.length == nx * ny), 25 | _trih = sqrt(3) * side / 2; 26 | 27 | Triangles.fromHash(String hash) 28 | : assert(hash.length == 40), 29 | side = int.parse(hash[0], radix: 16) / 16.0 * 50 + 30, 30 | nx = 6, 31 | ny = 6, 32 | fillColors = hash.split("").map((String c) { 33 | final v = int.parse(c, radix: 16); 34 | final g = 50 + (v % 1) * 150; 35 | return Color.fromARGB(((v / 16.0) * 100 + 50).round(), g, g, g); 36 | }).toList(), 37 | strokeColor = Color.fromARGB(50, 0, 0, 0), 38 | _trih = sqrt(3) * (int.parse(hash[0], radix: 16) / 16.0 * 50 + 30) / 2; 39 | 40 | void paint(Canvas canvas, Offset offset) { 41 | final strokePaint = Paint() 42 | ..style = PaintingStyle.stroke 43 | ..color = strokeColor; 44 | for (var y = 0; y < ny; y++) { 45 | for (var x = 0; x < nx; x++) { 46 | final off = Offset(x * side / 2 - side / 2, _trih * y); 47 | final triangle = x % 2 == y % 2 48 | ? _createInvertedTriangle(offset + off + Offset(side / 2, 0)) 49 | : _createTriangle(offset + off); 50 | 51 | final fillPaint = Paint() 52 | ..style = PaintingStyle.fill 53 | ..color = this.fillColors[y * nx + x]; 54 | canvas.drawPath(triangle, fillPaint); 55 | canvas.drawPath(triangle, strokePaint); 56 | } 57 | } 58 | } 59 | 60 | Path _createTriangle(Offset offset) { 61 | return Path() 62 | ..moveTo(offset.dx + side / 2, offset.dy + 0) 63 | ..lineTo(offset.dx + side, offset.dy + _trih) 64 | ..lineTo(offset.dx + 0, offset.dy + _trih) 65 | ..lineTo(offset.dx + side / 2, offset.dy + 0); 66 | } 67 | 68 | Path _createInvertedTriangle(Offset offset) { 69 | return Path() 70 | ..moveTo(offset.dx + -side / 2, offset.dy + 0) 71 | ..lineTo(offset.dx + -side, offset.dy + -_trih) 72 | ..lineTo(offset.dx + 0, offset.dy + -_trih) 73 | ..lineTo(offset.dx + -side / 2, offset.dy + 0); 74 | } 75 | 76 | Size get size => Size(side * nx / 2, _trih * ny); 77 | } 78 | -------------------------------------------------------------------------------- /lib/patterns/plus_signs.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:flutter/widgets.dart'; 4 | 5 | import 'pattern.dart'; 6 | 7 | /// https://github.com/suyash/geopattern_flutter/blob/master/examples/images/plus_signs.png 8 | class PlusSigns extends Pattern { 9 | final double side; 10 | final int nx; 11 | final int ny; 12 | final List fillColors; 13 | final Color strokeColor; 14 | final double _midl; 15 | final double _midh; 16 | 17 | PlusSigns( 18 | {@required this.side, 19 | @required this.nx, 20 | @required this.ny, 21 | @required this.fillColors, 22 | @required this.strokeColor}) 23 | : assert(fillColors.length == nx * ny), 24 | _midl = side / 3, 25 | _midh = 2 * side / 3; 26 | 27 | PlusSigns.fromHash(String hash) 28 | : assert(hash.length == 40), 29 | side = int.parse(hash[0], radix: 16) / 16.0 * 50 + 30, 30 | nx = 6, 31 | ny = 6, 32 | fillColors = hash.split("").map((String c) { 33 | final v = int.parse(c, radix: 16); 34 | final g = 50 + (v % 1) * 150; 35 | return Color.fromARGB(((v / 16.0) * 100 + 50).round(), g, g, g); 36 | }).toList(), 37 | strokeColor = Color.fromARGB(50, 0, 0, 0), 38 | _midl = (int.parse(hash[0], radix: 16) / 16.0 * 50 + 30) / 3, 39 | _midh = 2 * (int.parse(hash[0], radix: 16) / 16.0 * 50 + 30) / 3; 40 | 41 | void paint(Canvas canvas, Offset offset) { 42 | final strokePaint = Paint() 43 | ..style = PaintingStyle.stroke 44 | ..color = strokeColor; 45 | for (var y = 0; y < ny; y++) { 46 | for (var x = 0; x < nx; x++) { 47 | final fillPaint = Paint() 48 | ..style = PaintingStyle.fill 49 | ..color = this.fillColors[y * nx + x]; 50 | final dx = y % 2; 51 | final plus = _createPlus(offset + 52 | Offset(x * _midh + _midl * (dx - 1), y * _midh - side / 2)); 53 | canvas.drawPath(plus, fillPaint); 54 | canvas.drawPath(plus, strokePaint); 55 | } 56 | } 57 | } 58 | 59 | Path _createPlus(Offset offset) { 60 | return Path() 61 | ..moveTo(offset.dx + _midl, offset.dy + 0) 62 | ..lineTo(offset.dx + _midh, offset.dy + 0) 63 | ..lineTo(offset.dx + _midh, offset.dy + _midl) 64 | ..lineTo(offset.dx + side, offset.dy + _midl) 65 | ..lineTo(offset.dx + side, offset.dy + _midh) 66 | ..lineTo(offset.dx + _midh, offset.dy + _midh) 67 | ..lineTo(offset.dx + _midh, offset.dy + side) 68 | ..lineTo(offset.dx + _midl, offset.dy + side) 69 | ..lineTo(offset.dx + _midl, offset.dy + _midh) 70 | ..lineTo(offset.dx + 0, offset.dy + _midh) 71 | ..lineTo(offset.dx + 0, offset.dy + _midl) 72 | ..lineTo(offset.dx + _midl, offset.dy + _midl) 73 | ..lineTo(offset.dx + _midl, offset.dy + 0); 74 | } 75 | 76 | Size get size => Size(side * nx / 3, side * ny / 3); 77 | } 78 | -------------------------------------------------------------------------------- /lib/patterns/sine_waves.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:flutter/widgets.dart'; 4 | 5 | import 'pattern.dart'; 6 | 7 | /// Draws Sine waves using a cubic bezier curve approximation 8 | /// The approximation is different from the original library, this 9 | /// draws only a single period using 2 cubic paths. 10 | /// 11 | /// https://github.com/suyash/geopattern_flutter/blob/master/examples/images/sine_waves.png 12 | class SineWaves extends Pattern { 13 | final double amplitude; 14 | final double period; 15 | final List strokeOffsets; 16 | final double strokeWidth; 17 | final List strokeColors; 18 | final double _xoff; 19 | 20 | SineWaves( 21 | {@required this.period, 22 | @required this.amplitude, 23 | @required this.strokeOffsets, 24 | @required this.strokeWidth, 25 | @required this.strokeColors}) 26 | : _xoff = (period / 4) * .7, 27 | assert(strokeOffsets.length == strokeColors.length); 28 | 29 | SineWaves.fromHash(String hash) 30 | : assert(hash.length == 40), 31 | amplitude = int.parse(hash[0], radix: 16) / 16.0 * 50 + 20, 32 | period = int.parse(hash[1], radix: 16) / 16.0 * 50 + 100, 33 | strokeOffsets = hash.split("").map((String c) { 34 | final v = int.parse(c, radix: 16); 35 | final amplitude = int.parse(hash[0], radix: 16) / 16.0 * 300 + 100; 36 | return v / 16 * amplitude - amplitude / 2; 37 | }).toList(), 38 | strokeWidth = int.parse(hash[2], radix: 16) * 1.0, 39 | strokeColors = hash.split("").map((String c) { 40 | final v = int.parse(c, radix: 16); 41 | final g = 50 + (v % 1) * 150; 42 | return Color.fromARGB(((v / 16.0) * 100 + 50).round(), g, g, g); 43 | }).toList(), 44 | _xoff = ((int.parse(hash[1], radix: 16) / 16.0 * 70 + 30) / 4) * .7; 45 | 46 | void paint(Canvas canvas, Offset offset) { 47 | for (var i = 0; i < strokeOffsets.length; i++) { 48 | final strokePaint = Paint() 49 | ..style = PaintingStyle.stroke 50 | ..color = strokeColors[i] 51 | ..strokeWidth = strokeWidth; 52 | final wave = _createWave(offset + Offset(0, strokeOffsets[i])); 53 | canvas.drawPath(wave, strokePaint); 54 | } 55 | } 56 | 57 | Path _createWave(Offset offset) { 58 | return Path() 59 | ..moveTo(offset.dx + 0, offset.dy + amplitude) 60 | ..cubicTo( 61 | offset.dx + _xoff, 62 | offset.dy + 0, 63 | offset.dx + period / 2 - _xoff, 64 | offset.dy + 0, 65 | offset.dx + period / 2, 66 | offset.dy + amplitude) 67 | ..cubicTo( 68 | offset.dx + period / 2 + _xoff, 69 | offset.dy + amplitude * 2, 70 | offset.dx + period - _xoff, 71 | offset.dy + amplitude * 2, 72 | offset.dx + period, 73 | offset.dy + amplitude); 74 | } 75 | 76 | Size get size => Size(period, amplitude); 77 | } 78 | -------------------------------------------------------------------------------- /lib/patterns/hexagons.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | import 'dart:ui'; 3 | 4 | import 'package:flutter/widgets.dart'; 5 | 6 | import 'pattern.dart'; 7 | 8 | /// https://github.com/jasonlong/geo_pattern/blob/master/lib/geo_pattern/structure_generators/hexagons_generator.rb 9 | /// 10 | /// https://github.com/suyash/geopattern_flutter/blob/master/examples/images/hexagons.png 11 | class Hexagons extends Pattern { 12 | final double side; 13 | final int nx; 14 | final int ny; 15 | final List fillColors; 16 | final Color strokeColor; 17 | final double _hexWidth; 18 | final double _hexHeight; 19 | 20 | Hexagons( 21 | {@required this.side, 22 | @required this.nx, 23 | @required this.ny, 24 | @required this.fillColors, 25 | @required this.strokeColor}) 26 | : assert(fillColors.length == nx * ny), 27 | _hexWidth = side * 2, 28 | _hexHeight = side * sqrt(3); 29 | 30 | Hexagons.fromHash(String hash) 31 | : assert(hash.length == 40), 32 | side = int.parse(hash[0], radix: 16) / 16.0 * 30 + 8, 33 | nx = 6, 34 | ny = 6, 35 | fillColors = hash.split("").map((String c) { 36 | final v = int.parse(c, radix: 16); 37 | final g = 50 + (v % 1) * 150; 38 | return Color.fromARGB(((v / 16.0) * 100 + 50).round(), g, g, g); 39 | }).toList(), 40 | strokeColor = Color.fromARGB(50, 0, 0, 0), 41 | _hexWidth = (int.parse(hash[0], radix: 16) / 16.0 * 30 + 8) * 2, 42 | _hexHeight = (int.parse(hash[0], radix: 16) / 16.0 * 30 + 8) * sqrt(3); 43 | 44 | void paint(Canvas canvas, Offset offset) { 45 | final strokePaint = Paint() 46 | ..style = PaintingStyle.stroke 47 | ..color = this.strokeColor; 48 | 49 | for (var y = 0; y < ny; y++) { 50 | for (var x = 0; x < nx; x++) { 51 | final i = y * nx + x; 52 | 53 | final dy = _hexHeight * y + (x % 2) * (_hexHeight / 2); 54 | 55 | final fillPaint = Paint() 56 | ..style = PaintingStyle.fill 57 | ..color = this.fillColors[i]; 58 | 59 | final hex = _createHexagon(Offset( 60 | offset.dx + x * 1.5 * side - _hexWidth / 2, 61 | offset.dy + dy - _hexHeight / 2)); 62 | canvas.drawPath(hex, fillPaint); 63 | canvas.drawPath(hex, strokePaint); 64 | 65 | // NOTE: not doing edge tiling for now 66 | } 67 | } 68 | } 69 | 70 | Path _createHexagon(Offset offset) { 71 | return Path() 72 | ..moveTo(offset.dx + 0, offset.dy + _hexHeight / 2) 73 | ..lineTo(offset.dx + side / 2, offset.dy + 0) 74 | ..lineTo(offset.dx + (3 * side) / 2, offset.dy + 0) 75 | ..lineTo(offset.dx + side * 2, offset.dy + _hexHeight / 2) 76 | ..lineTo(offset.dx + (3 * side) / 2, offset.dy + 2 * _hexHeight / 2) 77 | ..lineTo(offset.dx + side / 2, offset.dy + 2 * _hexHeight / 2) 78 | ..lineTo(offset.dx + 0, offset.dy + _hexHeight / 2); 79 | } 80 | 81 | Size get size => Size((_hexWidth + side) * nx / 2, _hexHeight * ny); 82 | } 83 | -------------------------------------------------------------------------------- /lib/patterns/chevrons.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:flutter/widgets.dart'; 4 | 5 | import 'pattern.dart'; 6 | 7 | /// https://github.com/suyash/geopattern_flutter/blob/master/examples/images/chevrons.png 8 | class Chevrons extends Pattern { 9 | final double side; 10 | final int nx; 11 | final int ny; 12 | final List fillColors; 13 | final Color strokeColor; 14 | 15 | Chevrons( 16 | {@required this.side, 17 | @required this.nx, 18 | @required this.ny, 19 | @required this.fillColors, 20 | @required this.strokeColor}) 21 | : assert(fillColors.length == nx * ny); 22 | 23 | Chevrons.fromHash(String hash) 24 | : assert(hash.length == 40), 25 | side = int.parse(hash[0], radix: 16) / 16.0 * 50 + 30, 26 | nx = 6, 27 | ny = 6, 28 | fillColors = hash.split("").map((String c) { 29 | final v = int.parse(c, radix: 16); 30 | final g = 50 + (v % 1) * 150; 31 | return Color.fromARGB(((v / 16.0) * 100 + 50).round(), g, g, g); 32 | }).toList(), 33 | strokeColor = Color.fromARGB(50, 0, 0, 0); 34 | 35 | void paint(Canvas canvas, Offset offset) { 36 | final strokePaint = Paint() 37 | ..style = PaintingStyle.stroke 38 | ..color = this.strokeColor 39 | ..strokeWidth = 1; 40 | 41 | for (var y = 0; y < ny; y++) { 42 | for (var x = 0; x < nx; x++) { 43 | final i = y * nx + x; 44 | 45 | final fillPaint = Paint() 46 | ..style = PaintingStyle.fill 47 | ..color = this.fillColors[i]; 48 | 49 | final leftChevron = _createChevronLeft(Offset( 50 | offset.dx + x * side, offset.dy + (2 * side * y) / 3 - side / 2)); 51 | final rightChevron = _createChevronRight(Offset( 52 | offset.dx + x * side, offset.dy + (2 * side * y) / 3 - side / 2)); 53 | 54 | canvas.drawPath(leftChevron, strokePaint); 55 | canvas.drawPath(leftChevron, fillPaint); 56 | canvas.drawPath(rightChevron, strokePaint); 57 | canvas.drawPath(rightChevron, fillPaint); 58 | 59 | // NOTE: not filling gaps in topmost row for now 60 | } 61 | } 62 | } 63 | 64 | Path _createChevronLeft(Offset offset) { 65 | final e = (side * 2) / 3; 66 | return Path() 67 | ..moveTo(offset.dx, offset.dy) 68 | ..lineTo(offset.dx + side / 2, offset.dy + side - e) 69 | ..lineTo(offset.dx + side / 2, offset.dy + side) 70 | ..lineTo(offset.dx, offset.dy + e) 71 | ..lineTo(offset.dx, offset.dy); 72 | } 73 | 74 | Path _createChevronRight(Offset offset) { 75 | final e = (side * 2) / 3; 76 | return Path() 77 | ..moveTo(offset.dx + side / 2, offset.dy + side - e) 78 | ..lineTo(offset.dx + side, offset.dy) 79 | ..lineTo(offset.dx + side, offset.dy + e) 80 | ..lineTo(offset.dx + side / 2, offset.dy + side) 81 | ..lineTo(offset.dx + side / 2, offset.dy + side - e); 82 | } 83 | 84 | Size get size => Size(side * nx, ((side * ny * 2) / 3).ceil() * 1.0); 85 | } 86 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "2.2.0" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "1.0.4" 18 | charcode: 19 | dependency: transitive 20 | description: 21 | name: charcode 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "1.1.2" 25 | collection: 26 | dependency: transitive 27 | description: 28 | name: collection 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "1.14.11" 32 | flutter: 33 | dependency: "direct main" 34 | description: flutter 35 | source: sdk 36 | version: "0.0.0" 37 | flutter_test: 38 | dependency: "direct dev" 39 | description: flutter 40 | source: sdk 41 | version: "0.0.0" 42 | matcher: 43 | dependency: transitive 44 | description: 45 | name: matcher 46 | url: "https://pub.dartlang.org" 47 | source: hosted 48 | version: "0.12.5" 49 | meta: 50 | dependency: transitive 51 | description: 52 | name: meta 53 | url: "https://pub.dartlang.org" 54 | source: hosted 55 | version: "1.1.6" 56 | path: 57 | dependency: transitive 58 | description: 59 | name: path 60 | url: "https://pub.dartlang.org" 61 | source: hosted 62 | version: "1.6.2" 63 | pedantic: 64 | dependency: transitive 65 | description: 66 | name: pedantic 67 | url: "https://pub.dartlang.org" 68 | source: hosted 69 | version: "1.7.0" 70 | quiver: 71 | dependency: transitive 72 | description: 73 | name: quiver 74 | url: "https://pub.dartlang.org" 75 | source: hosted 76 | version: "2.0.3" 77 | sky_engine: 78 | dependency: transitive 79 | description: flutter 80 | source: sdk 81 | version: "0.0.99" 82 | source_span: 83 | dependency: transitive 84 | description: 85 | name: source_span 86 | url: "https://pub.dartlang.org" 87 | source: hosted 88 | version: "1.5.5" 89 | stack_trace: 90 | dependency: transitive 91 | description: 92 | name: stack_trace 93 | url: "https://pub.dartlang.org" 94 | source: hosted 95 | version: "1.9.3" 96 | stream_channel: 97 | dependency: transitive 98 | description: 99 | name: stream_channel 100 | url: "https://pub.dartlang.org" 101 | source: hosted 102 | version: "2.0.0" 103 | string_scanner: 104 | dependency: transitive 105 | description: 106 | name: string_scanner 107 | url: "https://pub.dartlang.org" 108 | source: hosted 109 | version: "1.0.4" 110 | term_glyph: 111 | dependency: transitive 112 | description: 113 | name: term_glyph 114 | url: "https://pub.dartlang.org" 115 | source: hosted 116 | version: "1.1.0" 117 | test_api: 118 | dependency: transitive 119 | description: 120 | name: test_api 121 | url: "https://pub.dartlang.org" 122 | source: hosted 123 | version: "0.2.5" 124 | typed_data: 125 | dependency: transitive 126 | description: 127 | name: typed_data 128 | url: "https://pub.dartlang.org" 129 | source: hosted 130 | version: "1.1.6" 131 | vector_math: 132 | dependency: transitive 133 | description: 134 | name: vector_math 135 | url: "https://pub.dartlang.org" 136 | source: hosted 137 | version: "2.0.8" 138 | sdks: 139 | dart: ">=2.2.2 <3.0.0" 140 | -------------------------------------------------------------------------------- /lib/patterns/plaid.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:flutter/widgets.dart'; 4 | 5 | import 'pattern.dart'; 6 | 7 | /// https://github.com/suyash/geopattern_flutter/blob/master/examples/images/plaid.png 8 | class Plaid extends Pattern { 9 | final List horizontalOffsets; 10 | final List verticalOffsets; 11 | final List horizontalSizes; 12 | final List verticalSizes; 13 | final List horizontalFillColors; 14 | final List verticalFillColors; 15 | final int _nx; 16 | final int _ny; 17 | 18 | Plaid( 19 | {@required this.horizontalOffsets, 20 | @required this.verticalOffsets, 21 | @required this.horizontalSizes, 22 | @required this.verticalSizes, 23 | @required this.horizontalFillColors, 24 | @required this.verticalFillColors}) 25 | : _nx = horizontalSizes.length, 26 | _ny = verticalSizes.length, 27 | assert(horizontalFillColors.length == horizontalSizes.length), 28 | assert(verticalFillColors.length == verticalSizes.length), 29 | assert(horizontalOffsets.length == horizontalSizes.length), 30 | assert(verticalOffsets.length == verticalSizes.length); 31 | 32 | Plaid.fromHash(String hash) 33 | : assert(hash.length == 40), 34 | horizontalOffsets = hash 35 | .substring(0, 20) 36 | .split("") 37 | .map((String a) => int.parse(a, radix: 16) + 5.0) 38 | .toList(), 39 | verticalOffsets = hash 40 | .substring(0, 20) 41 | .split("") 42 | .map((String a) => int.parse(a, radix: 16) + 5.0) 43 | .toList(), 44 | horizontalSizes = hash 45 | .substring(20) 46 | .split("") 47 | .map((String a) => int.parse(a, radix: 16) + 5.0) 48 | .toList(), 49 | verticalSizes = hash 50 | .substring(20) 51 | .split("") 52 | .map((String a) => int.parse(a, radix: 16) + 5.0) 53 | .toList(), 54 | horizontalFillColors = hash 55 | .substring(0, 20) 56 | .split("") 57 | .map((String a) => Color.fromARGB( 58 | (50 + (int.parse(a, radix: 16) / 16) * 150).round(), 59 | 50 + (int.parse(a, radix: 16) % 2) * 150, 60 | 50 + (int.parse(a, radix: 16) % 2) * 150, 61 | 50 + (int.parse(a, radix: 16) % 2) * 150)) 62 | .toList(), 63 | verticalFillColors = hash 64 | .substring(20) 65 | .split("") 66 | .map((String a) => Color.fromARGB( 67 | (50 + (int.parse(a, radix: 16) / 16) * 150).round(), 68 | 50 + (int.parse(a, radix: 16) % 2) * 150, 69 | 50 + (int.parse(a, radix: 16) % 2) * 150, 70 | 50 + (int.parse(a, radix: 16) % 2) * 150)) 71 | .toList(), 72 | _nx = 20, 73 | _ny = 20; 74 | 75 | void paint(Canvas canvas, Offset offset) { 76 | double left = 0; 77 | for (var i = 0; i < _nx; i++) { 78 | left += horizontalOffsets[i]; 79 | final rect = Rect.fromLTWH( 80 | offset.dx + left, offset.dy, horizontalSizes[i], size.height); 81 | final fillPaint = Paint() 82 | ..style = PaintingStyle.fill 83 | ..color = this.horizontalFillColors[i]; 84 | canvas.drawRect(rect, fillPaint); 85 | left += horizontalSizes[i]; 86 | } 87 | 88 | double top = 0; 89 | for (var i = 0; i < _ny; i++) { 90 | top += verticalOffsets[i]; 91 | final rect = Rect.fromLTWH( 92 | offset.dx, offset.dy + top, size.width, verticalSizes[i]); 93 | final fillPaint = Paint() 94 | ..style = PaintingStyle.fill 95 | ..color = this.verticalFillColors[i]; 96 | canvas.drawRect(rect, fillPaint); 97 | top += verticalSizes[i]; 98 | } 99 | } 100 | 101 | Size get size => Size( 102 | horizontalSizes.reduce((a, b) => a + b) + 103 | horizontalOffsets.reduce((a, b) => a + b), 104 | verticalSizes.reduce((a, b) => a + b) + 105 | verticalOffsets.reduce((a, b) => a + b)); 106 | } 107 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # geopattern_flutter 2 | 3 | [![pub package](https://img.shields.io/pub/v/geopattern_flutter.svg)](https://pub.dartlang.org/packages/geopattern_flutter) 4 | 5 | > Flutter Port of [jasonlong/geo_pattern](https://github.com/jasonlong/geo_pattern) 6 | 7 | Geometric Patterns for Flutter using `CustomPainter`s. 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | ## Simple Example 27 | 28 | ```dart 29 | import 'dart:convert'; 30 | 31 | import 'package:crypto/crypto.dart'; 32 | import 'package:flutter/material.dart'; 33 | import 'package:geopattern_flutter/geopattern_flutter.dart'; 34 | import 'package:geopattern_flutter/patterns/mosaic_squares.dart'; 35 | 36 | void main() => runApp(App()); 37 | 38 | class App extends StatelessWidget { 39 | @override 40 | Widget build(BuildContext context) { 41 | final hash = sha1.convert(utf8.encode("flutter")).toString(); 42 | return LayoutBuilder(builder: (context, constraints) { 43 | final pattern = MosaicSquares.fromHash(hash); 44 | return CustomPaint( 45 | size: Size(constraints.maxWidth, constraints.maxHeight), 46 | painter: FullPainter(pattern: pattern, background: Colors.blueGrey)); 47 | }); 48 | } 49 | } 50 | ``` 51 | 52 | creates 53 | 54 | 55 | 56 | Patterns are fully customizable, for example a pattern created as 57 | 58 | ```dart 59 | final pattern = ConcentricCircles( 60 | radius: 40, 61 | strokeWidth: 8, 62 | nx: 6, 63 | ny: 6, 64 | strokeColors: List.generate( 65 | 36, 66 | (int i) => Color.fromARGB( 67 | 10 + (gen.nextDouble() * 100).round(), 68 | 50 + gen.nextInt(2) * 150, 69 | 50 + gen.nextInt(2) * 150, 70 | 50 + gen.nextInt(2) * 150)), 71 | fillColors: List.generate( 72 | 36, 73 | (int i) => Color.fromARGB( 74 | 10 + (gen.nextDouble() * 100).round(), 75 | 50 + gen.nextInt(2) * 150, 76 | 50 + gen.nextInt(2) * 150, 77 | 50 + gen.nextInt(2) * 150))); 78 | ``` 79 | 80 | renders 81 | 82 | 83 | 84 | Each pattern has an associated `size`. The `FillPainter` class implements `CustomPainter` such that the pattern is repetitively painted across the entire width and height of the canvas. However, each `Pattern` has a `paint(Canvas, Offset)` method that can be used to paint on its own. 85 | 86 | There is an example for using a pattern as a background for `SliverAppBar` in `example/appbar.dart` 87 | 88 | [Demo](https://i.imgur.com/iPj0sMo.mp4) 89 | 90 | ### TODO 91 | 92 | - Tesselation 93 | - Xes 94 | -------------------------------------------------------------------------------- /lib/patterns/mosaic_squares.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | import 'package:flutter/widgets.dart'; 4 | 5 | import 'pattern.dart'; 6 | 7 | /// https://github.com/suyash/geopattern_flutter/blob/master/examples/images/mosaic_squares.png 8 | class MosaicSquares extends Pattern { 9 | final double side; 10 | final int nx; 11 | final int ny; 12 | final List fillColors; 13 | final Color strokeColor; 14 | 15 | MosaicSquares( 16 | {@required this.side, 17 | @required this.nx, 18 | @required this.ny, 19 | @required this.fillColors, 20 | @required this.strokeColor}) 21 | : assert(fillColors.length == 2 * nx * ny); 22 | 23 | MosaicSquares.fromHash(String hash) 24 | : assert(hash.length == 40), 25 | side = int.parse(hash[0], radix: 16) / 16.0 * 10 + 15, 26 | nx = 4, 27 | ny = 4, 28 | fillColors = hash.substring(0, 32).split("").map((String c) { 29 | final v = int.parse(c, radix: 16); 30 | final g = 50 + (v % 1) * 150; 31 | return Color.fromARGB(((v / 16.0) * 100 + 50).round(), g, g, g); 32 | }).toList(), 33 | strokeColor = Color.fromARGB(50, 0, 0, 0); 34 | 35 | void paint(Canvas canvas, Offset offset) { 36 | final strokePaint = Paint() 37 | ..style = PaintingStyle.fill 38 | ..color = this.strokeColor; 39 | 40 | for (var y = 0; y < ny; y++) { 41 | for (var x = 0; x < nx; x++) { 42 | final i = y * nx + x; 43 | 44 | if (x % 2 == 1) { 45 | if (y % 2 == 1) { 46 | final fillPaint = Paint() 47 | ..style = PaintingStyle.fill 48 | ..color = this.fillColors[i]; 49 | _drawOuter( 50 | canvas, 51 | Offset(2 * side * x + offset.dx, 2 * side * y + offset.dy), 52 | strokePaint, 53 | fillPaint); 54 | } else { 55 | final fillPaint1 = Paint() 56 | ..style = PaintingStyle.fill 57 | ..color = this.fillColors[i]; 58 | final fillPaint2 = Paint() 59 | ..style = PaintingStyle.fill 60 | ..color = this.fillColors[i + nx * ny]; 61 | _drawInner( 62 | canvas, 63 | Offset(2 * side * x + offset.dx, 2 * side * y + offset.dy), 64 | strokePaint, 65 | fillPaint1, 66 | fillPaint2); 67 | } 68 | } else { 69 | if (y % 2 == 1) { 70 | final fillPaint1 = Paint() 71 | ..style = PaintingStyle.fill 72 | ..color = this.fillColors[i]; 73 | final fillPaint2 = Paint() 74 | ..style = PaintingStyle.fill 75 | ..color = this.fillColors[i + nx * ny]; 76 | _drawInner( 77 | canvas, 78 | Offset(2 * side * x + offset.dx, 2 * side * y + offset.dy), 79 | strokePaint, 80 | fillPaint1, 81 | fillPaint2); 82 | } else { 83 | final fillPaint = Paint() 84 | ..style = PaintingStyle.fill 85 | ..color = this.fillColors[i]; 86 | _drawOuter( 87 | canvas, 88 | Offset(2 * side * x + offset.dx, 2 * side * y + offset.dy), 89 | strokePaint, 90 | fillPaint); 91 | } 92 | } 93 | } 94 | } 95 | } 96 | 97 | void _drawOuter( 98 | Canvas canvas, Offset offset, Paint strokePaint, Paint fillPaint) { 99 | final bottomright = Path() 100 | ..moveTo(offset.dx, offset.dy + side) 101 | ..lineTo(offset.dx + side, offset.dy + 2 * side) 102 | ..lineTo(offset.dx, offset.dy + 2 * side) 103 | ..lineTo(offset.dx, offset.dy + side); 104 | 105 | canvas.drawPath(bottomright, strokePaint); 106 | canvas.drawPath(bottomright, fillPaint); 107 | 108 | final bottomleft = Path() 109 | ..moveTo(offset.dx + 2 * side, offset.dy + side) 110 | ..lineTo(offset.dx + 2 * side - side, offset.dy + 2 * side) 111 | ..lineTo(offset.dx + 2 * side, offset.dy + 2 * side) 112 | ..lineTo(offset.dx + 2 * side, offset.dy + side); 113 | 114 | canvas.drawPath(bottomleft, strokePaint); 115 | canvas.drawPath(bottomleft, fillPaint); 116 | 117 | final topleft = Path() 118 | ..moveTo(offset.dx, offset.dy + side) 119 | ..lineTo(offset.dx + side, offset.dy + side - side) 120 | ..lineTo(offset.dx, offset.dy + side - side) 121 | ..lineTo(offset.dx, offset.dy + side); 122 | 123 | canvas.drawPath(topleft, strokePaint); 124 | canvas.drawPath(topleft, fillPaint); 125 | 126 | final topright = Path() 127 | ..moveTo(offset.dx + 2 * side, offset.dy + side) 128 | ..lineTo(offset.dx + 2 * side - side, offset.dy + side - side) 129 | ..lineTo(offset.dx + 2 * side, offset.dy + side - side) 130 | ..lineTo(offset.dx + 2 * side, offset.dy + side); 131 | 132 | canvas.drawPath(topright, strokePaint); 133 | canvas.drawPath(topright, fillPaint); 134 | } 135 | 136 | void _drawInner(Canvas canvas, Offset offset, Paint strokePaint, 137 | Paint fillPaint1, Paint fillPaint2) { 138 | final topleft = Path() 139 | ..moveTo(offset.dx + side, offset.dy) 140 | ..lineTo(offset.dx + side - side, offset.dy + side) 141 | ..lineTo(offset.dx + side, offset.dy + side) 142 | ..lineTo(offset.dx + side, offset.dy); 143 | 144 | canvas.drawPath(topleft, strokePaint); 145 | canvas.drawPath(topleft, fillPaint1); 146 | 147 | final bottomright = Path() 148 | ..moveTo(offset.dx + side, offset.dy + 2 * side) 149 | ..lineTo(offset.dx + side + side, offset.dy + 2 * side - side) 150 | ..lineTo(offset.dx + side, offset.dy + 2 * side - side) 151 | ..lineTo(offset.dx + side, offset.dy + 2 * side); 152 | 153 | canvas.drawPath(bottomright, strokePaint); 154 | canvas.drawPath(bottomright, fillPaint1); 155 | 156 | final topright = Path() 157 | ..moveTo(offset.dx + side, offset.dy) 158 | ..lineTo(offset.dx + side + side, offset.dy + side) 159 | ..lineTo(offset.dx + side, offset.dy + side) 160 | ..lineTo(offset.dx + side, offset.dy); 161 | 162 | canvas.drawPath(topright, strokePaint); 163 | canvas.drawPath(topright, fillPaint2); 164 | 165 | final bottomleft = Path() 166 | ..moveTo(offset.dx + side, offset.dy + 2 * side) 167 | ..lineTo(offset.dx + side - side, offset.dy + 2 * side - side) 168 | ..lineTo(offset.dx + side, offset.dy + 2 * side - side) 169 | ..lineTo(offset.dx + side, offset.dy + 2 * side); 170 | 171 | canvas.drawPath(bottomleft, strokePaint); 172 | canvas.drawPath(bottomleft, fillPaint2); 173 | } 174 | 175 | Size get size => Size(side * nx * 2, side * ny * 2); 176 | } 177 | -------------------------------------------------------------------------------- /test/geopattern_flutter_test.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | import 'dart:ui'; 3 | 4 | import 'package:flutter_test/flutter_test.dart'; 5 | 6 | import 'package:geopattern_flutter/patterns/chevrons.dart'; 7 | import 'package:geopattern_flutter/patterns/concentric_circles.dart'; 8 | import 'package:geopattern_flutter/patterns/diamonds.dart'; 9 | import 'package:geopattern_flutter/patterns/hexagons.dart'; 10 | import 'package:geopattern_flutter/patterns/mosaic_squares.dart'; 11 | import 'package:geopattern_flutter/patterns/nested_squares.dart'; 12 | import 'package:geopattern_flutter/patterns/octagons.dart'; 13 | import 'package:geopattern_flutter/patterns/overlapping_circles.dart'; 14 | import 'package:geopattern_flutter/patterns/overlapping_rings.dart'; 15 | import 'package:geopattern_flutter/patterns/plaid.dart'; 16 | import 'package:geopattern_flutter/patterns/plus_signs.dart'; 17 | import 'package:geopattern_flutter/patterns/sine_waves.dart'; 18 | import 'package:geopattern_flutter/patterns/squares.dart'; 19 | import 'package:geopattern_flutter/patterns/triangles.dart'; 20 | 21 | void main() { 22 | test('chevrons', () { 23 | final gen = Random(); 24 | final pattern = Chevrons( 25 | side: 30, 26 | nx: 6, 27 | ny: 6, 28 | fillColors: List.generate( 29 | 36, 30 | (int i) => Color.fromARGB( 31 | 10 + (gen.nextDouble() * 100).round(), 32 | 50 + gen.nextInt(1) * 150, 33 | 50 + gen.nextInt(1) * 150, 34 | 50 + gen.nextInt(1) * 150)), 35 | strokeColor: Color.fromARGB(50, 50, 50, 50)); 36 | expect(pattern.size.width, 180); 37 | expect(pattern.size.height, 120); 38 | }); 39 | test('concentric_circles', () { 40 | final gen = Random(); 41 | final pattern = ConcentricCircles( 42 | radius: 30, 43 | nx: 6, 44 | ny: 6, 45 | strokeColors: List.generate( 46 | 36, 47 | (int i) => Color.fromARGB( 48 | 10 + (gen.nextDouble() * 100).round(), 49 | 50 + gen.nextInt(1) * 150, 50 | 50 + gen.nextInt(1) * 150, 51 | 50 + gen.nextInt(1) * 150)), 52 | fillColors: List.generate( 53 | 36, 54 | (int i) => Color.fromARGB( 55 | 10 + (gen.nextDouble() * 100).round(), 56 | 50 + gen.nextInt(1) * 150, 57 | 50 + gen.nextInt(1) * 150, 58 | 50 + gen.nextInt(1) * 150)), 59 | strokeWidth: 10); 60 | expect(pattern.size.width, 240); 61 | expect(pattern.size.height, 240); 62 | }); 63 | test('diamonds', () { 64 | final gen = Random(); 65 | final pattern = Diamonds( 66 | w: 30, 67 | h: 30, 68 | nx: 6, 69 | ny: 6, 70 | fillColors: List.generate( 71 | 36, 72 | (int i) => Color.fromARGB( 73 | 10 + (gen.nextDouble() * 100).round(), 74 | 50 + gen.nextInt(1) * 150, 75 | 50 + gen.nextInt(1) * 150, 76 | 50 + gen.nextInt(1) * 150)), 77 | strokeColor: Color.fromARGB(50, 50, 50, 50)); 78 | expect(pattern.size.width, 180); 79 | expect(pattern.size.height, 90); 80 | }); 81 | test('hexagons', () { 82 | final gen = Random(); 83 | final pattern = Hexagons( 84 | side: 30, 85 | nx: 6, 86 | ny: 6, 87 | fillColors: List.generate( 88 | 36, 89 | (int i) => Color.fromARGB( 90 | 10 + (gen.nextDouble() * 100).round(), 91 | 50 + gen.nextInt(1) * 150, 92 | 50 + gen.nextInt(1) * 150, 93 | 50 + gen.nextInt(1) * 150)), 94 | strokeColor: Color.fromARGB(50, 50, 50, 50)); 95 | expect(pattern.size.width, 270); 96 | expect(pattern.size.height, 311.76914536239786); 97 | }); 98 | test('mosaic_squares', () { 99 | final gen = Random(); 100 | final pattern = MosaicSquares( 101 | side: 30, 102 | nx: 4, 103 | ny: 4, 104 | fillColors: List.generate( 105 | 32, 106 | (int i) => Color.fromARGB( 107 | 10 + (gen.nextDouble() * 100).round(), 108 | 50 + gen.nextInt(1) * 150, 109 | 50 + gen.nextInt(1) * 150, 110 | 50 + gen.nextInt(1) * 150)), 111 | strokeColor: Color.fromARGB(50, 50, 50, 50)); 112 | expect(pattern.size.width, 240); 113 | expect(pattern.size.height, 240); 114 | }); 115 | test('nested_squares', () { 116 | final gen = Random(); 117 | final pattern = NestedSquares( 118 | side: 30, 119 | outerside: 90, 120 | nx: 6, 121 | ny: 6, 122 | strokeColors: List.generate( 123 | 36, 124 | (int i) => Color.fromARGB( 125 | 10 + (gen.nextDouble() * 100).round(), 126 | 50 + gen.nextInt(1) * 150, 127 | 50 + gen.nextInt(1) * 150, 128 | 50 + gen.nextInt(1) * 150))); 129 | expect(pattern.size.width, 900); 130 | expect(pattern.size.height, 900); 131 | }); 132 | test('octagons', () { 133 | final gen = Random(); 134 | final pattern = Octagons( 135 | side: 30, 136 | nx: 6, 137 | ny: 6, 138 | fillColors: List.generate( 139 | 36, 140 | (int i) => Color.fromARGB( 141 | 10 + (gen.nextDouble() * 100).round(), 142 | 50 + gen.nextInt(1) * 150, 143 | 50 + gen.nextInt(1) * 150, 144 | 50 + gen.nextInt(1) * 150)), 145 | strokeColor: Color.fromARGB(50, 50, 50, 50)); 146 | expect(pattern.size.width, 180); 147 | expect(pattern.size.height, 180); 148 | }); 149 | test('overlapping_circles', () { 150 | final gen = Random(); 151 | final pattern = OverlappingCircles( 152 | radius: 30, 153 | nx: 6, 154 | ny: 6, 155 | fillColors: List.generate( 156 | 36, 157 | (int i) => Color.fromARGB( 158 | 10 + (gen.nextDouble() * 100).round(), 159 | 50 + gen.nextInt(1) * 150, 160 | 50 + gen.nextInt(1) * 150, 161 | 50 + gen.nextInt(1) * 150))); 162 | expect(pattern.size.width, 180); 163 | expect(pattern.size.height, 180); 164 | }); 165 | test('overlapping_rings', () { 166 | final gen = Random(); 167 | final pattern = OverlappingRings( 168 | radius: 30, 169 | strokeWidth: 10, 170 | nx: 6, 171 | ny: 6, 172 | strokeColors: List.generate( 173 | 36, 174 | (int i) => Color.fromARGB( 175 | 10 + (gen.nextDouble() * 100).round(), 176 | 50 + gen.nextInt(1) * 150, 177 | 50 + gen.nextInt(1) * 150, 178 | 50 + gen.nextInt(1) * 150))); 179 | expect(pattern.size.width, 180); 180 | expect(pattern.size.height, 180); 181 | }); 182 | test('plaid', () { 183 | final gen = Random(); 184 | final pattern = Plaid( 185 | horizontalOffsets: List.generate(36, (int i) => i * 5.0), 186 | verticalOffsets: List.generate(36, (int i) => i * 5.0), 187 | horizontalSizes: List.generate(36, (int i) => i * 5.0), 188 | verticalSizes: List.generate(36, (int i) => i * 5.0), 189 | horizontalFillColors: List.generate( 190 | 36, 191 | (int i) => Color.fromARGB( 192 | 10 + (gen.nextDouble() * 100).round(), 193 | 50 + gen.nextInt(1) * 150, 194 | 50 + gen.nextInt(1) * 150, 195 | 50 + gen.nextInt(1) * 150)), 196 | verticalFillColors: List.generate( 197 | 36, 198 | (int i) => Color.fromARGB( 199 | 10 + (gen.nextDouble() * 100).round(), 200 | 50 + gen.nextInt(1) * 150, 201 | 50 + gen.nextInt(1) * 150, 202 | 50 + gen.nextInt(1) * 150))); 203 | expect(pattern.size.width, 6300); 204 | expect(pattern.size.height, 6300); 205 | }); 206 | test('plus_signs', () { 207 | final gen = Random(); 208 | final pattern = PlusSigns( 209 | side: 30, 210 | nx: 6, 211 | ny: 6, 212 | fillColors: List.generate( 213 | 36, 214 | (int i) => Color.fromARGB( 215 | 10 + (gen.nextDouble() * 100).round(), 216 | 50 + gen.nextInt(1) * 150, 217 | 50 + gen.nextInt(1) * 150, 218 | 50 + gen.nextInt(1) * 150)), 219 | strokeColor: Color.fromARGB(50, 50, 50, 50)); 220 | expect(pattern.size.width, 60); 221 | expect(pattern.size.height, 60); 222 | }); 223 | test('sine_waves', () { 224 | final gen = Random(); 225 | final pattern = SineWaves( 226 | amplitude: 200, 227 | period: 70, 228 | strokeColors: List.generate( 229 | 36, 230 | (int i) => Color.fromARGB( 231 | 10 + (gen.nextDouble() * 100).round(), 232 | 50 + gen.nextInt(1) * 150, 233 | 50 + gen.nextInt(1) * 150, 234 | 50 + gen.nextInt(1) * 150)), 235 | strokeOffsets: List.generate(36, (int i) => i * 5.0), 236 | strokeWidth: 2); 237 | expect(pattern.size.width, 70); 238 | expect(pattern.size.height, 200); 239 | }); 240 | test('squares', () { 241 | final gen = Random(); 242 | final pattern = Squares( 243 | side: 30, 244 | nx: 6, 245 | ny: 6, 246 | fillColors: List.generate( 247 | 36, 248 | (int i) => Color.fromARGB( 249 | 10 + (gen.nextDouble() * 100).round(), 250 | 50 + gen.nextInt(1) * 150, 251 | 50 + gen.nextInt(1) * 150, 252 | 50 + gen.nextInt(1) * 150)), 253 | strokeColor: Color.fromARGB(50, 50, 50, 50)); 254 | expect(pattern.size.width, 180); 255 | expect(pattern.size.height, 180); 256 | }); 257 | test('triangles', () { 258 | final gen = Random(); 259 | final pattern = Triangles( 260 | side: 30, 261 | nx: 6, 262 | ny: 6, 263 | fillColors: List.generate( 264 | 36, 265 | (int i) => Color.fromARGB( 266 | 10 + (gen.nextDouble() * 100).round(), 267 | 50 + gen.nextInt(1) * 150, 268 | 50 + gen.nextInt(1) * 150, 269 | 50 + gen.nextInt(1) * 150)), 270 | strokeColor: Color.fromARGB(50, 50, 50, 50)); 271 | expect(pattern.size.width, 90); 272 | expect(pattern.size.height, 155.88457268119893); 273 | }); 274 | } 275 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 13 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 14 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 15 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 16 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 17 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 18 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 19 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 20 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXCopyFilesBuildPhase section */ 24 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 25 | isa = PBXCopyFilesBuildPhase; 26 | buildActionMask = 2147483647; 27 | dstPath = ""; 28 | dstSubfolderSpec = 10; 29 | files = ( 30 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 31 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 32 | ); 33 | name = "Embed Frameworks"; 34 | runOnlyForDeploymentPostprocessing = 0; 35 | }; 36 | /* End PBXCopyFilesBuildPhase section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 40 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 41 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 42 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 43 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 44 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 45 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 46 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 47 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 48 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 49 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 51 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 52 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 53 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 54 | /* End PBXFileReference section */ 55 | 56 | /* Begin PBXFrameworksBuildPhase section */ 57 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 58 | isa = PBXFrameworksBuildPhase; 59 | buildActionMask = 2147483647; 60 | files = ( 61 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 62 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 63 | ); 64 | runOnlyForDeploymentPostprocessing = 0; 65 | }; 66 | /* End PBXFrameworksBuildPhase section */ 67 | 68 | /* Begin PBXGroup section */ 69 | 9740EEB11CF90186004384FC /* Flutter */ = { 70 | isa = PBXGroup; 71 | children = ( 72 | 3B80C3931E831B6300D905FE /* App.framework */, 73 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 74 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 75 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 76 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 77 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 78 | ); 79 | name = Flutter; 80 | sourceTree = ""; 81 | }; 82 | 97C146E51CF9000F007C117D = { 83 | isa = PBXGroup; 84 | children = ( 85 | 9740EEB11CF90186004384FC /* Flutter */, 86 | 97C146F01CF9000F007C117D /* Runner */, 87 | 97C146EF1CF9000F007C117D /* Products */, 88 | ); 89 | sourceTree = ""; 90 | }; 91 | 97C146EF1CF9000F007C117D /* Products */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | 97C146EE1CF9000F007C117D /* Runner.app */, 95 | ); 96 | name = Products; 97 | sourceTree = ""; 98 | }; 99 | 97C146F01CF9000F007C117D /* Runner */ = { 100 | isa = PBXGroup; 101 | children = ( 102 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 103 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 104 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 105 | 97C147021CF9000F007C117D /* Info.plist */, 106 | 97C146F11CF9000F007C117D /* Supporting Files */, 107 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 108 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 109 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 110 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 111 | ); 112 | path = Runner; 113 | sourceTree = ""; 114 | }; 115 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 116 | isa = PBXGroup; 117 | children = ( 118 | ); 119 | name = "Supporting Files"; 120 | sourceTree = ""; 121 | }; 122 | /* End PBXGroup section */ 123 | 124 | /* Begin PBXNativeTarget section */ 125 | 97C146ED1CF9000F007C117D /* Runner */ = { 126 | isa = PBXNativeTarget; 127 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 128 | buildPhases = ( 129 | 9740EEB61CF901F6004384FC /* Run Script */, 130 | 97C146EA1CF9000F007C117D /* Sources */, 131 | 97C146EB1CF9000F007C117D /* Frameworks */, 132 | 97C146EC1CF9000F007C117D /* Resources */, 133 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 134 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 135 | ); 136 | buildRules = ( 137 | ); 138 | dependencies = ( 139 | ); 140 | name = Runner; 141 | productName = Runner; 142 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 143 | productType = "com.apple.product-type.application"; 144 | }; 145 | /* End PBXNativeTarget section */ 146 | 147 | /* Begin PBXProject section */ 148 | 97C146E61CF9000F007C117D /* Project object */ = { 149 | isa = PBXProject; 150 | attributes = { 151 | LastUpgradeCheck = 1020; 152 | ORGANIZATIONNAME = "The Chromium Authors"; 153 | TargetAttributes = { 154 | 97C146ED1CF9000F007C117D = { 155 | CreatedOnToolsVersion = 7.3.1; 156 | LastSwiftMigration = 0910; 157 | }; 158 | }; 159 | }; 160 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 161 | compatibilityVersion = "Xcode 3.2"; 162 | developmentRegion = en; 163 | hasScannedForEncodings = 0; 164 | knownRegions = ( 165 | en, 166 | Base, 167 | ); 168 | mainGroup = 97C146E51CF9000F007C117D; 169 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 170 | projectDirPath = ""; 171 | projectRoot = ""; 172 | targets = ( 173 | 97C146ED1CF9000F007C117D /* Runner */, 174 | ); 175 | }; 176 | /* End PBXProject section */ 177 | 178 | /* Begin PBXResourcesBuildPhase section */ 179 | 97C146EC1CF9000F007C117D /* Resources */ = { 180 | isa = PBXResourcesBuildPhase; 181 | buildActionMask = 2147483647; 182 | files = ( 183 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 184 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 185 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 186 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 187 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 188 | ); 189 | runOnlyForDeploymentPostprocessing = 0; 190 | }; 191 | /* End PBXResourcesBuildPhase section */ 192 | 193 | /* Begin PBXShellScriptBuildPhase section */ 194 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 195 | isa = PBXShellScriptBuildPhase; 196 | buildActionMask = 2147483647; 197 | files = ( 198 | ); 199 | inputPaths = ( 200 | ); 201 | name = "Thin Binary"; 202 | outputPaths = ( 203 | ); 204 | runOnlyForDeploymentPostprocessing = 0; 205 | shellPath = /bin/sh; 206 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 207 | }; 208 | 9740EEB61CF901F6004384FC /* Run Script */ = { 209 | isa = PBXShellScriptBuildPhase; 210 | buildActionMask = 2147483647; 211 | files = ( 212 | ); 213 | inputPaths = ( 214 | ); 215 | name = "Run Script"; 216 | outputPaths = ( 217 | ); 218 | runOnlyForDeploymentPostprocessing = 0; 219 | shellPath = /bin/sh; 220 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 221 | }; 222 | /* End PBXShellScriptBuildPhase section */ 223 | 224 | /* Begin PBXSourcesBuildPhase section */ 225 | 97C146EA1CF9000F007C117D /* Sources */ = { 226 | isa = PBXSourcesBuildPhase; 227 | buildActionMask = 2147483647; 228 | files = ( 229 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 230 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 231 | ); 232 | runOnlyForDeploymentPostprocessing = 0; 233 | }; 234 | /* End PBXSourcesBuildPhase section */ 235 | 236 | /* Begin PBXVariantGroup section */ 237 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 238 | isa = PBXVariantGroup; 239 | children = ( 240 | 97C146FB1CF9000F007C117D /* Base */, 241 | ); 242 | name = Main.storyboard; 243 | sourceTree = ""; 244 | }; 245 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 246 | isa = PBXVariantGroup; 247 | children = ( 248 | 97C147001CF9000F007C117D /* Base */, 249 | ); 250 | name = LaunchScreen.storyboard; 251 | sourceTree = ""; 252 | }; 253 | /* End PBXVariantGroup section */ 254 | 255 | /* Begin XCBuildConfiguration section */ 256 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 257 | isa = XCBuildConfiguration; 258 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 259 | buildSettings = { 260 | ALWAYS_SEARCH_USER_PATHS = NO; 261 | CLANG_ANALYZER_NONNULL = YES; 262 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 263 | CLANG_CXX_LIBRARY = "libc++"; 264 | CLANG_ENABLE_MODULES = YES; 265 | CLANG_ENABLE_OBJC_ARC = YES; 266 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 267 | CLANG_WARN_BOOL_CONVERSION = YES; 268 | CLANG_WARN_COMMA = YES; 269 | CLANG_WARN_CONSTANT_CONVERSION = YES; 270 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 271 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 272 | CLANG_WARN_EMPTY_BODY = YES; 273 | CLANG_WARN_ENUM_CONVERSION = YES; 274 | CLANG_WARN_INFINITE_RECURSION = YES; 275 | CLANG_WARN_INT_CONVERSION = YES; 276 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 277 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 278 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 279 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 280 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 281 | CLANG_WARN_STRICT_PROTOTYPES = YES; 282 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 283 | CLANG_WARN_UNREACHABLE_CODE = YES; 284 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 285 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 286 | COPY_PHASE_STRIP = NO; 287 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 288 | ENABLE_NS_ASSERTIONS = NO; 289 | ENABLE_STRICT_OBJC_MSGSEND = YES; 290 | GCC_C_LANGUAGE_STANDARD = gnu99; 291 | GCC_NO_COMMON_BLOCKS = YES; 292 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 293 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 294 | GCC_WARN_UNDECLARED_SELECTOR = YES; 295 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 296 | GCC_WARN_UNUSED_FUNCTION = YES; 297 | GCC_WARN_UNUSED_VARIABLE = YES; 298 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 299 | MTL_ENABLE_DEBUG_INFO = NO; 300 | SDKROOT = iphoneos; 301 | TARGETED_DEVICE_FAMILY = "1,2"; 302 | VALIDATE_PRODUCT = YES; 303 | }; 304 | name = Profile; 305 | }; 306 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 307 | isa = XCBuildConfiguration; 308 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 309 | buildSettings = { 310 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 311 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 312 | DEVELOPMENT_TEAM = S8QB4VV633; 313 | ENABLE_BITCODE = NO; 314 | FRAMEWORK_SEARCH_PATHS = ( 315 | "$(inherited)", 316 | "$(PROJECT_DIR)/Flutter", 317 | ); 318 | INFOPLIST_FILE = Runner/Info.plist; 319 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 320 | LIBRARY_SEARCH_PATHS = ( 321 | "$(inherited)", 322 | "$(PROJECT_DIR)/Flutter", 323 | ); 324 | PRODUCT_BUNDLE_IDENTIFIER = io.suy.geopatternexample.example; 325 | PRODUCT_NAME = "$(TARGET_NAME)"; 326 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 327 | SWIFT_VERSION = 4.0; 328 | VERSIONING_SYSTEM = "apple-generic"; 329 | }; 330 | name = Profile; 331 | }; 332 | 97C147031CF9000F007C117D /* Debug */ = { 333 | isa = XCBuildConfiguration; 334 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 335 | buildSettings = { 336 | ALWAYS_SEARCH_USER_PATHS = NO; 337 | CLANG_ANALYZER_NONNULL = YES; 338 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 339 | CLANG_CXX_LIBRARY = "libc++"; 340 | CLANG_ENABLE_MODULES = YES; 341 | CLANG_ENABLE_OBJC_ARC = YES; 342 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 343 | CLANG_WARN_BOOL_CONVERSION = YES; 344 | CLANG_WARN_COMMA = YES; 345 | CLANG_WARN_CONSTANT_CONVERSION = YES; 346 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 347 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 348 | CLANG_WARN_EMPTY_BODY = YES; 349 | CLANG_WARN_ENUM_CONVERSION = YES; 350 | CLANG_WARN_INFINITE_RECURSION = YES; 351 | CLANG_WARN_INT_CONVERSION = YES; 352 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 353 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 354 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 355 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 356 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 357 | CLANG_WARN_STRICT_PROTOTYPES = YES; 358 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 359 | CLANG_WARN_UNREACHABLE_CODE = YES; 360 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 361 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 362 | COPY_PHASE_STRIP = NO; 363 | DEBUG_INFORMATION_FORMAT = dwarf; 364 | ENABLE_STRICT_OBJC_MSGSEND = YES; 365 | ENABLE_TESTABILITY = YES; 366 | GCC_C_LANGUAGE_STANDARD = gnu99; 367 | GCC_DYNAMIC_NO_PIC = NO; 368 | GCC_NO_COMMON_BLOCKS = YES; 369 | GCC_OPTIMIZATION_LEVEL = 0; 370 | GCC_PREPROCESSOR_DEFINITIONS = ( 371 | "DEBUG=1", 372 | "$(inherited)", 373 | ); 374 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 375 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 376 | GCC_WARN_UNDECLARED_SELECTOR = YES; 377 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 378 | GCC_WARN_UNUSED_FUNCTION = YES; 379 | GCC_WARN_UNUSED_VARIABLE = YES; 380 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 381 | MTL_ENABLE_DEBUG_INFO = YES; 382 | ONLY_ACTIVE_ARCH = YES; 383 | SDKROOT = iphoneos; 384 | TARGETED_DEVICE_FAMILY = "1,2"; 385 | }; 386 | name = Debug; 387 | }; 388 | 97C147041CF9000F007C117D /* Release */ = { 389 | isa = XCBuildConfiguration; 390 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 391 | buildSettings = { 392 | ALWAYS_SEARCH_USER_PATHS = NO; 393 | CLANG_ANALYZER_NONNULL = YES; 394 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 395 | CLANG_CXX_LIBRARY = "libc++"; 396 | CLANG_ENABLE_MODULES = YES; 397 | CLANG_ENABLE_OBJC_ARC = YES; 398 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 399 | CLANG_WARN_BOOL_CONVERSION = YES; 400 | CLANG_WARN_COMMA = YES; 401 | CLANG_WARN_CONSTANT_CONVERSION = YES; 402 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 403 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 404 | CLANG_WARN_EMPTY_BODY = YES; 405 | CLANG_WARN_ENUM_CONVERSION = YES; 406 | CLANG_WARN_INFINITE_RECURSION = YES; 407 | CLANG_WARN_INT_CONVERSION = YES; 408 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 409 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 410 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 411 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 412 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 413 | CLANG_WARN_STRICT_PROTOTYPES = YES; 414 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 415 | CLANG_WARN_UNREACHABLE_CODE = YES; 416 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 417 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 418 | COPY_PHASE_STRIP = NO; 419 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 420 | ENABLE_NS_ASSERTIONS = NO; 421 | ENABLE_STRICT_OBJC_MSGSEND = YES; 422 | GCC_C_LANGUAGE_STANDARD = gnu99; 423 | GCC_NO_COMMON_BLOCKS = YES; 424 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 425 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 426 | GCC_WARN_UNDECLARED_SELECTOR = YES; 427 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 428 | GCC_WARN_UNUSED_FUNCTION = YES; 429 | GCC_WARN_UNUSED_VARIABLE = YES; 430 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 431 | MTL_ENABLE_DEBUG_INFO = NO; 432 | SDKROOT = iphoneos; 433 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 434 | TARGETED_DEVICE_FAMILY = "1,2"; 435 | VALIDATE_PRODUCT = YES; 436 | }; 437 | name = Release; 438 | }; 439 | 97C147061CF9000F007C117D /* Debug */ = { 440 | isa = XCBuildConfiguration; 441 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 442 | buildSettings = { 443 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 444 | CLANG_ENABLE_MODULES = YES; 445 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 446 | ENABLE_BITCODE = NO; 447 | FRAMEWORK_SEARCH_PATHS = ( 448 | "$(inherited)", 449 | "$(PROJECT_DIR)/Flutter", 450 | ); 451 | INFOPLIST_FILE = Runner/Info.plist; 452 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 453 | LIBRARY_SEARCH_PATHS = ( 454 | "$(inherited)", 455 | "$(PROJECT_DIR)/Flutter", 456 | ); 457 | PRODUCT_BUNDLE_IDENTIFIER = io.suy.geopatternexample.example; 458 | PRODUCT_NAME = "$(TARGET_NAME)"; 459 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 460 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 461 | SWIFT_SWIFT3_OBJC_INFERENCE = On; 462 | SWIFT_VERSION = 4.0; 463 | VERSIONING_SYSTEM = "apple-generic"; 464 | }; 465 | name = Debug; 466 | }; 467 | 97C147071CF9000F007C117D /* Release */ = { 468 | isa = XCBuildConfiguration; 469 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 470 | buildSettings = { 471 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 472 | CLANG_ENABLE_MODULES = YES; 473 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 474 | ENABLE_BITCODE = NO; 475 | FRAMEWORK_SEARCH_PATHS = ( 476 | "$(inherited)", 477 | "$(PROJECT_DIR)/Flutter", 478 | ); 479 | INFOPLIST_FILE = Runner/Info.plist; 480 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 481 | LIBRARY_SEARCH_PATHS = ( 482 | "$(inherited)", 483 | "$(PROJECT_DIR)/Flutter", 484 | ); 485 | PRODUCT_BUNDLE_IDENTIFIER = io.suy.geopatternexample.example; 486 | PRODUCT_NAME = "$(TARGET_NAME)"; 487 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 488 | SWIFT_SWIFT3_OBJC_INFERENCE = On; 489 | SWIFT_VERSION = 4.0; 490 | VERSIONING_SYSTEM = "apple-generic"; 491 | }; 492 | name = Release; 493 | }; 494 | /* End XCBuildConfiguration section */ 495 | 496 | /* Begin XCConfigurationList section */ 497 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 498 | isa = XCConfigurationList; 499 | buildConfigurations = ( 500 | 97C147031CF9000F007C117D /* Debug */, 501 | 97C147041CF9000F007C117D /* Release */, 502 | 249021D3217E4FDB00AE95B9 /* Profile */, 503 | ); 504 | defaultConfigurationIsVisible = 0; 505 | defaultConfigurationName = Release; 506 | }; 507 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 508 | isa = XCConfigurationList; 509 | buildConfigurations = ( 510 | 97C147061CF9000F007C117D /* Debug */, 511 | 97C147071CF9000F007C117D /* Release */, 512 | 249021D4217E4FDB00AE95B9 /* Profile */, 513 | ); 514 | defaultConfigurationIsVisible = 0; 515 | defaultConfigurationName = Release; 516 | }; 517 | /* End XCConfigurationList section */ 518 | 519 | }; 520 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 521 | } 522 | --------------------------------------------------------------------------------