├── .gitignore
├── .metadata
├── LICENSE
├── README.md
├── android
├── .gitignore
├── app
│ ├── build.gradle
│ └── src
│ │ ├── debug
│ │ └── AndroidManifest.xml
│ │ ├── main
│ │ ├── AndroidManifest.xml
│ │ ├── kotlin
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── flutter_wordpress
│ │ │ │ └── MainActivity.kt
│ │ └── res
│ │ │ ├── drawable
│ │ │ └── launch_background.xml
│ │ │ ├── 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
│ │ └── profile
│ │ └── AndroidManifest.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
└── settings.gradle
├── ios
├── .gitignore
├── Flutter
│ ├── AppFrameworkInfo.plist
│ ├── Debug.xcconfig
│ └── Release.xcconfig
├── Podfile
├── Podfile.lock
├── Runner.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── IDEWorkspaceChecks.plist
│ │ │ └── WorkspaceSettings.xcsettings
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ ├── IDEWorkspaceChecks.plist
│ │ └── WorkspaceSettings.xcsettings
└── Runner
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ ├── AppIcon.appiconset
│ │ ├── Contents.json
│ │ ├── Icon-App-1024x1024@1x.png
│ │ ├── 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-83.5x83.5@2x.png
│ └── LaunchImage.imageset
│ │ ├── Contents.json
│ │ ├── LaunchImage.png
│ │ ├── LaunchImage@2x.png
│ │ ├── LaunchImage@3x.png
│ │ └── README.md
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── Info.plist
│ └── Runner-Bridging-Header.h
├── lib
├── bloc
│ ├── CategoryBloc.dart
│ ├── PostBloc.dart
│ └── bloc.dart
├── config.dart
├── main.dart
├── models
│ ├── Author.dart
│ ├── Post.dart
│ ├── Tag.dart
│ ├── Term.dart
│ ├── models.dart
│ └── postlisttype.dart
├── screens
│ ├── archive.dart
│ ├── author.dart
│ ├── error.dart
│ ├── home.dart
│ ├── page.dart
│ ├── post.dart
│ ├── result.dart
│ └── search.dart
└── widgets
│ ├── CategoryDrawer.dart
│ ├── LazyLoadPosts.dart
│ ├── PaginatePosts.dart
│ ├── PostCard.dart
│ ├── PostGrid.dart
│ ├── PostList.dart
│ └── RelatedPost.dart
├── linux
├── .gitignore
├── Makefile
├── app_configuration.mk
├── flutter
│ ├── .template_version
│ ├── generated_plugin_registrant.cc
│ ├── generated_plugin_registrant.h
│ └── generated_plugins.mk
├── main.cc
├── window_configuration.cc
└── window_configuration.h
├── macos
├── .gitignore
├── Flutter
│ ├── Flutter-Debug.xcconfig
│ ├── Flutter-Release.xcconfig
│ └── GeneratedPluginRegistrant.swift
├── Podfile
├── Runner.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
└── Runner
│ ├── AppDelegate.swift
│ ├── Assets.xcassets
│ └── AppIcon.appiconset
│ │ ├── Contents.json
│ │ ├── app_icon_1024.png
│ │ ├── app_icon_128.png
│ │ ├── app_icon_16.png
│ │ ├── app_icon_256.png
│ │ ├── app_icon_32.png
│ │ ├── app_icon_512.png
│ │ └── app_icon_64.png
│ ├── Base.lproj
│ └── MainMenu.xib
│ ├── Configs
│ ├── AppInfo.xcconfig
│ ├── Debug.xcconfig
│ ├── Release.xcconfig
│ └── Warnings.xcconfig
│ ├── DebugProfile.entitlements
│ ├── Info.plist
│ ├── MainFlutterWindow.swift
│ └── Release.entitlements
├── pubspec.lock
├── pubspec.yaml
├── screenshots
├── s1.png
├── s2.png
├── s3.png
├── s4.png
├── s5.png
├── s6.png
├── s7.png
├── s8.png
└── s9.png
├── test
└── widget_test.dart
├── web
├── favicon.png
├── icons
│ ├── Icon-192.png
│ └── Icon-512.png
├── index.html
└── manifest.json
└── windows
├── .gitignore
├── AppConfiguration.props
├── FlutterBuild.vcxproj
├── Runner.sln
├── Runner.vcxproj
├── Runner.vcxproj.filters
├── flutter
├── .template_version
├── GeneratedPlugins.props
├── generated_plugin_registrant.cc
└── generated_plugin_registrant.h
├── runner
├── Runner.rc
├── flutter_window.cpp
├── flutter_window.h
├── main.cpp
├── resource.h
├── resources
│ └── app_icon.ico
├── run_loop.cpp
├── run_loop.h
├── runner.exe.manifest
├── win32_window.cpp
├── win32_window.h
├── window_configuration.cpp
└── window_configuration.h
└── scripts
├── bundle_assets_and_deps.bat
└── prepare_dependencies.bat
/.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 | **/ios/Flutter/.last_build_id
26 | .dart_tool/
27 | .flutter-plugins
28 | .flutter-plugins-dependencies
29 | .packages
30 | .pub-cache/
31 | .pub/
32 | /build/
33 |
34 | # Web related
35 | lib/generated_plugin_registrant.dart
36 |
37 | # Symbolication related
38 | app.*.symbols
39 |
40 | # Obfuscation related
41 | app.*.map.json
42 |
43 | # Exceptions to above rules.
44 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
45 |
--------------------------------------------------------------------------------
/.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: 8e5b575174bc4c0c92c1e6978a4b82baced05c23
8 | channel: unknown
9 |
10 | project_type: app
11 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | BSD 2-Clause License
2 |
3 | Copyright (c) 2020, kechankrisna
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions are met:
8 |
9 | 1. Redistributions of source code must retain the above copyright notice, this
10 | list of conditions and the following disclaimer.
11 |
12 | 2. Redistributions in binary form must reproduce the above copyright notice,
13 | this list of conditions and the following disclaimer in the documentation
14 | and/or other materials provided with the distribution.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # flutter_wordpress
2 |
3 | This package is created by simplified get data from wordpress site api version 2, and convert it into the native mobile application. You can clone and edit the app in config.dart file. You can also custom any version as you supposed to do. Any issue or suggestions, please let me know.
4 |
5 | ## Getting Started
6 |
7 | ```
8 | git clone https://github.com/kechankrisna/flutter_wordpress.git
9 | cd flutter_wordpress && flutter run
10 | ```
11 |
12 | ## Screenshot
13 | 
14 | 
15 | 
16 | 
17 | 
18 | 
19 | 
20 | 
21 | 
22 |
23 |
24 | This project is a starting point for a Flutter application.
25 |
26 | A few resources to get you started if this is your first Flutter project:
27 |
28 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
29 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
30 |
31 | For help getting started with Flutter, view our
32 | [online documentation](https://flutter.dev/docs), which offers tutorials,
33 | samples, guidance on mobile development, and a full API reference.
34 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
--------------------------------------------------------------------------------
/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 "com.example.flutter_wordpress"
42 | minSdkVersion 16
43 | targetSdkVersion 28
44 | versionCode flutterVersionCode.toInteger()
45 | versionName flutterVersionName
46 | }
47 |
48 | buildTypes {
49 | release {
50 | // TODO: Add your own signing config for the release build.
51 | // Signing with the debug keys for now, so `flutter run --release` works.
52 | signingConfig signingConfigs.debug
53 | }
54 | }
55 | }
56 |
57 | flutter {
58 | source '../..'
59 | }
60 |
61 | dependencies {
62 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
63 | }
64 |
--------------------------------------------------------------------------------
/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
8 |
12 |
19 |
23 |
27 |
32 |
36 |
37 |
38 |
39 |
40 |
41 |
43 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/flutter_wordpress/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.flutter_wordpress
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kechankrisna/flutter_wordpress/1b70d1965c20c1e553ac40cd8bfb6573a23d9194/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kechankrisna/flutter_wordpress/1b70d1965c20c1e553ac40cd8bfb6573a23d9194/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kechankrisna/flutter_wordpress/1b70d1965c20c1e553ac40cd8bfb6573a23d9194/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kechankrisna/flutter_wordpress/1b70d1965c20c1e553ac40cd8bfb6573a23d9194/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kechankrisna/flutter_wordpress/1b70d1965c20c1e553ac40cd8bfb6573a23d9194/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.3.50'
3 | repositories {
4 | google()
5 | jcenter()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:3.5.0'
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 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.enableR8=true
3 | android.useAndroidX=true
4 | android.enableJetifier=true
5 |
--------------------------------------------------------------------------------
/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-5.6.2-all.zip
7 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | // Copyright 2014 The Flutter Authors. All rights reserved.
2 | // Use of this source code is governed by a BSD-style license that can be
3 | // found in the LICENSE file.
4 |
5 | include ':app'
6 |
7 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
8 | def properties = new Properties()
9 |
10 | assert localPropertiesFile.exists()
11 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
12 |
13 | def flutterSdkPath = properties.getProperty("flutter.sdk")
14 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
15 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
16 |
--------------------------------------------------------------------------------
/ios/.gitignore:
--------------------------------------------------------------------------------
1 | *.mode1v3
2 | *.mode2v3
3 | *.moved-aside
4 | *.pbxuser
5 | *.perspectivev3
6 | **/*sync/
7 | .sconsign.dblite
8 | .tags*
9 | **/.vagrant/
10 | **/DerivedData/
11 | Icon?
12 | **/Pods/
13 | **/.symlinks/
14 | profile
15 | xcuserdata
16 | **/.generated/
17 | Flutter/App.framework
18 | Flutter/Flutter.framework
19 | Flutter/Flutter.podspec
20 | Flutter/Generated.xcconfig
21 | Flutter/app.flx
22 | Flutter/app.zip
23 | Flutter/flutter_assets/
24 | Flutter/flutter_export_environment.sh
25 | ServiceDefinitions.json
26 | Runner/GeneratedPluginRegistrant.*
27 |
28 | # Exceptions to above rules.
29 | !default.mode1v3
30 | !default.mode2v3
31 | !default.pbxuser
32 | !default.perspectivev3
33 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | # platform :ios, '9.0'
3 |
4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6 |
7 | project 'Runner', {
8 | 'Debug' => :debug,
9 | 'Profile' => :release,
10 | 'Release' => :release,
11 | }
12 |
13 | def parse_KV_file(file, separator='=')
14 | file_abs_path = File.expand_path(file)
15 | if !File.exists? file_abs_path
16 | return [];
17 | end
18 | generated_key_values = {}
19 | skip_line_start_symbols = ["#", "/"]
20 | File.foreach(file_abs_path) do |line|
21 | next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
22 | plugin = line.split(pattern=separator)
23 | if plugin.length == 2
24 | podname = plugin[0].strip()
25 | path = plugin[1].strip()
26 | podpath = File.expand_path("#{path}", file_abs_path)
27 | generated_key_values[podname] = podpath
28 | else
29 | puts "Invalid plugin specification: #{line}"
30 | end
31 | end
32 | generated_key_values
33 | end
34 |
35 | target 'Runner' do
36 | use_frameworks!
37 | use_modular_headers!
38 |
39 | # Flutter Pod
40 |
41 | copied_flutter_dir = File.join(__dir__, 'Flutter')
42 | copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')
43 | copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')
44 | unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)
45 | # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
46 | # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
47 | # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.
48 |
49 | generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')
50 | unless File.exist?(generated_xcode_build_settings_path)
51 | raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
52 | end
53 | generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)
54 | cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];
55 |
56 | unless File.exist?(copied_framework_path)
57 | FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
58 | end
59 | unless File.exist?(copied_podspec_path)
60 | FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)
61 | end
62 | end
63 |
64 | # Keep pod path relative so it can be checked into Podfile.lock.
65 | pod 'Flutter', :path => 'Flutter'
66 |
67 | # Plugin Pods
68 |
69 | # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
70 | # referring to absolute paths on developers' machines.
71 | system('rm -rf .symlinks')
72 | system('mkdir -p .symlinks/plugins')
73 | plugin_pods = parse_KV_file('../.flutter-plugins')
74 | plugin_pods.each do |name, path|
75 | symlink = File.join('.symlinks', 'plugins', name)
76 | File.symlink(path, symlink)
77 | pod name, :path => File.join(symlink, 'ios')
78 | end
79 | end
80 |
81 | post_install do |installer|
82 | installer.pods_project.targets.each do |target|
83 | target.build_configurations.each do |config|
84 | config.build_settings['ENABLE_BITCODE'] = 'NO'
85 | end
86 | end
87 | end
88 |
--------------------------------------------------------------------------------
/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - Flutter (1.0.0)
3 | - FMDB (2.7.5):
4 | - FMDB/standard (= 2.7.5)
5 | - FMDB/standard (2.7.5)
6 | - path_provider (0.0.1):
7 | - Flutter
8 | - path_provider_macos (0.0.1):
9 | - Flutter
10 | - sqflite (0.0.1):
11 | - Flutter
12 | - FMDB (~> 2.7.2)
13 | - url_launcher (0.0.1):
14 | - Flutter
15 | - url_launcher_macos (0.0.1):
16 | - Flutter
17 | - url_launcher_web (0.0.1):
18 | - Flutter
19 |
20 | DEPENDENCIES:
21 | - Flutter (from `Flutter`)
22 | - path_provider (from `.symlinks/plugins/path_provider/ios`)
23 | - path_provider_macos (from `.symlinks/plugins/path_provider_macos/ios`)
24 | - sqflite (from `.symlinks/plugins/sqflite/ios`)
25 | - url_launcher (from `.symlinks/plugins/url_launcher/ios`)
26 | - url_launcher_macos (from `.symlinks/plugins/url_launcher_macos/ios`)
27 | - url_launcher_web (from `.symlinks/plugins/url_launcher_web/ios`)
28 |
29 | SPEC REPOS:
30 | trunk:
31 | - FMDB
32 |
33 | EXTERNAL SOURCES:
34 | Flutter:
35 | :path: Flutter
36 | path_provider:
37 | :path: ".symlinks/plugins/path_provider/ios"
38 | path_provider_macos:
39 | :path: ".symlinks/plugins/path_provider_macos/ios"
40 | sqflite:
41 | :path: ".symlinks/plugins/sqflite/ios"
42 | url_launcher:
43 | :path: ".symlinks/plugins/url_launcher/ios"
44 | url_launcher_macos:
45 | :path: ".symlinks/plugins/url_launcher_macos/ios"
46 | url_launcher_web:
47 | :path: ".symlinks/plugins/url_launcher_web/ios"
48 |
49 | SPEC CHECKSUMS:
50 | Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
51 | FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
52 | path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c
53 | path_provider_macos: f760a3c5b04357c380e2fddb6f9db6f3015897e0
54 | sqflite: 4001a31ff81d210346b500c55b17f4d6c7589dd0
55 | url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef
56 | url_launcher_macos: fd7894421cd39320dce5f292fc99ea9270b2a313
57 | url_launcher_web: e5527357f037c87560776e36436bf2b0288b965c
58 |
59 | PODFILE CHECKSUM: c34e2287a9ccaa606aeceab922830efb9a6ff69a
60 |
61 | COCOAPODS: 1.8.4
62 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/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: [UIApplication.LaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kechankrisna/flutter_wordpress/1b70d1965c20c1e553ac40cd8bfb6573a23d9194/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kechankrisna/flutter_wordpress/1b70d1965c20c1e553ac40cd8bfb6573a23d9194/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kechankrisna/flutter_wordpress/1b70d1965c20c1e553ac40cd8bfb6573a23d9194/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kechankrisna/flutter_wordpress/1b70d1965c20c1e553ac40cd8bfb6573a23d9194/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kechankrisna/flutter_wordpress/1b70d1965c20c1e553ac40cd8bfb6573a23d9194/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kechankrisna/flutter_wordpress/1b70d1965c20c1e553ac40cd8bfb6573a23d9194/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kechankrisna/flutter_wordpress/1b70d1965c20c1e553ac40cd8bfb6573a23d9194/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kechankrisna/flutter_wordpress/1b70d1965c20c1e553ac40cd8bfb6573a23d9194/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kechankrisna/flutter_wordpress/1b70d1965c20c1e553ac40cd8bfb6573a23d9194/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kechankrisna/flutter_wordpress/1b70d1965c20c1e553ac40cd8bfb6573a23d9194/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kechankrisna/flutter_wordpress/1b70d1965c20c1e553ac40cd8bfb6573a23d9194/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kechankrisna/flutter_wordpress/1b70d1965c20c1e553ac40cd8bfb6573a23d9194/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kechankrisna/flutter_wordpress/1b70d1965c20c1e553ac40cd8bfb6573a23d9194/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kechankrisna/flutter_wordpress/1b70d1965c20c1e553ac40cd8bfb6573a23d9194/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kechankrisna/flutter_wordpress/1b70d1965c20c1e553ac40cd8bfb6573a23d9194/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kechankrisna/flutter_wordpress/1b70d1965c20c1e553ac40cd8bfb6573a23d9194/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kechankrisna/flutter_wordpress/1b70d1965c20c1e553ac40cd8bfb6573a23d9194/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kechankrisna/flutter_wordpress/1b70d1965c20c1e553ac40cd8bfb6573a23d9194/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/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.
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/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 | flutter_wordpress
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 |
--------------------------------------------------------------------------------
/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/lib/bloc/CategoryBloc.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 | import 'package:dio/dio.dart';
3 | import './../config.dart';
4 | import './../models/models.dart';
5 |
6 | class CategoryBloc {
7 | List _lists = List();
8 | List get lists => this._lists;
9 | StreamController> _controller =
10 | StreamController>();
11 | Stream> get stream => this._controller.stream;
12 | StreamSink> get _streamSink => this._controller.sink;
13 |
14 | CategoryBloc();
15 |
16 | Future init() async {
17 | return await load();
18 | }
19 |
20 | Future load({int page: 1}) async {
21 | try {
22 | Response response = await Dio().get("$api/categories?_embed");
23 |
24 | List datas = response.data;
25 | List _posts =
26 | datas.cast().map((json) => Term.fromJson(json)).toList();
27 |
28 | _lists.addAll(_posts);
29 | _streamSink.add(_lists);
30 | return true;
31 | } catch (e) {
32 | print("load() method got error $e");
33 | return false;
34 | }
35 | }
36 |
37 | dispose() {
38 | _controller.close();
39 | _streamSink.close();
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/lib/bloc/PostBloc.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 | import 'package:dio/dio.dart';
3 | import 'package:flutter_wordpress/models/Author.dart';
4 | import './../config.dart';
5 | import './../models/models.dart';
6 |
7 | class PostBloc {
8 | List _lists = List();
9 | bool loading = false;
10 | List get lists => this._lists;
11 | StreamController> _controller = StreamController>();
12 | Stream> get stream => this._controller.stream;
13 | StreamSink> get _streamSink => this._controller.sink;
14 |
15 | int perPage;
16 | int currentPage = 1;
17 | int totalPages = 1;
18 | int totalPosts = 0;
19 | String order;
20 | String orderBy;
21 |
22 | Term category;
23 | Author author;
24 | String search;
25 | List excludes;
26 |
27 | PostBloc({
28 | int perPage: 10,
29 | int currentPage: 1,
30 | String order: "desc",
31 | String orderBy: "date",
32 | Term category,
33 | String search,
34 | Author author,
35 | List excludes: const [],
36 | }) {
37 | this.perPage = perPage;
38 | this.currentPage = currentPage;
39 | this.order = order;
40 | this.orderBy = orderBy;
41 | this.category = category;
42 | this.search = search;
43 | this.excludes = excludes;
44 | this.author = author;
45 | }
46 |
47 | Future refresh() async {
48 | _lists.clear();
49 | loading = true;
50 | currentPage = 1;
51 | await load(page: currentPage);
52 | return true;
53 | }
54 |
55 | loadMore() {
56 | if (!loading && totalPosts > lists.length) {
57 | loading = true;
58 | currentPage += 1;
59 | load(page: currentPage);
60 | }
61 | print(totalPosts > lists.length);
62 | }
63 |
64 | Future init() async {
65 | loading = true;
66 | await load(page: 1);
67 | return loading;
68 | }
69 |
70 | Future moveToPage({int page: 1}) async {
71 | _lists.clear();
72 | loading = true;
73 | currentPage = page;
74 | await load(page: currentPage);
75 | return loading;
76 | }
77 |
78 | Future load({int page: 1}) async {
79 | try {
80 | String url =
81 | "$api/posts?_embed&page=$page&per_page=$perPage&order=$order&orderBy=$orderBy";
82 | if (category != null) {
83 | switch (category.taxonomy) {
84 | case "category":
85 | url += "&categories=${category.id}";
86 | break;
87 | case "post_tag":
88 | url += "&tags=${category.id}";
89 | break;
90 | default:
91 | }
92 | } else if (search != null) {
93 | url += "&search=$search";
94 | } else if (author != null) {
95 | url += "&author=${author.id}";
96 | }
97 | if (excludes.length > 0) {
98 | url += "&exclude=${excludes.first}";
99 | }
100 | print(url);
101 | Response response = await Dio().get(url);
102 |
103 | var _totalPosts = response.headers["x-wp-total"].first;
104 | var _totalPages = response.headers["x-wp-totalpages"].first;
105 | print(
106 | "totalPosts $_totalPosts, totalPages $_totalPages, currentPage $currentPage");
107 |
108 | totalPages = int.parse(_totalPages);
109 | totalPosts = int.parse(_totalPosts);
110 |
111 | List datas = response.data;
112 | List _posts =
113 | datas.cast().map((json) => Post.fromJson(json)).toList();
114 |
115 | _lists.addAll(_posts);
116 | _streamSink.add(_lists);
117 | loading = false;
118 | return loading;
119 | } catch (e) {
120 | print("load() method got error $e");
121 | return false;
122 | }
123 | }
124 |
125 | List generate() {
126 | List _posts = [];
127 | final int startIndex = lists.length;
128 | for (var i = startIndex; i < startIndex + 30; i++) {
129 | final Post post = Post(
130 | id: i,
131 | title: "title $i",
132 | content: "Content $i",
133 | excerpt: "Except $i",
134 | );
135 | _posts.add(post);
136 | }
137 | return _posts;
138 | }
139 |
140 | dispose() {
141 | _controller.close();
142 | _streamSink.close();
143 | }
144 | }
145 |
--------------------------------------------------------------------------------
/lib/bloc/bloc.dart:
--------------------------------------------------------------------------------
1 | library wp_bloc;
2 | export './PostBloc.dart';
--------------------------------------------------------------------------------
/lib/config.dart:
--------------------------------------------------------------------------------
1 | const String app_uri = "https://www.reamker.com/";
2 | const String app_name = "REAMKER NEWS";
3 | const String app_description = "វិទ្យាសាស្ត្រ និង បច្ចេកវិទ្យា, ជីវិត, សង្គម, សិល្បៈ, កម្សាន្ត និង ព័ត៌មានផ្សេង ៗ";
4 | const String app_icon = "https://www.reamker.com/wp-content/uploads/2018/09/Reamker-News-Logo-4.png";
5 | const String api = "https://www.reamker.com/wp-json/wp/v2";
6 | const String app_thumbnail = "https://www.laxhel.com/wp-content/plugins/penci-portfolio//images/no-thumbnail.jpg";
7 |
8 | /*
9 | * api documents
10 | * https://www.reamker.com/wp-json/wp/v2
11 | * https://www.reamker.com/wp-json/wp/v2/posts => all posts or /(?P[\\d]+) for single
12 | * https://www.reamker.com/wp-json/wp/v2/taxonomies => all taxonomies or /(?P[\\d]+) for single
13 | * https://www.reamker.com/wp-json/wp/v2/categories => all categories or /(?P[\\d]+) for single
14 | */
--------------------------------------------------------------------------------
/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_wordpress/screens/archive.dart';
3 | import 'package:flutter_wordpress/screens/author.dart';
4 | import 'package:flutter_wordpress/screens/error.dart';
5 | import 'package:flutter_wordpress/screens/post.dart';
6 | import 'package:flutter_wordpress/screens/result.dart';
7 | import 'package:flutter_wordpress/screens/search.dart';
8 | import 'screens/home.dart';
9 |
10 | void main() {
11 | runApp(App());
12 | }
13 |
14 | class App extends StatelessWidget {
15 | @override
16 | Widget build(BuildContext context) {
17 | return MaterialApp(
18 | title: 'Flutter Wordpress',
19 | theme: ThemeData(
20 | primarySwatch: Colors.blue,
21 | visualDensity: VisualDensity.adaptivePlatformDensity,
22 | ),
23 | initialRoute: '/',
24 | routes: {
25 | '/': (_) => HomeScreen(),
26 | },
27 | onGenerateRoute: (RouteSettings settings) {
28 | final args = settings.arguments;
29 | switch (settings.name) {
30 | case "/archive":
31 | return MaterialPageRoute(
32 | builder: (_) => ArchiveScreen(
33 | category: args,
34 | ),
35 | );
36 | break;
37 | case "/author":
38 | return MaterialPageRoute(
39 | builder: (_) => AuthorScreen(
40 | author: args,
41 | ),
42 | );
43 | break;
44 | case "/search":
45 | return MaterialPageRoute(
46 | builder: (_) => SearchScreen(
47 | search: args,
48 | ),
49 | );
50 | break;
51 | case "/result":
52 | return MaterialPageRoute(
53 | builder: (_) => ResultScreen(
54 | search: args,
55 | ),
56 | );
57 | break;
58 | case "/post":
59 | return MaterialPageRoute(
60 | builder: (_) => PostScreen(
61 | post: args,
62 | ),
63 | );
64 | break;
65 | default:
66 | return MaterialPageRoute(builder: (_) => ErrorScreen());
67 | break;
68 | }
69 | },
70 | );
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/lib/models/Author.dart:
--------------------------------------------------------------------------------
1 | class Author {
2 | final int id;
3 | final String name;
4 | final String url;
5 | final String description;
6 | final String link;
7 | final String slug;
8 | final Map avatar_urls;
9 |
10 | Author(
11 | {this.id,
12 | this.name,
13 | this.url,
14 | this.description,
15 | this.link,
16 | this.slug,
17 | this.avatar_urls});
18 |
19 | factory Author.fromJson(Map map) {
20 | return Author(
21 | id: map["id"],
22 | name: map["name"],
23 | url: map["url"],
24 | link: map["link"],
25 | slug: map["slug"],
26 | avatar_urls: Map.castFrom(map["avatar_urls"]),
27 | );
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/lib/models/Post.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_wordpress/config.dart';
2 | import 'package:flutter_wordpress/models/Author.dart';
3 | import 'package:flutter_wordpress/models/models.dart';
4 |
5 | class Post {
6 | final int id;
7 | final String date;
8 | final String date_gmt;
9 | final String guid;
10 | final String modified;
11 | final String modified_gmt;
12 | final String slug;
13 | final String status;
14 | final String type;
15 | final String link;
16 | final String title;
17 | final String excerpt;
18 | final String content;
19 | final int feature_media;
20 | final String thumbnail;
21 | final String image;
22 | final String comment_status;
23 | final String ping_status;
24 | final bool sticky;
25 | final String template;
26 | final String format;
27 | final List categories;
28 | final List terms;
29 | final List tags;
30 | final Author author;
31 |
32 | Post({
33 | this.id,
34 | this.date,
35 | this.date_gmt,
36 | this.guid,
37 | this.modified,
38 | this.modified_gmt,
39 | this.slug,
40 | this.status,
41 | this.type,
42 | this.link,
43 | this.title,
44 | this.excerpt,
45 | this.content,
46 | this.author,
47 | this.feature_media,
48 | this.thumbnail,
49 | this.image,
50 | this.comment_status,
51 | this.ping_status,
52 | this.sticky,
53 | this.template,
54 | this.format,
55 | this.categories,
56 | this.terms,
57 | this.tags,
58 | });
59 |
60 | factory Post.fromJson(Map map) {
61 | final RegExp reg = RegExp(r"(&|#\w+;)");
62 | final more_details =
63 | map["_embedded"]["wp:featuredmedia"]?.first["media_details"];
64 |
65 | List t = [];
66 | for (var terms in map["_embedded"]["wp:term"] as List) {
67 | t = [...terms.cast().map((json) => Term.fromJson(json)).toList(), ...t];
68 | }
69 | return Post(
70 | id: map['id'],
71 | date: map['date'],
72 | date_gmt: map['date_gmt'],
73 | guid: map['guid']['rendered'],
74 | modified: map['modified'],
75 | modified_gmt: map['modified_gmt'],
76 | slug: map['slug'],
77 | status: map['status'],
78 | type: map['type'],
79 | link: map['link'],
80 | title: map['title']['rendered']
81 | .replaceAll(RegExp("|
"), "")
82 | .replaceAll(reg, ""),
83 | excerpt: map['excerpt']['rendered']
84 | .replaceAll(RegExp("|
"), "")
85 | .replaceAll(reg, ""),
86 | content: map['content']['rendered'],
87 | author: Author.fromJson((map["_embedded"]['author'] as List).first),
88 | feature_media: map['feature_media'],
89 | thumbnail: more_details != null
90 | ? more_details["sizes"]["medium"]["source_url"]
91 | : map["_embedded"]["wp:featuredmedia"]?.first['source_url'] ??
92 | app_thumbnail,
93 | image: map["_embedded"]["wp:featuredmedia"]?.first['source_url'] ??
94 | app_thumbnail,
95 | comment_status: map['comment_status'],
96 | ping_status: map['ping_status'],
97 | sticky: map['sticky'],
98 | template: map['template'],
99 | format: map['format'],
100 | categories: List.castFrom(map['categories']),
101 | terms: t,
102 | tags: List.castFrom(map['tags']),
103 | );
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/lib/models/Tag.dart:
--------------------------------------------------------------------------------
1 | class Tag {
2 | final int id;
3 | final int count;
4 | final String description;
5 | final String link;
6 | final String name;
7 | final String slug;
8 | final String taxonomy;
9 | final List meta;
10 |
11 | Tag({
12 | this.id,
13 | this.count,
14 | this.description,
15 | this.link,
16 | this.name,
17 | this.slug,
18 | this.taxonomy: "category",
19 | this.meta: const [],
20 | });
21 |
22 | factory Tag.fromJson(Map map) {
23 | return Tag(
24 | id: map['id'],
25 | count: map['count'],
26 | description: map['description'],
27 | link: map['link'],
28 | name: map['name'],
29 | slug: map['slug'],
30 | taxonomy: map['taxonomy'],
31 | meta: map['meta'],
32 | );
33 | }
34 |
35 | Map toMap() {
36 | return {
37 | "id": this.id,
38 | "count": this.count,
39 | "description": this.description,
40 | "link": this.link,
41 | "name": this.name,
42 | "slug": this.slug,
43 | "taxonomy": this.taxonomy,
44 | "meta": this.meta,
45 | };
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/lib/models/Term.dart:
--------------------------------------------------------------------------------
1 | class Term {
2 | final int id;
3 | final int count;
4 | final String description;
5 | final String link;
6 | final String name;
7 | final String slug;
8 | final String taxonomy;
9 | final int parent;
10 |
11 | Term({
12 | this.id,
13 | this.count,
14 | this.description,
15 | this.link,
16 | this.name,
17 | this.slug,
18 | this.taxonomy: "category",
19 | this.parent: 0,
20 | });
21 |
22 | factory Term.fromJson(Map map) {
23 | return Term(
24 | id: map['id'],
25 | count: map['count'],
26 | description: map['description'],
27 | link: map['link'],
28 | name: map['name'],
29 | slug: map['slug'],
30 | taxonomy: map['taxonomy'],
31 | parent: map['parent'],
32 | );
33 | }
34 |
35 | Map toMap() {
36 | return {
37 | "id": this.id,
38 | "count": this.count,
39 | "description": this.description,
40 | "link": this.link,
41 | "name": this.name,
42 | "slug": this.slug,
43 | "taxonomy": this.taxonomy,
44 | "parent": this.parent,
45 | };
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/lib/models/models.dart:
--------------------------------------------------------------------------------
1 | library wp_model;
2 |
3 | export './Term.dart';
4 | export './Post.dart';
5 | export './Tag.dart';
6 |
--------------------------------------------------------------------------------
/lib/models/postlisttype.dart:
--------------------------------------------------------------------------------
1 | enum PostListType {
2 | asListile,
3 | asListCard,
4 | asListRandom,
5 | }
6 |
--------------------------------------------------------------------------------
/lib/screens/archive.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_wordpress/models/models.dart';
3 | import 'package:flutter_wordpress/models/postlisttype.dart';
4 | import 'package:flutter_wordpress/widgets/PaginatePosts.dart';
5 |
6 | class ArchiveScreen extends StatelessWidget {
7 | final Term category;
8 |
9 | const ArchiveScreen({Key key, this.category}) : super(key: key);
10 | @override
11 | Widget build(BuildContext context) {
12 | return Scaffold(
13 | appBar: AppBar(
14 | title: Text("Archive: ${category.name}"),
15 | ),
16 | body: PaginatePosts(
17 | postListType: PostListType.asListRandom,
18 | category: category,
19 | ),
20 | );
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/lib/screens/author.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_wordpress/models/Author.dart';
3 | import 'package:flutter_wordpress/models/postlisttype.dart';
4 | import 'package:flutter_wordpress/widgets/PaginatePosts.dart';
5 |
6 | class AuthorScreen extends StatelessWidget {
7 | final Author author;
8 |
9 | const AuthorScreen({Key key, this.author}) : super(key: key);
10 | @override
11 | Widget build(BuildContext context) {
12 | return Scaffold(
13 | appBar: AppBar(
14 | title: Text("Author: ${author.name}"),
15 | ),
16 | body: PaginatePosts(
17 | postListType: PostListType.asListRandom,
18 | author: author,
19 | ),
20 | );
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/lib/screens/error.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class ErrorScreen extends StatefulWidget {
4 | @override
5 | _ErrorScreenState createState() => _ErrorScreenState();
6 | }
7 |
8 | class _ErrorScreenState extends State {
9 | @override
10 | Widget build(BuildContext context) {
11 | return Scaffold(
12 | appBar: AppBar(
13 | title: Text("ErrorScreen"),
14 | ),
15 | body: Container(
16 | alignment: Alignment.center,
17 | child: SingleChildScrollView(
18 | child: Column(
19 | children: [
20 | Icon(
21 | Icons.info,
22 | size: 55,
23 | color: Colors.grey,
24 | ),
25 | Container(
26 | child: Text(
27 | "404 Error",
28 | style: TextStyle(
29 | color: Colors.red,
30 | fontWeight: FontWeight.bold,
31 | fontSize: 25,
32 | ),
33 | ),
34 | padding: EdgeInsets.all(
35 | 10,
36 | ),
37 | ),
38 | Container(
39 | padding: EdgeInsets.all(
40 | 5,
41 | ),
42 | child: Text("Page error, not found"),
43 | ),
44 | FlatButton.icon(
45 | onPressed: () {
46 | Navigator.of(context).pushNamed("/");
47 | },
48 | icon: Icon(Icons.arrow_back),
49 | label: Text("GO HOME"),
50 | )
51 | ],
52 | ),
53 | ),
54 | ),
55 | );
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/lib/screens/home.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_wordpress/models/postlisttype.dart';
3 | import 'package:flutter_wordpress/widgets/CategoryDrawer.dart';
4 | import 'package:flutter_wordpress/widgets/LazyLoadPosts.dart';
5 | import 'package:flutter_wordpress/widgets/PaginatePosts.dart';
6 | import './../config.dart';
7 |
8 |
9 | class HomeScreen extends StatefulWidget {
10 | @override
11 | _HomeScreenState createState() => _HomeScreenState();
12 | }
13 |
14 | class _HomeScreenState extends State {
15 | List