├── .gitignore ├── .metadata ├── LICENSE ├── README.md ├── analysis_options.yaml ├── android ├── .gitignore ├── app │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── viewus │ │ │ │ ├── wp_blog │ │ │ │ └── MainActivity.kt │ │ │ │ └── wp_blog_app │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable-v21 │ │ │ └── launch_background.xml │ │ │ ├── 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-night │ │ │ └── styles.xml │ │ │ └── values │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── assets ├── images │ ├── img_error.jpg │ ├── newLoading.gif │ └── pageloading.gif └── logo │ ├── naijaguy.png │ ├── naijatechguy.png │ └── naijatechguyD.png ├── ios ├── .gitignore ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Podfile ├── 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 ├── app │ ├── screens │ │ ├── blog_View.dart │ │ ├── bookmark.dart │ │ ├── category.dart │ │ ├── category_screens │ │ │ ├── accessories.dart │ │ │ ├── android_cart.dart │ │ │ ├── apps_cart.dart │ │ │ ├── gaming_android.dart │ │ │ ├── gaming_cart.dart │ │ │ ├── hacking_cart.dart │ │ │ ├── internet_cart.dart │ │ │ ├── ios_cart.dart │ │ │ ├── network_cart.dart │ │ │ ├── reviews_cart.dart │ │ │ ├── smart_phones_cart.dart │ │ │ ├── social_cart.dart │ │ │ ├── tech_cart.dart │ │ │ ├── tutorial_cart.dart │ │ │ └── tweaks_cart.dart │ │ ├── home_screen.dart │ │ ├── post_view.dart │ │ ├── settings.dart │ │ └── tab_view.dart │ └── src │ │ ├── app.dart │ │ └── splash.dart ├── const_values.dart ├── custom_theme.dart ├── main.dart ├── models │ ├── posts.dart │ └── posts.g.dart ├── providers │ └── theme_provider.dart ├── size_config.dart ├── widgets │ ├── example.dart │ ├── horizonatl_view.dart │ ├── list_view_post.dart │ └── refresh_button.dart └── wp_api.dart ├── pubspec.lock ├── pubspec.yaml ├── ss ├── naijatechguy.gif └── naijtechguyTwo.gif └── test └── widget_test.dart /.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 | .flutter-plugins-dependencies 28 | .packages 29 | .pub-cache/ 30 | .pub/ 31 | /build/ 32 | 33 | # Web related 34 | lib/generated_plugin_registrant.dart 35 | 36 | #size configuration settings 37 | #lib/size_config.dart 38 | 39 | # store key properties 40 | android/key.properties 41 | 42 | # Exceptions to above rules. 43 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 44 | -------------------------------------------------------------------------------- /.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. 5 | 6 | version: 7 | revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 8 | channel: stable 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 17 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 18 | - platform: android 19 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 20 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 21 | - platform: ios 22 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 23 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 24 | - platform: linux 25 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 26 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 27 | - platform: macos 28 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 29 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 30 | - platform: web 31 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 32 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 33 | - platform: windows 34 | create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 35 | base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851 36 | 37 | # User provided section 38 | 39 | # List of Local paths (relative to this file) that should be 40 | # ignored by the migrate tool. 41 | # 42 | # Files that are not part of the templates will be ignored by default. 43 | unmanaged_files: 44 | - 'lib/main.dart' 45 | - 'ios/Runner.xcodeproj/project.pbxproj' 46 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Wordpress Blog App 2 | 3 | A simple Flutter Blog Application, which fetches data from naijatechguy.com, which is a blog, using the blog api. Still working on it and new features will be added soon. 4 | 5 |

check out app on Google Play Store here 6 | 7 | ## Plugin's Used 8 | 1.

Http

9 | 2.

Html (To remove html formats from text)

10 | 3.

Intl (Date formater)

11 | 4.

Provider (Manage State)

12 | 5.

Hive

13 | 6.

Auto Size Text

14 | 6.

Pull to Refresh

15 | 7.

Shimmer

16 | 7.

Cached Network Image (To cache image)

17 | 18 |

19 | You can fork or clone the repo and send a pull request, any help to make the app better will be accepted. Thank you. 20 |

21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 |
31 | 32 | ## Getting Started 33 | 34 | This project is a starting point for a Flutter application. 35 | 36 | For help getting started with Flutter, view our 37 | [online documentation](https://flutter.dev/docs), which offers tutorials, 38 | samples, guidance on mobile development, and a full API reference. 39 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at 17 | # https://dart-lang.github.io/linter/lints/index.html. 18 | # 19 | # Instead of disabling a lint rule for the entire project in the 20 | # section below, it can also be suppressed for a single line of code 21 | # or a specific dart file by using the `// ignore: name_of_lint` and 22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 23 | # producing the lint. 24 | rules: 25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 27 | 28 | # Additional information about this file can be found at 29 | # https://dart.dev/guides/language/analysis-options 30 | -------------------------------------------------------------------------------- /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 FileNotFoundException("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 | //def keystoreProperties = new Properties() 29 | //def keystorePropertiesFile = rootProject.file('key.properties') 30 | //if (keystorePropertiesFile.exists()) { 31 | // keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) 32 | //} 33 | 34 | android { 35 | compileSdkVersion 32 36 | 37 | sourceSets { 38 | main.java.srcDirs += 'src/main/kotlin' 39 | } 40 | 41 | lintOptions { 42 | disable 'InvalidPackage' 43 | } 44 | 45 | defaultConfig { 46 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 47 | applicationId "com.viewus.wp_blog" 48 | minSdkVersion 19 49 | targetSdkVersion 32 50 | versionCode flutterVersionCode.toInteger() 51 | versionName flutterVersionName 52 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 53 | } 54 | 55 | // signingConfigs { 56 | // release { 57 | // keyAlias keystoreProperties['keyAlias'] 58 | // keyPassword keystoreProperties['keyPassword'] 59 | // storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null 60 | // storePassword keystoreProperties['storePassword'] 61 | // } 62 | // } 63 | 64 | buildTypes { 65 | release { 66 | // TODO: Add your own signing config for the release build. 67 | // Signing with the debug keys for now, so `flutter run --release` works. 68 | signingConfig signingConfigs.debug 69 | // minifyEnabled true 70 | // useProguard true 71 | // shrinkResources true 72 | // proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 73 | } 74 | } 75 | } 76 | 77 | flutter { 78 | source '../..' 79 | } 80 | 81 | dependencies { 82 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 83 | testImplementation 'junit:junit:4.12' 84 | androidTestImplementation 'androidx.test:runner:1.1.1' 85 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' 86 | } 87 | -------------------------------------------------------------------------------- /android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | #Flutter Wrapper 2 | -keep class io.flutter.app.** { *; } 3 | -keep class io.flutter.plugin.** { *; } 4 | -keep class io.flutter.util.** { *; } 5 | -keep class io.flutter.view.** { *; } 6 | -keep class io.flutter.** { *; } 7 | -keep class io.flutter.plugins.** { *; } 8 | # -keep class com.google.firebase.** { *; } // uncomment this if you are using firebase in the project 9 | -dontwarn io.flutter.embedding.** 10 | -ignorewarnings -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 8 | 9 | 13 | 21 | 22 | 23 | 24 | 25 | 26 | 28 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/viewus/wp_blog/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.viewus.wp_blog 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | 7 | } 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/viewus/wp_blog_app/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.viewus.wp_blog_app 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /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/sudo-which-qp/wp_blog_app/815dbe5836f657a3b09014ca394455409507c26b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudo-which-qp/wp_blog_app/815dbe5836f657a3b09014ca394455409507c26b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudo-which-qp/wp_blog_app/815dbe5836f657a3b09014ca394455409507c26b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudo-which-qp/wp_blog_app/815dbe5836f657a3b09014ca394455409507c26b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudo-which-qp/wp_blog_app/815dbe5836f657a3b09014ca394455409507c26b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.6.21' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | jcenter() 7 | } 8 | 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:7.2.0' 11 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | google() 18 | mavenCentral() 19 | jcenter() 20 | } 21 | } 22 | 23 | rootProject.buildDir = '../build' 24 | subprojects { 25 | project.buildDir = "${rootProject.buildDir}/${project.name}" 26 | } 27 | subprojects { 28 | project.evaluationDependsOn(':app') 29 | } 30 | 31 | task clean(type: Delete) { 32 | delete rootProject.buildDir 33 | } 34 | -------------------------------------------------------------------------------- /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-7.4.2-all.zip 7 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /assets/images/img_error.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudo-which-qp/wp_blog_app/815dbe5836f657a3b09014ca394455409507c26b/assets/images/img_error.jpg -------------------------------------------------------------------------------- /assets/images/newLoading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudo-which-qp/wp_blog_app/815dbe5836f657a3b09014ca394455409507c26b/assets/images/newLoading.gif -------------------------------------------------------------------------------- /assets/images/pageloading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudo-which-qp/wp_blog_app/815dbe5836f657a3b09014ca394455409507c26b/assets/images/pageloading.gif -------------------------------------------------------------------------------- /assets/logo/naijaguy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudo-which-qp/wp_blog_app/815dbe5836f657a3b09014ca394455409507c26b/assets/logo/naijaguy.png -------------------------------------------------------------------------------- /assets/logo/naijatechguy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudo-which-qp/wp_blog_app/815dbe5836f657a3b09014ca394455409507c26b/assets/logo/naijatechguy.png -------------------------------------------------------------------------------- /assets/logo/naijatechguyD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudo-which-qp/wp_blog_app/815dbe5836f657a3b09014ca394455409507c26b/assets/logo/naijatechguyD.png -------------------------------------------------------------------------------- /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 flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /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 | 8 | -------------------------------------------------------------------------------- /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/sudo-which-qp/wp_blog_app/815dbe5836f657a3b09014ca394455409507c26b/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/sudo-which-qp/wp_blog_app/815dbe5836f657a3b09014ca394455409507c26b/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/sudo-which-qp/wp_blog_app/815dbe5836f657a3b09014ca394455409507c26b/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/sudo-which-qp/wp_blog_app/815dbe5836f657a3b09014ca394455409507c26b/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/sudo-which-qp/wp_blog_app/815dbe5836f657a3b09014ca394455409507c26b/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/sudo-which-qp/wp_blog_app/815dbe5836f657a3b09014ca394455409507c26b/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/sudo-which-qp/wp_blog_app/815dbe5836f657a3b09014ca394455409507c26b/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/sudo-which-qp/wp_blog_app/815dbe5836f657a3b09014ca394455409507c26b/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/sudo-which-qp/wp_blog_app/815dbe5836f657a3b09014ca394455409507c26b/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/sudo-which-qp/wp_blog_app/815dbe5836f657a3b09014ca394455409507c26b/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/sudo-which-qp/wp_blog_app/815dbe5836f657a3b09014ca394455409507c26b/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/sudo-which-qp/wp_blog_app/815dbe5836f657a3b09014ca394455409507c26b/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/sudo-which-qp/wp_blog_app/815dbe5836f657a3b09014ca394455409507c26b/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/sudo-which-qp/wp_blog_app/815dbe5836f657a3b09014ca394455409507c26b/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/sudo-which-qp/wp_blog_app/815dbe5836f657a3b09014ca394455409507c26b/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/sudo-which-qp/wp_blog_app/815dbe5836f657a3b09014ca394455409507c26b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudo-which-qp/wp_blog_app/815dbe5836f657a3b09014ca394455409507c26b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudo-which-qp/wp_blog_app/815dbe5836f657a3b09014ca394455409507c26b/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 | wp_blog_app 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" -------------------------------------------------------------------------------- /lib/app/screens/blog_View.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 3 | import 'package:hive/hive.dart'; 4 | import 'package:intl/intl.dart'; 5 | import 'package:wp_blog_app/const_values.dart'; 6 | import 'package:wp_blog_app/models/posts.dart'; 7 | 8 | class BlogView extends StatefulWidget { 9 | final Posts? index; 10 | 11 | const BlogView({this.index}); 12 | 13 | @override 14 | _BlogViewState createState() => _BlogViewState(); 15 | } 16 | 17 | class _BlogViewState extends State { 18 | displayTime(String date) { 19 | return DateFormat.yMMMMEEEEd().format(DateTime.parse(date)); 20 | } 21 | 22 | Box? storeData; 23 | 24 | @override 25 | void initState() { 26 | super.initState(); 27 | storeData = Hive.box(appState); 28 | } 29 | 30 | @override 31 | Widget build(BuildContext context) { 32 | return Scaffold( 33 | body: SingleChildScrollView( 34 | child: Column( 35 | children: [ 36 | Stack( 37 | children: [ 38 | Container( 39 | height: 300.h, 40 | decoration: BoxDecoration( 41 | borderRadius: const BorderRadius.only( 42 | bottomLeft: Radius.circular(33), 43 | bottomRight: Radius.circular(33), 44 | ), 45 | image: DecorationImage( 46 | image: NetworkImage('${widget.index!.image}'), 47 | fit: BoxFit.cover), 48 | ), 49 | ), 50 | ], 51 | ), 52 | Padding( 53 | padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10), 54 | child: Column( 55 | crossAxisAlignment: CrossAxisAlignment.start, 56 | children: [ 57 | Text( 58 | '${widget.index!.title}', 59 | style: TextStyle( 60 | fontSize: 23.sp, 61 | fontWeight: FontWeight.bold, 62 | ), 63 | ), 64 | const SizedBox( 65 | height: 10, 66 | ), 67 | Text( 68 | "${displayTime(widget.index!.time.toString())}", 69 | style: const TextStyle( 70 | color: Colors.grey, 71 | fontWeight: FontWeight.bold, 72 | ), 73 | ), 74 | const SizedBox( 75 | height: 30, 76 | ), 77 | Text( 78 | '${widget.index!.contents}', 79 | style: TextStyle( 80 | fontSize: 18.sp, 81 | ), 82 | ), 83 | ], 84 | ), 85 | ) 86 | ], 87 | ), 88 | ), 89 | ); 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /lib/app/screens/bookmark.dart: -------------------------------------------------------------------------------- 1 | import 'package:cached_network_image/cached_network_image.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 4 | import 'package:hive/hive.dart'; 5 | import 'package:intl/intl.dart'; 6 | import 'package:wp_blog_app/app/screens/blog_View.dart'; 7 | import 'package:wp_blog_app/const_values.dart'; 8 | import 'package:wp_blog_app/models/posts.dart'; 9 | import 'package:hive_flutter/hive_flutter.dart'; 10 | 11 | class Bookmark extends StatefulWidget { 12 | const Bookmark({Key? key}) : super(key: key); 13 | 14 | @override 15 | _BookmarkState createState() => _BookmarkState(); 16 | } 17 | 18 | class _BookmarkState extends State { 19 | Box? storeData; 20 | 21 | displayTime(String date) { 22 | return DateFormat.yMMMMEEEEd().format(DateTime.parse(date)); 23 | } 24 | 25 | @override 26 | void initState() { 27 | super.initState(); 28 | storeData = Hive.box(appState); 29 | } 30 | 31 | /* 32 | * All the null exception in the body is because I stored a bool which I use 33 | * in changing the theme from dark mode to light mode. 34 | * this has been chnanged and fixed but if any user have the app installed 35 | * on their phones before that issue will still be there. 36 | * I will come up with a way to fix this soon. 37 | */ 38 | 39 | @override 40 | Widget build(BuildContext context) { 41 | return ValueListenableBuilder( 42 | valueListenable: storeData!.listenable(), 43 | builder: (context, Box box, _) { 44 | // List keys = box.keys.cast().toList(); 45 | return Scaffold( 46 | body: SingleChildScrollView( 47 | child: Padding( 48 | padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10), 49 | child: ListView.builder( 50 | physics: const NeverScrollableScrollPhysics(), 51 | primary: false, 52 | shrinkWrap: true, 53 | itemCount: storeData!.keys.toList().length, 54 | itemBuilder: (_, index) { 55 | final keys = box.keys.toList()[index]; 56 | final Posts post = box.get(keys); 57 | return InkWell( 58 | onTap: () { 59 | Navigator.of(context) 60 | .push(MaterialPageRoute(builder: (_) { 61 | return BlogView(index: post); 62 | })); 63 | }, 64 | onLongPress: () { 65 | showDialog( 66 | context: context, 67 | builder: (_) { 68 | return AlertDialog( 69 | title: const Text('Warning'), 70 | content: const Text( 71 | 'You are about to delete this bookmark are ' 72 | 'you sure about this?', 73 | ), 74 | actions: [ 75 | TextButton( 76 | onPressed: () { 77 | Navigator.pop(context); 78 | }, 79 | child: const Text('No'), 80 | ), 81 | TextButton( 82 | onPressed: () { 83 | storeData!.delete(keys); 84 | Navigator.pop(context); 85 | }, 86 | child: const Text('Yes'), 87 | ), 88 | ], 89 | ); 90 | }, 91 | ); 92 | }, 93 | child: Container( 94 | margin: const EdgeInsets.only(bottom: 20, top: 20), 95 | width: MediaQuery.of(context).size.width, 96 | child: Row( 97 | crossAxisAlignment: CrossAxisAlignment.start, 98 | children: [ 99 | post.image == null 100 | ? Container() 101 | : Container( 102 | width: 100.w, 103 | height: 100.h, 104 | margin: const EdgeInsets.only(left: 20), 105 | decoration: const BoxDecoration( 106 | borderRadius: BorderRadius.all( 107 | Radius.circular(15.0), 108 | ), 109 | ), 110 | child: CachedNetworkImage( 111 | imageUrl: post.image ?? '', 112 | fit: BoxFit.cover, 113 | width: setContainerWidth(100), 114 | height: setContainerHeight(100), 115 | placeholder: (_, url) { 116 | return Image.asset( 117 | 'assets/images/newLoading.gif', 118 | width: 50, 119 | height: 50, 120 | ); 121 | }, 122 | ), 123 | ), 124 | const SizedBox( 125 | width: 15, 126 | ), 127 | Expanded( 128 | child: Column( 129 | crossAxisAlignment: CrossAxisAlignment.start, 130 | mainAxisAlignment: MainAxisAlignment.start, 131 | children: [ 132 | Padding( 133 | padding: const EdgeInsets.all(8.0), 134 | child: post.title == null 135 | ? Container() 136 | : Text( 137 | '${post.title}', 138 | style: TextStyle( 139 | fontWeight: FontWeight.bold, 140 | fontSize: setTextSize(18), 141 | ), 142 | softWrap: true, 143 | overflow: TextOverflow.fade, 144 | ), 145 | ), 146 | Padding( 147 | padding: const EdgeInsets.all(5.0), 148 | child: post.time == null 149 | ? Container() 150 | : Text( 151 | "${displayTime(post.time.toString())}", 152 | ), 153 | ), 154 | ], 155 | ), 156 | ) 157 | ], 158 | ), 159 | ), 160 | ); 161 | }, 162 | ), 163 | ), 164 | ), 165 | ); 166 | }, 167 | ); 168 | } 169 | } 170 | -------------------------------------------------------------------------------- /lib/app/screens/category_screens/accessories.dart: -------------------------------------------------------------------------------- 1 | import 'package:cached_network_image/cached_network_image.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 4 | import 'package:intl/intl.dart'; 5 | import 'package:wp_blog_app/app/screens/post_view.dart'; 6 | import 'package:wp_blog_app/const_values.dart'; 7 | import 'package:wp_blog_app/widgets/refresh_button.dart'; 8 | import 'package:wp_blog_app/wp_api.dart'; 9 | 10 | class AccessoriesScreen extends StatefulWidget { 11 | const AccessoriesScreen({Key? key}) : super(key: key); 12 | 13 | @override 14 | _AccessoriesScreenState createState() => _AccessoriesScreenState(); 15 | } 16 | 17 | class _AccessoriesScreenState extends State { 18 | WpApi api = WpApi(); 19 | 20 | String formatDateTime(DateTime dateTime) { 21 | return "${dateTime.day}/${dateTime.month}/${dateTime.year}"; 22 | } 23 | 24 | displayTime(String date) { 25 | return DateFormat.yMMMMEEEEd().format(DateTime.parse(date)); 26 | } 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | return Scaffold( 31 | appBar: AppBar( 32 | title: const Text("NaijaTechGuy Blog"), 33 | ), 34 | body: SingleChildScrollView( 35 | child: Padding( 36 | padding: const EdgeInsets.symmetric(horizontal: 20.0), 37 | child: FutureBuilder( 38 | future: api.fetchOtherCategories(476), 39 | builder: (context, AsyncSnapshot snapshot) { 40 | if (snapshot.connectionState == ConnectionState.done && 41 | snapshot.hasData) { 42 | return ListView.builder( 43 | primary: false, 44 | physics: const NeverScrollableScrollPhysics(), 45 | shrinkWrap: true, 46 | itemCount: snapshot.data.length, 47 | itemBuilder: (_, index) { 48 | return InkWell( 49 | onTap: () { 50 | var post = snapshot.data[index]; 51 | Navigator.of(context).push( 52 | MaterialPageRoute(builder: (_) { 53 | return PostView( 54 | posts: post, 55 | ); 56 | }), 57 | ); 58 | }, 59 | child: Container( 60 | margin: const EdgeInsets.only(bottom: 20, top: 20), 61 | width: MediaQuery.of(context).size.width, 62 | child: Row( 63 | crossAxisAlignment: CrossAxisAlignment.start, 64 | children: [ 65 | Container( 66 | width: 100.w, 67 | height: 100.h, 68 | margin: const EdgeInsets.only(left: 20), 69 | decoration: BoxDecoration( 70 | borderRadius: const BorderRadius.all( 71 | Radius.circular(15.0), 72 | ), 73 | image: DecorationImage( 74 | image: NetworkImage( 75 | snapshot.data[index].image, 76 | ), 77 | fit: BoxFit.cover, 78 | ), 79 | ), 80 | child: CachedNetworkImage( 81 | imageUrl: snapshot.data[index].image, 82 | fit: BoxFit.cover, 83 | width: 100.w, 84 | height: 100.h, 85 | ), 86 | ), 87 | const SizedBox( 88 | width: 15, 89 | ), 90 | Expanded( 91 | child: Column( 92 | crossAxisAlignment: CrossAxisAlignment.start, 93 | mainAxisAlignment: MainAxisAlignment.start, 94 | children: [ 95 | Padding( 96 | padding: const EdgeInsets.all(8.0), 97 | child: Text( 98 | snapshot.data[index].title 99 | .toString() 100 | .length >= 101 | 20 102 | ? snapshot.data[index].title 103 | .substring(0, 20) + 104 | "..." 105 | : snapshot.data[index].title, 106 | style: TextStyle( 107 | fontWeight: FontWeight.bold, 108 | fontSize: 18.sp, 109 | ), 110 | softWrap: true, 111 | overflow: TextOverflow.fade, 112 | ), 113 | ), 114 | Padding( 115 | padding: const EdgeInsets.all(8.0), 116 | child: Text( 117 | "${displayTime(snapshot.data[index].time)}", 118 | ), 119 | ), 120 | ], 121 | ), 122 | ) 123 | ], 124 | ), 125 | ), 126 | ); 127 | }, 128 | ); 129 | } else if (snapshot.connectionState == ConnectionState.none) { 130 | return Center( 131 | child: Column( 132 | children: [ 133 | const Text( 134 | "Sorry please check you internet connection, and swipe on pull down to refresh \n \n Or", 135 | ), 136 | RefreshButton( 137 | text: 'Refresh', 138 | onPressed: () { 139 | setState(() {}); 140 | }, 141 | ), 142 | ], 143 | ), 144 | ); 145 | } else if (snapshot.connectionState == ConnectionState.waiting) { 146 | return Center( 147 | child: Column( 148 | mainAxisAlignment: MainAxisAlignment.center, 149 | children: [ 150 | const SizedBox(height: 10.0), 151 | Center( 152 | child: Image.asset( 153 | 'assets/images/newLoading.gif', 154 | width: 350, 155 | height: 200, 156 | ), 157 | ), 158 | ], 159 | ), 160 | ); 161 | } else { 162 | return Center( 163 | child: Column( 164 | children: [ 165 | const Padding( 166 | padding: EdgeInsets.all(20.0), 167 | child: Text( 168 | "Please check if you are connected to the internet and swipe or pull down to refresh \n \n Or", 169 | style: TextStyle(), 170 | softWrap: true, 171 | textAlign: TextAlign.center, 172 | ), 173 | ), 174 | RefreshButton( 175 | text: 'Refresh', 176 | onPressed: () { 177 | setState(() {}); 178 | }, 179 | ), 180 | ], 181 | ), 182 | ); 183 | } 184 | }, 185 | ), 186 | ), 187 | ), 188 | ); 189 | } 190 | } 191 | -------------------------------------------------------------------------------- /lib/app/screens/category_screens/android_cart.dart: -------------------------------------------------------------------------------- 1 | import 'package:cached_network_image/cached_network_image.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 4 | import 'package:intl/intl.dart'; 5 | import 'package:wp_blog_app/app/screens/post_view.dart'; 6 | import 'package:wp_blog_app/const_values.dart'; 7 | import 'package:wp_blog_app/widgets/refresh_button.dart'; 8 | import 'package:wp_blog_app/wp_api.dart'; 9 | 10 | class AndroidCartScreen extends StatefulWidget { 11 | const AndroidCartScreen({Key? key}) : super(key: key); 12 | 13 | @override 14 | _AndroidCartScreenState createState() => _AndroidCartScreenState(); 15 | } 16 | 17 | class _AndroidCartScreenState extends State { 18 | WpApi api = WpApi(); 19 | 20 | String formatDateTime(DateTime dateTime) { 21 | return "${dateTime.day}/${dateTime.month}/${dateTime.year}"; 22 | } 23 | 24 | displayTime(String date) { 25 | return DateFormat.yMMMMEEEEd().format(DateTime.parse(date)); 26 | } 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | return Scaffold( 31 | appBar: AppBar( 32 | title: const Text("NaijaTechGuy Blog"), 33 | ), 34 | body: SingleChildScrollView( 35 | child: Padding( 36 | padding: const EdgeInsets.symmetric(horizontal: 20.0), 37 | child: FutureBuilder( 38 | future: api.fetchOtherCategories(173), 39 | builder: (context, AsyncSnapshot snapshot) { 40 | if (snapshot.connectionState == ConnectionState.done && 41 | snapshot.hasData) { 42 | return ListView.builder( 43 | primary: false, 44 | physics: const NeverScrollableScrollPhysics(), 45 | shrinkWrap: true, 46 | itemCount: snapshot.data.length, 47 | itemBuilder: (_, index) { 48 | return InkWell( 49 | onTap: () { 50 | var post = snapshot.data[index]; 51 | Navigator.of(context).push( 52 | MaterialPageRoute(builder: (_) { 53 | return PostView( 54 | posts: post, 55 | ); 56 | }), 57 | ); 58 | }, 59 | child: Container( 60 | margin: const EdgeInsets.only(bottom: 20, top: 20), 61 | width: MediaQuery.of(context).size.width, 62 | child: Row( 63 | crossAxisAlignment: CrossAxisAlignment.start, 64 | children: [ 65 | Container( 66 | width: 100.w, 67 | height: 100.h, 68 | margin: const EdgeInsets.only(left: 20), 69 | decoration: BoxDecoration( 70 | borderRadius: const BorderRadius.all( 71 | Radius.circular(15.0), 72 | ), 73 | image: DecorationImage( 74 | image: NetworkImage( 75 | snapshot.data[index].image, 76 | ), 77 | fit: BoxFit.cover, 78 | ), 79 | ), 80 | child: CachedNetworkImage( 81 | imageUrl: snapshot.data[index].image, 82 | fit: BoxFit.cover, 83 | width: 100.w, 84 | height: 100.h, 85 | ), 86 | ), 87 | const SizedBox( 88 | width: 15, 89 | ), 90 | Expanded( 91 | child: Column( 92 | crossAxisAlignment: CrossAxisAlignment.start, 93 | mainAxisAlignment: MainAxisAlignment.start, 94 | children: [ 95 | Padding( 96 | padding: const EdgeInsets.all(8.0), 97 | child: Text( 98 | snapshot.data[index].title 99 | .toString() 100 | .length >= 101 | 20 102 | ? snapshot.data[index].title 103 | .substring(0, 20) + 104 | "..." 105 | : snapshot.data[index].title, 106 | style: TextStyle( 107 | fontWeight: FontWeight.bold, 108 | fontSize: 18.sp, 109 | ), 110 | softWrap: true, 111 | overflow: TextOverflow.fade, 112 | ), 113 | ), 114 | Padding( 115 | padding: const EdgeInsets.all(8.0), 116 | child: Text( 117 | "${displayTime(snapshot.data[index].time)}", 118 | ), 119 | ), 120 | ], 121 | ), 122 | ) 123 | ], 124 | ), 125 | ), 126 | ); 127 | }, 128 | ); 129 | } else if (snapshot.connectionState == ConnectionState.none) { 130 | return Center( 131 | child: Column( 132 | children: [ 133 | const Text( 134 | "Sorry please check you internet connection, and swipe on pull down to refresh \n \n Or", 135 | ), 136 | RefreshButton( 137 | text: 'Refresh', 138 | onPressed: () { 139 | setState(() {}); 140 | }, 141 | ), 142 | ], 143 | ), 144 | ); 145 | } else if (snapshot.connectionState == ConnectionState.waiting) { 146 | return Center( 147 | child: Column( 148 | mainAxisAlignment: MainAxisAlignment.center, 149 | children: [ 150 | const SizedBox(height: 10.0), 151 | Center( 152 | child: Image.asset( 153 | 'assets/images/newLoading.gif', 154 | width: 350, 155 | height: 200, 156 | ), 157 | ), 158 | ], 159 | ), 160 | ); 161 | } else { 162 | return Center( 163 | child: Column( 164 | children: [ 165 | const Padding( 166 | padding: EdgeInsets.all(20.0), 167 | child: Text( 168 | "Please check if you are connected to the internet and swipe or pull down to refresh \n \n Or", 169 | style: TextStyle(), 170 | softWrap: true, 171 | textAlign: TextAlign.center, 172 | ), 173 | ), 174 | RefreshButton( 175 | text: 'Refresh', 176 | onPressed: () { 177 | setState(() {}); 178 | }, 179 | ), 180 | ], 181 | ), 182 | ); 183 | } 184 | }, 185 | ), 186 | ), 187 | ), 188 | ); 189 | } 190 | } 191 | -------------------------------------------------------------------------------- /lib/app/screens/category_screens/apps_cart.dart: -------------------------------------------------------------------------------- 1 | import 'package:cached_network_image/cached_network_image.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 4 | import 'package:intl/intl.dart'; 5 | import 'package:wp_blog_app/app/screens/post_view.dart'; 6 | import 'package:wp_blog_app/const_values.dart'; 7 | import 'package:wp_blog_app/widgets/refresh_button.dart'; 8 | import 'package:wp_blog_app/wp_api.dart'; 9 | 10 | class AppsCartScreen extends StatefulWidget { 11 | const AppsCartScreen({Key? key}) : super(key: key); 12 | 13 | @override 14 | _AppsCartScreenState createState() => _AppsCartScreenState(); 15 | } 16 | 17 | class _AppsCartScreenState extends State { 18 | WpApi api = WpApi(); 19 | 20 | String formatDateTime(DateTime dateTime) { 21 | return "${dateTime.day}/${dateTime.month}/${dateTime.year}"; 22 | } 23 | 24 | displayTime(String date) { 25 | return DateFormat.yMMMMEEEEd().format(DateTime.parse(date)); 26 | } 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | return Scaffold( 31 | appBar: AppBar( 32 | title: const Text("NaijaTechGuy Blog"), 33 | ), 34 | body: SingleChildScrollView( 35 | child: Padding( 36 | padding: const EdgeInsets.symmetric(horizontal: 20.0), 37 | child: FutureBuilder( 38 | future: api.fetchOtherCategories(17), 39 | builder: (context, AsyncSnapshot snapshot) { 40 | if (snapshot.connectionState == ConnectionState.done && 41 | snapshot.hasData) { 42 | return ListView.builder( 43 | primary: false, 44 | physics: const NeverScrollableScrollPhysics(), 45 | shrinkWrap: true, 46 | itemCount: snapshot.data.length, 47 | itemBuilder: (_, index) { 48 | return InkWell( 49 | onTap: () { 50 | var post = snapshot.data[index]; 51 | Navigator.of(context).push( 52 | MaterialPageRoute(builder: (_) { 53 | return PostView( 54 | posts: post, 55 | ); 56 | }), 57 | ); 58 | }, 59 | child: Container( 60 | margin: const EdgeInsets.only(bottom: 20, top: 20), 61 | width: MediaQuery.of(context).size.width, 62 | child: Row( 63 | crossAxisAlignment: CrossAxisAlignment.start, 64 | children: [ 65 | Container( 66 | width: 100.w, 67 | height: 100.h, 68 | margin: const EdgeInsets.only(left: 20), 69 | decoration: BoxDecoration( 70 | borderRadius: const BorderRadius.all( 71 | Radius.circular(15.0), 72 | ), 73 | image: DecorationImage( 74 | image: NetworkImage( 75 | snapshot.data[index].image, 76 | ), 77 | fit: BoxFit.cover, 78 | ), 79 | ), 80 | child: CachedNetworkImage( 81 | imageUrl: snapshot.data[index].image, 82 | fit: BoxFit.cover, 83 | width: 100.w, 84 | height: 100.h, 85 | ), 86 | ), 87 | const SizedBox( 88 | width: 15, 89 | ), 90 | Expanded( 91 | child: Column( 92 | crossAxisAlignment: CrossAxisAlignment.start, 93 | mainAxisAlignment: MainAxisAlignment.start, 94 | children: [ 95 | Padding( 96 | padding: const EdgeInsets.all(8.0), 97 | child: Text( 98 | snapshot.data[index].title 99 | .toString() 100 | .length >= 101 | 20 102 | ? snapshot.data[index].title 103 | .substring(0, 20) + 104 | "..." 105 | : snapshot.data[index].title, 106 | style: TextStyle( 107 | fontWeight: FontWeight.bold, 108 | fontSize: 18.sp, 109 | ), 110 | softWrap: true, 111 | overflow: TextOverflow.fade, 112 | ), 113 | ), 114 | Padding( 115 | padding: const EdgeInsets.all(8.0), 116 | child: Text( 117 | "${displayTime(snapshot.data[index].time)}", 118 | ), 119 | ), 120 | ], 121 | ), 122 | ) 123 | ], 124 | ), 125 | ), 126 | ); 127 | }, 128 | ); 129 | } else if (snapshot.connectionState == ConnectionState.none) { 130 | return Center( 131 | child: Column( 132 | children: [ 133 | const Text( 134 | "Sorry please check you internet connection, and swipe on pull down to refresh \n \n Or", 135 | ), 136 | RefreshButton( 137 | text: 'Refresh', 138 | onPressed: () { 139 | setState(() {}); 140 | }, 141 | ), 142 | ], 143 | ), 144 | ); 145 | } else if (snapshot.connectionState == ConnectionState.waiting) { 146 | return Center( 147 | child: Column( 148 | mainAxisAlignment: MainAxisAlignment.center, 149 | children: [ 150 | const SizedBox(height: 10.0), 151 | Center( 152 | child: Image.asset( 153 | 'assets/images/newLoading.gif', 154 | width: 350, 155 | height: 200, 156 | ), 157 | ), 158 | ], 159 | ), 160 | ); 161 | } else { 162 | return Center( 163 | child: Column( 164 | children: [ 165 | const Padding( 166 | padding: EdgeInsets.all(20.0), 167 | child: Text( 168 | "Please check if you are connected to the internet and swipe or pull down to refresh \n \n Or", 169 | style: TextStyle(), 170 | softWrap: true, 171 | textAlign: TextAlign.center, 172 | ), 173 | ), 174 | RefreshButton( 175 | text: 'Refresh', 176 | onPressed: () { 177 | setState(() {}); 178 | }, 179 | ), 180 | ], 181 | ), 182 | ); 183 | } 184 | }, 185 | ), 186 | ), 187 | ), 188 | ); 189 | } 190 | } 191 | -------------------------------------------------------------------------------- /lib/app/screens/category_screens/gaming_cart.dart: -------------------------------------------------------------------------------- 1 | import 'package:cached_network_image/cached_network_image.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 4 | import 'package:intl/intl.dart'; 5 | import 'package:wp_blog_app/app/screens/post_view.dart'; 6 | import 'package:wp_blog_app/const_values.dart'; 7 | import 'package:wp_blog_app/widgets/refresh_button.dart'; 8 | import 'package:wp_blog_app/wp_api.dart'; 9 | 10 | class GamingCartScreen extends StatefulWidget { 11 | const GamingCartScreen({Key? key}) : super(key: key); 12 | 13 | @override 14 | _GamingCartScreenState createState() => _GamingCartScreenState(); 15 | } 16 | 17 | class _GamingCartScreenState extends State { 18 | WpApi api = WpApi(); 19 | 20 | String formatDateTime(DateTime dateTime) { 21 | return "${dateTime.day}/${dateTime.month}/${dateTime.year}"; 22 | } 23 | 24 | displayTime(String date) { 25 | return DateFormat.yMMMMEEEEd().format(DateTime.parse(date)); 26 | } 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | return Scaffold( 31 | appBar: AppBar( 32 | title: const Text("NaijaTechGuy Blog"), 33 | ), 34 | body: SingleChildScrollView( 35 | child: Padding( 36 | padding: const EdgeInsets.symmetric(horizontal: 20.0), 37 | child: FutureBuilder( 38 | future: api.fetchOtherCategories(176), 39 | builder: (context, AsyncSnapshot snapshot) { 40 | if (snapshot.connectionState == ConnectionState.done && 41 | snapshot.hasData) { 42 | return ListView.builder( 43 | primary: false, 44 | physics: const NeverScrollableScrollPhysics(), 45 | shrinkWrap: true, 46 | itemCount: snapshot.data.length, 47 | itemBuilder: (_, index) { 48 | return InkWell( 49 | onTap: () { 50 | var post = snapshot.data[index]; 51 | Navigator.of(context).push( 52 | MaterialPageRoute(builder: (_) { 53 | return PostView( 54 | posts: post, 55 | ); 56 | }), 57 | ); 58 | }, 59 | child: Container( 60 | margin: const EdgeInsets.only(bottom: 20, top: 20), 61 | width: MediaQuery.of(context).size.width, 62 | child: Row( 63 | crossAxisAlignment: CrossAxisAlignment.start, 64 | children: [ 65 | Container( 66 | width: 100.w, 67 | height: 100.h, 68 | margin: const EdgeInsets.only(left: 20), 69 | decoration: BoxDecoration( 70 | borderRadius: const BorderRadius.all( 71 | Radius.circular(15.0), 72 | ), 73 | image: DecorationImage( 74 | image: NetworkImage( 75 | snapshot.data[index].image, 76 | ), 77 | fit: BoxFit.cover, 78 | ), 79 | ), 80 | child: CachedNetworkImage( 81 | imageUrl: snapshot.data[index].image, 82 | fit: BoxFit.cover, 83 | width: 100.w, 84 | height: 100.h, 85 | ), 86 | ), 87 | const SizedBox( 88 | width: 15, 89 | ), 90 | Expanded( 91 | child: Column( 92 | crossAxisAlignment: CrossAxisAlignment.start, 93 | mainAxisAlignment: MainAxisAlignment.start, 94 | children: [ 95 | Padding( 96 | padding: const EdgeInsets.all(8.0), 97 | child: Text( 98 | snapshot.data[index].title 99 | .toString() 100 | .length >= 101 | 20 102 | ? snapshot.data[index].title 103 | .substring(0, 20) + 104 | "..." 105 | : snapshot.data[index].title, 106 | style: TextStyle( 107 | fontWeight: FontWeight.bold, 108 | fontSize: 18.sp, 109 | ), 110 | softWrap: true, 111 | overflow: TextOverflow.fade, 112 | ), 113 | ), 114 | Padding( 115 | padding: const EdgeInsets.all(8.0), 116 | child: Text( 117 | "${displayTime(snapshot.data[index].time)}", 118 | ), 119 | ), 120 | ], 121 | ), 122 | ) 123 | ], 124 | ), 125 | ), 126 | ); 127 | }, 128 | ); 129 | } else if (snapshot.connectionState == ConnectionState.none) { 130 | return Center( 131 | child: Column( 132 | children: [ 133 | const Text( 134 | "Sorry please check you internet connection, and swipe on pull down to refresh \n \n Or", 135 | style: TextStyle(), 136 | ), 137 | RefreshButton( 138 | text: 'Refresh', 139 | onPressed: () { 140 | setState(() {}); 141 | }, 142 | ), 143 | ], 144 | ), 145 | ); 146 | } else if (snapshot.connectionState == ConnectionState.waiting) { 147 | return Center( 148 | child: Column( 149 | mainAxisAlignment: MainAxisAlignment.center, 150 | children: [ 151 | const SizedBox(height: 10.0), 152 | Center( 153 | child: Image.asset( 154 | 'assets/images/newLoading.gif', 155 | width: 350, 156 | height: 200, 157 | ), 158 | ), 159 | ], 160 | ), 161 | ); 162 | } else { 163 | return Center( 164 | child: Column( 165 | children: [ 166 | const Padding( 167 | padding: EdgeInsets.all(20.0), 168 | child: Text( 169 | "Please check if you are connected to the internet and swipe or pull down to refresh \n \n Or", 170 | style: TextStyle(), 171 | softWrap: true, 172 | textAlign: TextAlign.center, 173 | ), 174 | ), 175 | RefreshButton( 176 | text: 'Refresh', 177 | onPressed: () { 178 | setState(() {}); 179 | }, 180 | ), 181 | ], 182 | ), 183 | ); 184 | } 185 | }, 186 | ), 187 | ), 188 | ), 189 | ); 190 | } 191 | } 192 | -------------------------------------------------------------------------------- /lib/app/screens/category_screens/hacking_cart.dart: -------------------------------------------------------------------------------- 1 | import 'package:cached_network_image/cached_network_image.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 4 | import 'package:intl/intl.dart'; 5 | import 'package:wp_blog_app/app/screens/post_view.dart'; 6 | import 'package:wp_blog_app/const_values.dart'; 7 | import 'package:wp_blog_app/widgets/refresh_button.dart'; 8 | import 'package:wp_blog_app/wp_api.dart'; 9 | 10 | class HackingScreen extends StatefulWidget { 11 | const HackingScreen({Key? key}) : super(key: key); 12 | 13 | @override 14 | _HackingScreenState createState() => _HackingScreenState(); 15 | } 16 | 17 | class _HackingScreenState extends State { 18 | WpApi api = WpApi(); 19 | 20 | String formatDateTime(DateTime dateTime) { 21 | return "${dateTime.day}/${dateTime.month}/${dateTime.year}"; 22 | } 23 | 24 | displayTime(String date) { 25 | return DateFormat.yMMMMEEEEd().format(DateTime.parse(date)); 26 | } 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | return Scaffold( 31 | appBar: AppBar( 32 | title: const Text("NaijaTechGuy Blog"), 33 | ), 34 | body: SingleChildScrollView( 35 | child: Padding( 36 | padding: const EdgeInsets.symmetric(horizontal: 20.0), 37 | child: FutureBuilder( 38 | future: api.fetchOtherCategories(419), 39 | builder: (context, AsyncSnapshot snapshot) { 40 | if (snapshot.connectionState == ConnectionState.done && 41 | snapshot.hasData) { 42 | return ListView.builder( 43 | primary: false, 44 | physics: const NeverScrollableScrollPhysics(), 45 | shrinkWrap: true, 46 | itemCount: snapshot.data.length, 47 | itemBuilder: (_, index) { 48 | return InkWell( 49 | onTap: () { 50 | var post = snapshot.data[index]; 51 | Navigator.of(context).push( 52 | MaterialPageRoute(builder: (_) { 53 | return PostView( 54 | posts: post, 55 | ); 56 | }), 57 | ); 58 | }, 59 | child: Container( 60 | margin: const EdgeInsets.only(bottom: 20, top: 20), 61 | width: MediaQuery.of(context).size.width, 62 | child: Row( 63 | crossAxisAlignment: CrossAxisAlignment.start, 64 | children: [ 65 | Container( 66 | width: 100.w, 67 | height: 100.h, 68 | margin: const EdgeInsets.only(left: 20), 69 | decoration: BoxDecoration( 70 | borderRadius: const BorderRadius.all( 71 | Radius.circular(15.0), 72 | ), 73 | image: DecorationImage( 74 | image: NetworkImage( 75 | snapshot.data[index].image, 76 | ), 77 | fit: BoxFit.cover, 78 | ), 79 | ), 80 | child: CachedNetworkImage( 81 | imageUrl: snapshot.data[index].image, 82 | fit: BoxFit.cover, 83 | width: 100.w, 84 | height: 100.h, 85 | ), 86 | ), 87 | const SizedBox( 88 | width: 15, 89 | ), 90 | Expanded( 91 | child: Column( 92 | crossAxisAlignment: CrossAxisAlignment.start, 93 | mainAxisAlignment: MainAxisAlignment.start, 94 | children: [ 95 | Padding( 96 | padding: const EdgeInsets.all(8.0), 97 | child: Text( 98 | snapshot.data[index].title 99 | .toString() 100 | .length >= 101 | 20 102 | ? snapshot.data[index].title 103 | .substring(0, 20) + 104 | "..." 105 | : snapshot.data[index].title, 106 | style: TextStyle( 107 | fontWeight: FontWeight.bold, 108 | fontSize: 18.sp, 109 | ), 110 | softWrap: true, 111 | overflow: TextOverflow.fade, 112 | ), 113 | ), 114 | Padding( 115 | padding: const EdgeInsets.all(8.0), 116 | child: Text( 117 | "${displayTime(snapshot.data[index].time)}", 118 | ), 119 | ), 120 | ], 121 | ), 122 | ) 123 | ], 124 | ), 125 | ), 126 | ); 127 | }, 128 | ); 129 | } else if (snapshot.connectionState == ConnectionState.none) { 130 | return Center( 131 | child: Column( 132 | children: [ 133 | const Text( 134 | "Sorry please check you internet connection, and swipe on pull down to refresh \n \n Or", 135 | ), 136 | RefreshButton( 137 | text: 'Refresh', 138 | onPressed: () { 139 | setState(() {}); 140 | }, 141 | ), 142 | ], 143 | ), 144 | ); 145 | } else if (snapshot.connectionState == ConnectionState.waiting) { 146 | return Center( 147 | child: Column( 148 | mainAxisAlignment: MainAxisAlignment.center, 149 | children: [ 150 | const SizedBox(height: 10.0), 151 | Center( 152 | child: Image.asset( 153 | 'assets/images/newLoading.gif', 154 | width: 350, 155 | height: 200, 156 | ), 157 | ), 158 | ], 159 | ), 160 | ); 161 | } else { 162 | return Center( 163 | child: Column( 164 | children: [ 165 | const Padding( 166 | padding: EdgeInsets.all(20.0), 167 | child: Text( 168 | "Please check if you are connected to the internet and swipe or pull down to refresh \n \n Or", 169 | style: TextStyle(), 170 | softWrap: true, 171 | textAlign: TextAlign.center, 172 | ), 173 | ), 174 | RefreshButton( 175 | text: 'Refresh', 176 | onPressed: () { 177 | setState(() {}); 178 | }, 179 | ), 180 | ], 181 | ), 182 | ); 183 | } 184 | }, 185 | ), 186 | ), 187 | ), 188 | ); 189 | } 190 | } 191 | -------------------------------------------------------------------------------- /lib/app/screens/category_screens/internet_cart.dart: -------------------------------------------------------------------------------- 1 | import 'package:cached_network_image/cached_network_image.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 4 | import 'package:intl/intl.dart'; 5 | import 'package:wp_blog_app/app/screens/post_view.dart'; 6 | import 'package:wp_blog_app/const_values.dart'; 7 | import 'package:wp_blog_app/widgets/refresh_button.dart'; 8 | import 'package:wp_blog_app/wp_api.dart'; 9 | 10 | class InternetCartScreen extends StatefulWidget { 11 | const InternetCartScreen({Key? key}) : super(key: key); 12 | 13 | @override 14 | _InternetCartScreenState createState() => _InternetCartScreenState(); 15 | } 16 | 17 | class _InternetCartScreenState extends State { 18 | WpApi api = WpApi(); 19 | 20 | String formatDateTime(DateTime dateTime) { 21 | return "${dateTime.day}/${dateTime.month}/${dateTime.year}"; 22 | } 23 | 24 | displayTime(String date) { 25 | return DateFormat.yMMMMEEEEd().format(DateTime.parse(date)); 26 | } 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | return Scaffold( 31 | appBar: AppBar( 32 | title: const Text("NaijaTechGuy Blog"), 33 | ), 34 | body: SingleChildScrollView( 35 | child: Padding( 36 | padding: const EdgeInsets.symmetric(horizontal: 20.0), 37 | child: FutureBuilder( 38 | future: api.fetchOtherCategories(416), 39 | builder: (context, AsyncSnapshot snapshot) { 40 | if (snapshot.connectionState == ConnectionState.done && 41 | snapshot.hasData) { 42 | return ListView.builder( 43 | primary: false, 44 | physics: const NeverScrollableScrollPhysics(), 45 | shrinkWrap: true, 46 | itemCount: snapshot.data.length, 47 | itemBuilder: (_, index) { 48 | return InkWell( 49 | onTap: () { 50 | var post = snapshot.data[index]; 51 | Navigator.of(context).push( 52 | MaterialPageRoute(builder: (_) { 53 | return PostView( 54 | posts: post, 55 | ); 56 | }), 57 | ); 58 | }, 59 | child: Container( 60 | margin: const EdgeInsets.only(bottom: 20, top: 20), 61 | width: MediaQuery.of(context).size.width, 62 | child: Row( 63 | crossAxisAlignment: CrossAxisAlignment.start, 64 | children: [ 65 | Container( 66 | width: 100.w, 67 | height: 100.h, 68 | margin: const EdgeInsets.only(left: 20), 69 | decoration: BoxDecoration( 70 | borderRadius: const BorderRadius.all( 71 | Radius.circular(15.0), 72 | ), 73 | image: DecorationImage( 74 | image: NetworkImage( 75 | snapshot.data[index].image, 76 | ), 77 | fit: BoxFit.cover, 78 | ), 79 | ), 80 | child: CachedNetworkImage( 81 | imageUrl: snapshot.data[index].image, 82 | fit: BoxFit.cover, 83 | width: 100.w, 84 | height: 100.h, 85 | ), 86 | ), 87 | const SizedBox( 88 | width: 15, 89 | ), 90 | Expanded( 91 | child: Column( 92 | crossAxisAlignment: CrossAxisAlignment.start, 93 | mainAxisAlignment: MainAxisAlignment.start, 94 | children: [ 95 | Padding( 96 | padding: const EdgeInsets.all(8.0), 97 | child: Text( 98 | snapshot.data[index].title 99 | .toString() 100 | .length >= 101 | 20 102 | ? snapshot.data[index].title 103 | .substring(0, 20) + 104 | "..." 105 | : snapshot.data[index].title, 106 | style: TextStyle( 107 | fontWeight: FontWeight.bold, 108 | fontSize: 18.sp, 109 | ), 110 | softWrap: true, 111 | overflow: TextOverflow.fade, 112 | ), 113 | ), 114 | Padding( 115 | padding: const EdgeInsets.all(8.0), 116 | child: Text( 117 | "${displayTime(snapshot.data[index].time)}", 118 | ), 119 | ), 120 | ], 121 | ), 122 | ) 123 | ], 124 | ), 125 | ), 126 | ); 127 | }, 128 | ); 129 | } else if (snapshot.connectionState == ConnectionState.none) { 130 | return Center( 131 | child: Column( 132 | children: [ 133 | const Text( 134 | "Sorry please check you internet connection, and swipe on pull down to refresh \n \n Or", 135 | ), 136 | RefreshButton( 137 | text: 'Refresh', 138 | onPressed: () { 139 | setState(() {}); 140 | }, 141 | ), 142 | ], 143 | ), 144 | ); 145 | } else if (snapshot.connectionState == ConnectionState.waiting) { 146 | return Center( 147 | child: Column( 148 | mainAxisAlignment: MainAxisAlignment.center, 149 | children: [ 150 | const SizedBox(height: 10.0), 151 | Center( 152 | child: Image.asset( 153 | 'assets/images/newLoading.gif', 154 | width: 350, 155 | height: 200, 156 | ), 157 | ), 158 | ], 159 | ), 160 | ); 161 | } else { 162 | return Center( 163 | child: Column( 164 | children: [ 165 | const Padding( 166 | padding: EdgeInsets.all(20.0), 167 | child: Text( 168 | "Please check if you are connected to the internet and swipe or pull down to refresh \n \n Or", 169 | style: TextStyle(), 170 | softWrap: true, 171 | textAlign: TextAlign.center, 172 | ), 173 | ), 174 | RefreshButton( 175 | text: 'Refresh', 176 | onPressed: () { 177 | setState(() {}); 178 | }, 179 | ), 180 | ], 181 | ), 182 | ); 183 | } 184 | }, 185 | ), 186 | ), 187 | ), 188 | ); 189 | } 190 | } 191 | -------------------------------------------------------------------------------- /lib/app/screens/category_screens/ios_cart.dart: -------------------------------------------------------------------------------- 1 | import 'package:cached_network_image/cached_network_image.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 4 | import 'package:intl/intl.dart'; 5 | import 'package:wp_blog_app/app/screens/post_view.dart'; 6 | import 'package:wp_blog_app/const_values.dart'; 7 | import 'package:wp_blog_app/widgets/refresh_button.dart'; 8 | import 'package:wp_blog_app/wp_api.dart'; 9 | 10 | class IosCartScreen extends StatefulWidget { 11 | const IosCartScreen({Key? key}) : super(key: key); 12 | 13 | @override 14 | _IosCartScreenState createState() => _IosCartScreenState(); 15 | } 16 | 17 | class _IosCartScreenState extends State { 18 | WpApi api = WpApi(); 19 | 20 | String formatDateTime(DateTime dateTime) { 21 | return "${dateTime.day}/${dateTime.month}/${dateTime.year}"; 22 | } 23 | 24 | displayTime(String date) { 25 | return DateFormat.yMMMMEEEEd().format(DateTime.parse(date)); 26 | } 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | return Scaffold( 31 | appBar: AppBar( 32 | title: const Text("NaijaTechGuy Blog"), 33 | ), 34 | body: SingleChildScrollView( 35 | child: Padding( 36 | padding: const EdgeInsets.symmetric(horizontal: 20.0), 37 | child: FutureBuilder( 38 | future: api.fetchOtherCategories(286), 39 | builder: (context, AsyncSnapshot snapshot) { 40 | if (snapshot.connectionState == ConnectionState.done && 41 | snapshot.hasData) { 42 | return ListView.builder( 43 | primary: false, 44 | physics: const NeverScrollableScrollPhysics(), 45 | shrinkWrap: true, 46 | itemCount: snapshot.data.length, 47 | itemBuilder: (_, index) { 48 | return InkWell( 49 | onTap: () { 50 | var post = snapshot.data[index]; 51 | Navigator.of(context).push( 52 | MaterialPageRoute(builder: (_) { 53 | return PostView( 54 | posts: post, 55 | ); 56 | }), 57 | ); 58 | }, 59 | child: Container( 60 | margin: const EdgeInsets.only(bottom: 20, top: 20), 61 | width: MediaQuery.of(context).size.width, 62 | child: Row( 63 | crossAxisAlignment: CrossAxisAlignment.start, 64 | children: [ 65 | Container( 66 | width: 100.w, 67 | height: 100.h, 68 | margin: const EdgeInsets.only(left: 20), 69 | decoration: BoxDecoration( 70 | borderRadius: const BorderRadius.all( 71 | Radius.circular(15.0), 72 | ), 73 | image: DecorationImage( 74 | image: NetworkImage( 75 | snapshot.data[index].image, 76 | ), 77 | fit: BoxFit.cover, 78 | ), 79 | ), 80 | child: CachedNetworkImage( 81 | imageUrl: snapshot.data[index].image, 82 | fit: BoxFit.cover, 83 | width: 100.w, 84 | height: 100.h, 85 | ), 86 | ), 87 | const SizedBox( 88 | width: 15, 89 | ), 90 | Expanded( 91 | child: Column( 92 | crossAxisAlignment: CrossAxisAlignment.start, 93 | mainAxisAlignment: MainAxisAlignment.start, 94 | children: [ 95 | Padding( 96 | padding: const EdgeInsets.all(8.0), 97 | child: Text( 98 | snapshot.data[index].title 99 | .toString() 100 | .length >= 101 | 20 102 | ? snapshot.data[index].title 103 | .substring(0, 20) + 104 | "..." 105 | : snapshot.data[index].title, 106 | style: TextStyle( 107 | fontWeight: FontWeight.bold, 108 | fontSize: 18.sp, 109 | ), 110 | softWrap: true, 111 | overflow: TextOverflow.fade, 112 | ), 113 | ), 114 | Padding( 115 | padding: const EdgeInsets.all(8.0), 116 | child: Text( 117 | "${displayTime(snapshot.data[index].time)}", 118 | ), 119 | ), 120 | ], 121 | ), 122 | ) 123 | ], 124 | ), 125 | ), 126 | ); 127 | }, 128 | ); 129 | } else if (snapshot.connectionState == ConnectionState.none) { 130 | return Center( 131 | child: Column( 132 | children: [ 133 | const Text( 134 | "Sorry please check you internet connection, and swipe on pull down to refresh \n \n Or", 135 | ), 136 | RefreshButton( 137 | text: 'Refresh', 138 | onPressed: () { 139 | setState(() {}); 140 | }, 141 | ), 142 | ], 143 | ), 144 | ); 145 | } else if (snapshot.connectionState == ConnectionState.waiting) { 146 | return Center( 147 | child: Column( 148 | mainAxisAlignment: MainAxisAlignment.center, 149 | children: [ 150 | const SizedBox(height: 10.0), 151 | Center( 152 | child: Image.asset( 153 | 'assets/images/newLoading.gif', 154 | width: 350, 155 | height: 200, 156 | ), 157 | ), 158 | ], 159 | ), 160 | ); 161 | } else { 162 | return Center( 163 | child: Column( 164 | children: [ 165 | const Padding( 166 | padding: EdgeInsets.all(20.0), 167 | child: Text( 168 | "Please check if you are connected to the internet and swipe or pull down to refresh \n \n Or", 169 | style: TextStyle(), 170 | softWrap: true, 171 | textAlign: TextAlign.center, 172 | ), 173 | ), 174 | RefreshButton( 175 | text: 'Refresh', 176 | onPressed: () { 177 | setState(() {}); 178 | }, 179 | ), 180 | ], 181 | ), 182 | ); 183 | } 184 | }, 185 | ), 186 | ), 187 | ), 188 | ); 189 | } 190 | } 191 | -------------------------------------------------------------------------------- /lib/app/screens/category_screens/network_cart.dart: -------------------------------------------------------------------------------- 1 | import 'package:cached_network_image/cached_network_image.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 4 | import 'package:intl/intl.dart'; 5 | import 'package:wp_blog_app/app/screens/post_view.dart'; 6 | import 'package:wp_blog_app/const_values.dart'; 7 | import 'package:wp_blog_app/widgets/refresh_button.dart'; 8 | import 'package:wp_blog_app/wp_api.dart'; 9 | 10 | class NetworkCartScreen extends StatefulWidget { 11 | const NetworkCartScreen({Key? key}) : super(key: key); 12 | 13 | @override 14 | _NetworkCartScreenState createState() => _NetworkCartScreenState(); 15 | } 16 | 17 | class _NetworkCartScreenState extends State { 18 | WpApi api = WpApi(); 19 | 20 | String formatDateTime(DateTime dateTime) { 21 | return "${dateTime.day}/${dateTime.month}/${dateTime.year}"; 22 | } 23 | 24 | displayTime(String date) { 25 | return DateFormat.yMMMMEEEEd().format(DateTime.parse(date)); 26 | } 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | return Scaffold( 31 | appBar: AppBar( 32 | title: const Text("NaijaTechGuy Blog"), 33 | ), 34 | body: SingleChildScrollView( 35 | child: Padding( 36 | padding: const EdgeInsets.symmetric(horizontal: 20.0), 37 | child: FutureBuilder( 38 | future: api.fetchOtherCategories(413), 39 | builder: (context, AsyncSnapshot snapshot) { 40 | if (snapshot.connectionState == ConnectionState.done && 41 | snapshot.hasData) { 42 | return ListView.builder( 43 | primary: false, 44 | physics: const NeverScrollableScrollPhysics(), 45 | shrinkWrap: true, 46 | itemCount: snapshot.data.length, 47 | itemBuilder: (_, index) { 48 | return InkWell( 49 | onTap: () { 50 | var post = snapshot.data[index]; 51 | Navigator.of(context).push( 52 | MaterialPageRoute(builder: (_) { 53 | return PostView( 54 | posts: post, 55 | ); 56 | }), 57 | ); 58 | }, 59 | child: Container( 60 | margin: const EdgeInsets.only(bottom: 20, top: 20), 61 | width: MediaQuery.of(context).size.width, 62 | child: Row( 63 | crossAxisAlignment: CrossAxisAlignment.start, 64 | children: [ 65 | Container( 66 | width: 100.w, 67 | height: 100.h, 68 | margin: const EdgeInsets.only(left: 20), 69 | decoration: BoxDecoration( 70 | borderRadius: const BorderRadius.all( 71 | Radius.circular(15.0), 72 | ), 73 | image: DecorationImage( 74 | image: NetworkImage( 75 | snapshot.data[index].image, 76 | ), 77 | fit: BoxFit.cover, 78 | ), 79 | ), 80 | child: CachedNetworkImage( 81 | imageUrl: snapshot.data[index].image, 82 | fit: BoxFit.cover, 83 | width: 100.w, 84 | height: 100.h, 85 | ), 86 | ), 87 | const SizedBox( 88 | width: 15, 89 | ), 90 | Expanded( 91 | child: Column( 92 | crossAxisAlignment: CrossAxisAlignment.start, 93 | mainAxisAlignment: MainAxisAlignment.start, 94 | children: [ 95 | Padding( 96 | padding: const EdgeInsets.all(8.0), 97 | child: Text( 98 | snapshot.data[index].title 99 | .substring(0, 20) + 100 | "...", 101 | style: TextStyle( 102 | fontWeight: FontWeight.bold, 103 | fontSize: 18.sp, 104 | ), 105 | softWrap: true, 106 | overflow: TextOverflow.fade, 107 | ), 108 | ), 109 | Padding( 110 | padding: const EdgeInsets.all(8.0), 111 | child: Text( 112 | "${displayTime(snapshot.data[index].time)}", 113 | ), 114 | ), 115 | ], 116 | ), 117 | ) 118 | ], 119 | ), 120 | ), 121 | ); 122 | }, 123 | ); 124 | } else if (snapshot.connectionState == ConnectionState.none) { 125 | return Center( 126 | child: Column( 127 | children: [ 128 | const Text( 129 | "Sorry please check you internet connection, and swipe on pull down to refresh \n \n Or", 130 | ), 131 | RefreshButton( 132 | text: 'Refresh', 133 | onPressed: () { 134 | setState(() {}); 135 | }, 136 | ), 137 | ], 138 | ), 139 | ); 140 | } else if (snapshot.connectionState == ConnectionState.waiting) { 141 | return Center( 142 | child: Column( 143 | mainAxisAlignment: MainAxisAlignment.center, 144 | children: [ 145 | const SizedBox(height: 10.0), 146 | Center( 147 | child: Image.asset( 148 | 'assets/images/newLoading.gif', 149 | width: 350, 150 | height: 200, 151 | ), 152 | ), 153 | ], 154 | ), 155 | ); 156 | } else { 157 | return Center( 158 | child: Column( 159 | children: [ 160 | const Padding( 161 | padding: EdgeInsets.all(20.0), 162 | child: Text( 163 | "Please check if you are connected to the internet and swipe or pull down to refresh \n \n Or", 164 | softWrap: true, 165 | textAlign: TextAlign.center, 166 | ), 167 | ), 168 | RefreshButton( 169 | text: 'Refresh', 170 | onPressed: () { 171 | setState(() {}); 172 | }, 173 | ), 174 | ], 175 | ), 176 | ); 177 | } 178 | }, 179 | ), 180 | ), 181 | ), 182 | ); 183 | } 184 | } 185 | -------------------------------------------------------------------------------- /lib/app/screens/category_screens/reviews_cart.dart: -------------------------------------------------------------------------------- 1 | import 'package:cached_network_image/cached_network_image.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 4 | import 'package:intl/intl.dart'; 5 | import 'package:wp_blog_app/app/screens/post_view.dart'; 6 | import 'package:wp_blog_app/const_values.dart'; 7 | import 'package:wp_blog_app/widgets/refresh_button.dart'; 8 | import 'package:wp_blog_app/wp_api.dart'; 9 | 10 | class ReviewsCartScreen extends StatefulWidget { 11 | const ReviewsCartScreen({Key? key}) : super(key: key); 12 | 13 | @override 14 | _ReviewsCartScreenState createState() => _ReviewsCartScreenState(); 15 | } 16 | 17 | class _ReviewsCartScreenState extends State { 18 | WpApi api = WpApi(); 19 | 20 | String formatDateTime(DateTime dateTime) { 21 | return "${dateTime.day}/${dateTime.month}/${dateTime.year}"; 22 | } 23 | 24 | displayTime(String date) { 25 | return DateFormat.yMMMMEEEEd().format(DateTime.parse(date)); 26 | } 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | return Scaffold( 31 | appBar: AppBar( 32 | title: const Text("NaijaTechGuy Blog"), 33 | ), 34 | body: SingleChildScrollView( 35 | child: Padding( 36 | padding: const EdgeInsets.symmetric(horizontal: 20.0), 37 | child: FutureBuilder( 38 | future: api.fetchOtherCategories(417), 39 | builder: (context, AsyncSnapshot snapshot) { 40 | if (snapshot.connectionState == ConnectionState.done && 41 | snapshot.hasData) { 42 | return ListView.builder( 43 | primary: false, 44 | physics: const NeverScrollableScrollPhysics(), 45 | shrinkWrap: true, 46 | itemCount: snapshot.data.length, 47 | itemBuilder: (_, index) { 48 | return InkWell( 49 | onTap: () { 50 | var post = snapshot.data[index]; 51 | Navigator.of(context).push( 52 | MaterialPageRoute(builder: (_) { 53 | return PostView( 54 | posts: post, 55 | ); 56 | }), 57 | ); 58 | }, 59 | child: Container( 60 | margin: const EdgeInsets.only(bottom: 20, top: 20), 61 | width: MediaQuery.of(context).size.width, 62 | child: Row( 63 | crossAxisAlignment: CrossAxisAlignment.start, 64 | children: [ 65 | Container( 66 | width: 100.w, 67 | height: 100.h, 68 | margin: const EdgeInsets.only(left: 20), 69 | decoration: BoxDecoration( 70 | borderRadius: const BorderRadius.all( 71 | Radius.circular(15.0), 72 | ), 73 | image: DecorationImage( 74 | image: NetworkImage( 75 | snapshot.data[index].image, 76 | ), 77 | fit: BoxFit.cover, 78 | ), 79 | ), 80 | child: CachedNetworkImage( 81 | imageUrl: snapshot.data[index].image, 82 | fit: BoxFit.cover, 83 | width: 100.w, 84 | height: 100.h, 85 | ), 86 | ), 87 | const SizedBox( 88 | width: 15, 89 | ), 90 | Expanded( 91 | child: Column( 92 | crossAxisAlignment: CrossAxisAlignment.start, 93 | mainAxisAlignment: MainAxisAlignment.start, 94 | children: [ 95 | Padding( 96 | padding: const EdgeInsets.all(8.0), 97 | child: Text( 98 | snapshot.data[index].title 99 | .toString() 100 | .length >= 101 | 20 102 | ? snapshot.data[index].title 103 | .substring(0, 20) + 104 | "..." 105 | : snapshot.data[index].title, 106 | style: TextStyle( 107 | fontWeight: FontWeight.bold, 108 | fontSize: 18.sp, 109 | ), 110 | softWrap: true, 111 | overflow: TextOverflow.fade, 112 | ), 113 | ), 114 | Padding( 115 | padding: const EdgeInsets.all(8.0), 116 | child: Text( 117 | "${displayTime(snapshot.data[index].time)}", 118 | ), 119 | ), 120 | ], 121 | ), 122 | ) 123 | ], 124 | ), 125 | ), 126 | ); 127 | }, 128 | ); 129 | } else if (snapshot.connectionState == ConnectionState.none) { 130 | return Center( 131 | child: Column( 132 | children: [ 133 | const Text( 134 | "Sorry please check you internet connection, and swipe on pull down to refresh \n \n Or", 135 | ), 136 | RefreshButton( 137 | text: 'Refresh', 138 | onPressed: () { 139 | setState(() {}); 140 | }, 141 | ), 142 | ], 143 | ), 144 | ); 145 | } else if (snapshot.connectionState == ConnectionState.waiting) { 146 | return Center( 147 | child: Column( 148 | mainAxisAlignment: MainAxisAlignment.center, 149 | children: [ 150 | const SizedBox(height: 10.0), 151 | Center( 152 | child: Image.asset( 153 | 'assets/images/newLoading.gif', 154 | width: 350, 155 | height: 200, 156 | ), 157 | ), 158 | ], 159 | ), 160 | ); 161 | } else { 162 | return Center( 163 | child: Column( 164 | children: [ 165 | const Padding( 166 | padding: EdgeInsets.all(20.0), 167 | child: Text( 168 | "Please check if you are connected to the internet and swipe or pull down to refresh \n \n Or", 169 | softWrap: true, 170 | textAlign: TextAlign.center, 171 | ), 172 | ), 173 | RefreshButton( 174 | text: 'Refresh', 175 | onPressed: () { 176 | setState(() {}); 177 | }, 178 | ), 179 | ], 180 | ), 181 | ); 182 | } 183 | }, 184 | ), 185 | ), 186 | ), 187 | ); 188 | } 189 | } 190 | -------------------------------------------------------------------------------- /lib/app/screens/category_screens/social_cart.dart: -------------------------------------------------------------------------------- 1 | import 'package:cached_network_image/cached_network_image.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 4 | import 'package:intl/intl.dart'; 5 | import 'package:wp_blog_app/app/screens/post_view.dart'; 6 | import 'package:wp_blog_app/const_values.dart'; 7 | import 'package:wp_blog_app/widgets/refresh_button.dart'; 8 | import 'package:wp_blog_app/wp_api.dart'; 9 | 10 | class SocialCartScreen extends StatefulWidget { 11 | const SocialCartScreen({Key? key}) : super(key: key); 12 | 13 | @override 14 | _SocialCartScreenState createState() => _SocialCartScreenState(); 15 | } 16 | 17 | class _SocialCartScreenState extends State { 18 | WpApi api = WpApi(); 19 | 20 | String formatDateTime(DateTime dateTime) { 21 | return "${dateTime.day}/${dateTime.month}/${dateTime.year}"; 22 | } 23 | 24 | displayTime(String date) { 25 | return DateFormat.yMMMMEEEEd().format(DateTime.parse(date)); 26 | } 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | return Scaffold( 31 | appBar: AppBar( 32 | title: const Text("NaijaTechGuy Blog"), 33 | ), 34 | body: SingleChildScrollView( 35 | child: Padding( 36 | padding: const EdgeInsets.symmetric(horizontal: 20.0), 37 | child: FutureBuilder( 38 | future: api.fetchOtherCategories(185), 39 | builder: (context, AsyncSnapshot snapshot) { 40 | if (snapshot.connectionState == ConnectionState.done && 41 | snapshot.hasData) { 42 | return ListView.builder( 43 | primary: false, 44 | physics: const NeverScrollableScrollPhysics(), 45 | shrinkWrap: true, 46 | itemCount: snapshot.data.length, 47 | itemBuilder: (_, index) { 48 | return InkWell( 49 | onTap: () { 50 | var post = snapshot.data[index]; 51 | Navigator.of(context).push( 52 | MaterialPageRoute(builder: (_) { 53 | return PostView( 54 | posts: post, 55 | ); 56 | }), 57 | ); 58 | }, 59 | child: Container( 60 | margin: const EdgeInsets.only(bottom: 20, top: 20), 61 | width: MediaQuery.of(context).size.width, 62 | child: Row( 63 | crossAxisAlignment: CrossAxisAlignment.start, 64 | children: [ 65 | Container( 66 | width: 100.w, 67 | height: 100.h, 68 | margin: const EdgeInsets.only(left: 20), 69 | decoration: BoxDecoration( 70 | borderRadius: const BorderRadius.all( 71 | Radius.circular(15.0), 72 | ), 73 | image: DecorationImage( 74 | image: NetworkImage( 75 | snapshot.data[index].image, 76 | ), 77 | fit: BoxFit.cover, 78 | ), 79 | ), 80 | child: CachedNetworkImage( 81 | imageUrl: snapshot.data[index].image, 82 | fit: BoxFit.cover, 83 | width: 100.w, 84 | height: 100.h, 85 | ), 86 | ), 87 | const SizedBox( 88 | width: 15, 89 | ), 90 | Expanded( 91 | child: Column( 92 | crossAxisAlignment: CrossAxisAlignment.start, 93 | mainAxisAlignment: MainAxisAlignment.start, 94 | children: [ 95 | Padding( 96 | padding: const EdgeInsets.all(8.0), 97 | child: Text( 98 | snapshot.data[index].title 99 | .toString() 100 | .length >= 101 | 20 102 | ? snapshot.data[index].title 103 | .substring(0, 20) + 104 | "..." 105 | : snapshot.data[index].title, 106 | style: TextStyle( 107 | fontWeight: FontWeight.bold, 108 | fontSize: 19.sp, 109 | ), 110 | softWrap: true, 111 | overflow: TextOverflow.fade, 112 | ), 113 | ), 114 | Padding( 115 | padding: const EdgeInsets.all(8.0), 116 | child: Text( 117 | "${displayTime(snapshot.data[index].time)}", 118 | ), 119 | ), 120 | ], 121 | ), 122 | ) 123 | ], 124 | ), 125 | ), 126 | ); 127 | }, 128 | ); 129 | } else if (snapshot.connectionState == ConnectionState.none) { 130 | return Center( 131 | child: Column( 132 | children: [ 133 | const Text( 134 | "Sorry please check you internet connection, and swipe on pull down to refresh \n \n Or", 135 | style: TextStyle(), 136 | ), 137 | RefreshButton( 138 | text: 'Refresh', 139 | onPressed: () { 140 | setState(() {}); 141 | }, 142 | ), 143 | ], 144 | ), 145 | ); 146 | } else if (snapshot.connectionState == ConnectionState.waiting) { 147 | return Center( 148 | child: Column( 149 | mainAxisAlignment: MainAxisAlignment.center, 150 | children: [ 151 | const SizedBox(height: 10.0), 152 | Center( 153 | child: Image.asset( 154 | 'assets/images/newLoading.gif', 155 | width: 350, 156 | height: 200, 157 | ), 158 | ), 159 | ], 160 | ), 161 | ); 162 | } else { 163 | return Center( 164 | child: Column( 165 | children: [ 166 | const Padding( 167 | padding: EdgeInsets.all(20.0), 168 | child: Text( 169 | "Please check if you are connected to the internet and swipe or pull down to refresh \n \n Or", 170 | style: TextStyle(), 171 | softWrap: true, 172 | textAlign: TextAlign.center, 173 | ), 174 | ), 175 | RefreshButton( 176 | text: 'Refresh', 177 | onPressed: () { 178 | setState(() {}); 179 | }, 180 | ), 181 | ], 182 | ), 183 | ); 184 | } 185 | }, 186 | ), 187 | ), 188 | ), 189 | ); 190 | } 191 | } 192 | -------------------------------------------------------------------------------- /lib/app/screens/category_screens/tech_cart.dart: -------------------------------------------------------------------------------- 1 | import 'package:cached_network_image/cached_network_image.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 4 | import 'package:intl/intl.dart'; 5 | import 'package:wp_blog_app/app/screens/post_view.dart'; 6 | import 'package:wp_blog_app/const_values.dart'; 7 | import 'package:wp_blog_app/widgets/refresh_button.dart'; 8 | import 'package:wp_blog_app/wp_api.dart'; 9 | 10 | class TechCartScreen extends StatefulWidget { 11 | const TechCartScreen({Key? key}) : super(key: key); 12 | 13 | @override 14 | _TechCartScreenState createState() => _TechCartScreenState(); 15 | } 16 | 17 | class _TechCartScreenState extends State { 18 | WpApi api = WpApi(); 19 | 20 | String formatDateTime(DateTime dateTime) { 21 | return "${dateTime.day}/${dateTime.month}/${dateTime.year}"; 22 | } 23 | 24 | displayTime(String date) { 25 | return DateFormat.yMMMMEEEEd().format(DateTime.parse(date)); 26 | } 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | return Scaffold( 31 | appBar: AppBar( 32 | title: const Text("NaijaTechGuy Blog"), 33 | ), 34 | body: SingleChildScrollView( 35 | child: Padding( 36 | padding: const EdgeInsets.symmetric(horizontal: 20.0), 37 | child: FutureBuilder( 38 | future: api.fetchOtherCategories(149), 39 | builder: (context, AsyncSnapshot snapshot) { 40 | if (snapshot.connectionState == ConnectionState.done && 41 | snapshot.hasData) { 42 | return ListView.builder( 43 | primary: false, 44 | physics: const NeverScrollableScrollPhysics(), 45 | shrinkWrap: true, 46 | itemCount: snapshot.data.length, 47 | itemBuilder: (_, index) { 48 | return InkWell( 49 | onTap: () { 50 | var post = snapshot.data[index]; 51 | Navigator.of(context).push( 52 | MaterialPageRoute(builder: (_) { 53 | return PostView( 54 | posts: post, 55 | ); 56 | }), 57 | ); 58 | }, 59 | child: Container( 60 | margin: const EdgeInsets.only(bottom: 20, top: 20), 61 | width: MediaQuery.of(context).size.width, 62 | child: Row( 63 | crossAxisAlignment: CrossAxisAlignment.start, 64 | children: [ 65 | Container( 66 | width: 100.w, 67 | height: 100.h, 68 | margin: const EdgeInsets.only(left: 20), 69 | decoration: BoxDecoration( 70 | borderRadius: const BorderRadius.all( 71 | Radius.circular(15.0), 72 | ), 73 | image: DecorationImage( 74 | image: NetworkImage( 75 | snapshot.data[index].image, 76 | ), 77 | fit: BoxFit.cover, 78 | ), 79 | ), 80 | child: CachedNetworkImage( 81 | imageUrl: snapshot.data[index].image, 82 | fit: BoxFit.cover, 83 | width: 100.w, 84 | height: 100.h, 85 | ), 86 | ), 87 | const SizedBox( 88 | width: 15, 89 | ), 90 | Expanded( 91 | child: Column( 92 | crossAxisAlignment: CrossAxisAlignment.start, 93 | mainAxisAlignment: MainAxisAlignment.start, 94 | children: [ 95 | Padding( 96 | padding: const EdgeInsets.all(8.0), 97 | child: Text( 98 | snapshot.data[index].title 99 | .toString() 100 | .length >= 101 | 20 102 | ? snapshot.data[index].title 103 | .substring(0, 20) + 104 | "..." 105 | : snapshot.data[index].title, 106 | style: TextStyle( 107 | fontWeight: FontWeight.bold, 108 | fontSize: 18.sp, 109 | ), 110 | softWrap: true, 111 | overflow: TextOverflow.fade, 112 | ), 113 | ), 114 | Padding( 115 | padding: const EdgeInsets.all(8.0), 116 | child: Text( 117 | "${displayTime(snapshot.data[index].time)}", 118 | ), 119 | ), 120 | ], 121 | ), 122 | ) 123 | ], 124 | ), 125 | ), 126 | ); 127 | }, 128 | ); 129 | } else if (snapshot.connectionState == ConnectionState.none) { 130 | return Center( 131 | child: Column( 132 | children: [ 133 | const Text( 134 | "Sorry please check you internet connection, and swipe on pull down to refresh \n \n Or", 135 | ), 136 | RefreshButton( 137 | text: 'Refresh', 138 | onPressed: () { 139 | setState(() {}); 140 | }, 141 | ), 142 | ], 143 | ), 144 | ); 145 | } else if (snapshot.connectionState == ConnectionState.waiting) { 146 | return Center( 147 | child: Column( 148 | mainAxisAlignment: MainAxisAlignment.center, 149 | children: [ 150 | const SizedBox(height: 10.0), 151 | Center( 152 | child: Image.asset( 153 | 'assets/images/newLoading.gif', 154 | width: 350, 155 | height: 200, 156 | ), 157 | ), 158 | ], 159 | ), 160 | ); 161 | } else { 162 | return Center( 163 | child: Column( 164 | children: [ 165 | const Padding( 166 | padding: EdgeInsets.all(20.0), 167 | child: Text( 168 | "Please check if you are connected to the internet and swipe or pull down to refresh \n \n Or", 169 | style: TextStyle(), 170 | softWrap: true, 171 | textAlign: TextAlign.center, 172 | ), 173 | ), 174 | RefreshButton( 175 | text: 'Refresh', 176 | onPressed: () { 177 | setState(() {}); 178 | }, 179 | ), 180 | ], 181 | ), 182 | ); 183 | } 184 | }, 185 | ), 186 | ), 187 | ), 188 | ); 189 | } 190 | } 191 | -------------------------------------------------------------------------------- /lib/app/screens/category_screens/tutorial_cart.dart: -------------------------------------------------------------------------------- 1 | import 'package:cached_network_image/cached_network_image.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 4 | import 'package:intl/intl.dart'; 5 | import 'package:wp_blog_app/app/screens/post_view.dart'; 6 | import 'package:wp_blog_app/const_values.dart'; 7 | import 'package:wp_blog_app/widgets/refresh_button.dart'; 8 | import 'package:wp_blog_app/wp_api.dart'; 9 | 10 | class TutorialCartScreen extends StatefulWidget { 11 | const TutorialCartScreen({Key? key}) : super(key: key); 12 | 13 | @override 14 | _TutorialCartScreenState createState() => _TutorialCartScreenState(); 15 | } 16 | 17 | class _TutorialCartScreenState extends State { 18 | WpApi api = WpApi(); 19 | 20 | String formatDateTime(DateTime dateTime) { 21 | return "${dateTime.day}/${dateTime.month}/${dateTime.year}"; 22 | } 23 | 24 | displayTime(String date) { 25 | return DateFormat.yMMMMEEEEd().format(DateTime.parse(date)); 26 | } 27 | 28 | @override 29 | Widget build(BuildContext context) { 30 | return Scaffold( 31 | appBar: AppBar( 32 | title: const Text("NaijaTechGuy Blog"), 33 | ), 34 | body: SingleChildScrollView( 35 | child: Padding( 36 | padding: const EdgeInsets.symmetric(horizontal: 20.0), 37 | child: FutureBuilder( 38 | future: api.fetchOtherCategories(371), 39 | builder: (context, AsyncSnapshot snapshot) { 40 | if (snapshot.connectionState == ConnectionState.done && 41 | snapshot.hasData) { 42 | return ListView.builder( 43 | primary: false, 44 | physics: const NeverScrollableScrollPhysics(), 45 | shrinkWrap: true, 46 | itemCount: snapshot.data.length, 47 | itemBuilder: (_, index) { 48 | return InkWell( 49 | onTap: () { 50 | var post = snapshot.data[index]; 51 | Navigator.of(context).push( 52 | MaterialPageRoute(builder: (_) { 53 | return PostView( 54 | posts: post, 55 | ); 56 | }), 57 | ); 58 | }, 59 | child: Container( 60 | margin: const EdgeInsets.only(bottom: 20, top: 20), 61 | width: MediaQuery.of(context).size.width, 62 | child: Row( 63 | crossAxisAlignment: CrossAxisAlignment.start, 64 | children: [ 65 | Container( 66 | width: 100.w, 67 | height: 100.h, 68 | margin: const EdgeInsets.only(left: 20), 69 | decoration: BoxDecoration( 70 | borderRadius: const BorderRadius.all( 71 | Radius.circular(15.0), 72 | ), 73 | image: DecorationImage( 74 | image: NetworkImage( 75 | snapshot.data[index].image, 76 | ), 77 | fit: BoxFit.cover, 78 | ), 79 | ), 80 | child: CachedNetworkImage( 81 | imageUrl: snapshot.data[index].image, 82 | fit: BoxFit.cover, 83 | width: 100.w, 84 | height: 100.h, 85 | ), 86 | ), 87 | const SizedBox( 88 | width: 15, 89 | ), 90 | Expanded( 91 | child: Column( 92 | crossAxisAlignment: CrossAxisAlignment.start, 93 | mainAxisAlignment: MainAxisAlignment.start, 94 | children: [ 95 | Padding( 96 | padding: const EdgeInsets.all(8.0), 97 | child: Text( 98 | snapshot.data[index].title 99 | .toString() 100 | .length >= 101 | 20 102 | ? snapshot.data[index].title 103 | .substring(0, 20) + 104 | "..." 105 | : snapshot.data[index].title, 106 | style: TextStyle( 107 | fontWeight: FontWeight.bold, 108 | fontSize: 18.sp, 109 | ), 110 | softWrap: true, 111 | overflow: TextOverflow.fade, 112 | ), 113 | ), 114 | Padding( 115 | padding: const EdgeInsets.all(8.0), 116 | child: Text( 117 | "${displayTime(snapshot.data[index].time)}", 118 | ), 119 | ), 120 | ], 121 | ), 122 | ) 123 | ], 124 | ), 125 | ), 126 | ); 127 | }, 128 | ); 129 | } else if (snapshot.connectionState == ConnectionState.none) { 130 | return Center( 131 | child: Column( 132 | children: [ 133 | const Text( 134 | "Sorry please check you intetnet connection, and swipe on pull down to refresh \n \n Or", 135 | ), 136 | RefreshButton( 137 | text: 'Refresh', 138 | onPressed: () { 139 | setState(() {}); 140 | }, 141 | ), 142 | ], 143 | ), 144 | ); 145 | } else if (snapshot.connectionState == ConnectionState.waiting) { 146 | return Center( 147 | child: Column( 148 | mainAxisAlignment: MainAxisAlignment.center, 149 | children: [ 150 | const SizedBox(height: 10.0), 151 | Center( 152 | child: Image.asset( 153 | 'assets/images/newLoading.gif', 154 | width: 350, 155 | height: 200, 156 | ), 157 | ), 158 | ], 159 | ), 160 | ); 161 | } else { 162 | return Center( 163 | child: Column( 164 | children: [ 165 | const Padding( 166 | padding: EdgeInsets.all(20.0), 167 | child: Text( 168 | "Please check if you are connected to the internet and swipe or pull down to refresh \n \n Or", 169 | style: TextStyle(), 170 | softWrap: true, 171 | textAlign: TextAlign.center, 172 | ), 173 | ), 174 | RefreshButton( 175 | text: 'Refresh', 176 | onPressed: () { 177 | setState(() {}); 178 | }, 179 | ), 180 | ], 181 | ), 182 | ); 183 | } 184 | }, 185 | ), 186 | ), 187 | ), 188 | ); 189 | } 190 | } 191 | -------------------------------------------------------------------------------- /lib/app/screens/home_screen.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:hive/hive.dart'; 3 | import 'package:intl/intl.dart'; 4 | import 'package:provider/provider.dart'; 5 | import 'package:pull_to_refresh/pull_to_refresh.dart'; 6 | import 'package:wp_blog_app/const_values.dart'; 7 | import 'package:wp_blog_app/providers/theme_provider.dart'; 8 | import 'package:wp_blog_app/widgets/horizonatl_view.dart'; 9 | import 'package:wp_blog_app/widgets/list_view_post.dart'; 10 | 11 | class HomeScreen extends StatefulWidget { 12 | const HomeScreen({Key? key}) : super(key: key); 13 | 14 | @override 15 | _HomeScreenState createState() => _HomeScreenState(); 16 | } 17 | 18 | class _HomeScreenState extends State { 19 | var dateFormat = DateFormat.yMMMMEEEEd().format(DateTime.now()); 20 | 21 | RefreshController refreshController = 22 | RefreshController(initialRefresh: false); 23 | 24 | Box? storeData; 25 | 26 | @override 27 | void initState() { 28 | super.initState(); 29 | const HorizontalView(); 30 | const ListViewPost(); 31 | storeData = Hive.box(appState); 32 | } 33 | 34 | void _onRefresh() async { 35 | // monitor network fetch 36 | await Future.delayed(const Duration(milliseconds: 1000)); 37 | if (mounted) { 38 | setState(() {}); 39 | } 40 | // if failed,use refreshFailed() 41 | refreshController.refreshCompleted(); 42 | } 43 | 44 | void _onLoading() async { 45 | // monitor network fetch 46 | await Future.delayed(const Duration(milliseconds: 1000)); 47 | // getSermons(); 48 | // if (mounted) { 49 | // setState(() {}); 50 | // } 51 | refreshController.loadComplete(); 52 | } 53 | 54 | @override 55 | Widget build(BuildContext context) { 56 | final isThemeChange = Provider.of(context); 57 | return SafeArea( 58 | top: true, 59 | child: Scaffold( 60 | // backgroundColor: changeData.isDark == false ? mainColor : darkColor, 61 | body: SmartRefresher( 62 | controller: refreshController, 63 | enablePullDown: true, 64 | onRefresh: _onRefresh, 65 | onLoading: _onLoading, 66 | child: SingleChildScrollView( 67 | child: Padding( 68 | padding: const EdgeInsets.symmetric(vertical: 0.0), 69 | child: Column( 70 | crossAxisAlignment: CrossAxisAlignment.start, 71 | children: [ 72 | Container( 73 | height: setContainerHeight(290), 74 | decoration: BoxDecoration( 75 | color: isThemeChange.mTheme == false 76 | ? Colors.white 77 | : Colors.grey[900], 78 | borderRadius: const BorderRadius.only( 79 | bottomLeft: Radius.circular(33), 80 | bottomRight: Radius.circular(33), 81 | ), 82 | ), 83 | child: Container( 84 | height: setContainerHeight(290), 85 | child: Column( 86 | children: [ 87 | Container( 88 | height: setContainerHeight(50), 89 | child: Padding( 90 | padding: const EdgeInsets.symmetric( 91 | horizontal: 20.0, vertical: 10.0), 92 | child: Row( 93 | mainAxisAlignment: 94 | MainAxisAlignment.spaceBetween, 95 | children: [ 96 | Text( 97 | "Latest", 98 | style: TextStyle( 99 | fontWeight: FontWeight.bold, 100 | fontSize: setTextSize(25), 101 | ), 102 | ), 103 | Text( 104 | "$dateFormat", 105 | style: TextStyle( 106 | fontWeight: FontWeight.bold, 107 | color: Colors.grey, 108 | fontSize: setTextSize(10), 109 | ), 110 | ), 111 | ], 112 | ), 113 | ), 114 | ), 115 | HorizontalView(), 116 | ], 117 | ), 118 | ), 119 | ), 120 | Container( 121 | padding: 122 | const EdgeInsets.only(left: 30, bottom: 10, top: 15), 123 | child: Column( 124 | children: [ 125 | Text( 126 | "Smart Phones", 127 | style: TextStyle( 128 | fontWeight: FontWeight.bold, 129 | fontSize: setTextSize(20), 130 | ), 131 | textAlign: TextAlign.left, 132 | ), 133 | ], 134 | ), 135 | ), 136 | ListViewPost(), 137 | ], 138 | ), 139 | ), 140 | ), 141 | ), 142 | ), 143 | ); 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /lib/app/screens/post_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 3 | import 'package:fluttertoast/fluttertoast.dart'; 4 | import 'package:hive/hive.dart'; 5 | import 'package:intl/intl.dart'; 6 | import 'package:wp_blog_app/const_values.dart'; 7 | import 'package:wp_blog_app/models/posts.dart'; 8 | 9 | class PostView extends StatefulWidget { 10 | final Posts? posts; 11 | 12 | const PostView({Key? key, @required this.posts}) : super(key: key); 13 | 14 | @override 15 | _PostViewState createState() => _PostViewState(); 16 | } 17 | 18 | class _PostViewState extends State { 19 | displayTime(String date) { 20 | return DateFormat.yMMMMEEEEd().format(DateTime.parse(date)); 21 | } 22 | 23 | Box? storeData; 24 | 25 | @override 26 | void initState() { 27 | super.initState(); 28 | storeData = Hive.box(appState); 29 | } 30 | 31 | @override 32 | Widget build(BuildContext context) { 33 | return Scaffold( 34 | body: SingleChildScrollView( 35 | child: Column( 36 | children: [ 37 | Stack( 38 | children: [ 39 | Container( 40 | height: 300.h, 41 | decoration: BoxDecoration( 42 | borderRadius: const BorderRadius.only( 43 | bottomLeft: Radius.circular(33), 44 | bottomRight: Radius.circular(33), 45 | ), 46 | image: DecorationImage( 47 | image: NetworkImage('${widget.posts!.image}'), 48 | fit: BoxFit.cover), 49 | ), 50 | ), 51 | ], 52 | ), 53 | Padding( 54 | padding: const EdgeInsets.all(25.0), 55 | child: Column( 56 | crossAxisAlignment: CrossAxisAlignment.start, 57 | children: [ 58 | Text( 59 | '${widget.posts!.title}', 60 | style: TextStyle( 61 | fontSize: 23.sp, 62 | fontWeight: FontWeight.bold, 63 | ), 64 | ), 65 | const SizedBox( 66 | height: 10, 67 | ), 68 | Row( 69 | children: [ 70 | Text( 71 | '${displayTime(widget.posts!.time.toString())}', 72 | style: const TextStyle( 73 | color: Colors.grey, 74 | fontWeight: FontWeight.bold, 75 | ), 76 | ), 77 | const SizedBox( 78 | width: 10, 79 | ), 80 | InkWell( 81 | onTap: () async { 82 | Posts post = Posts( 83 | title: widget.posts!.title, 84 | image: widget.posts!.image, 85 | contents: widget.posts!.contents, 86 | time: widget.posts!.time, 87 | authur: widget.posts!.authur, 88 | ); 89 | await storeData!.add(post); 90 | Fluttertoast.showToast( 91 | msg: 'Bookmarked!!!', 92 | gravity: ToastGravity.BOTTOM, 93 | toastLength: Toast.LENGTH_SHORT, 94 | ); 95 | }, 96 | child: const Icon( 97 | Icons.bookmark_border, 98 | ), 99 | ), 100 | ], 101 | ), 102 | const SizedBox( 103 | height: 30, 104 | ), 105 | Text( 106 | '${widget.posts!.contents}', 107 | style: TextStyle( 108 | fontSize: 18.sp, 109 | ), 110 | ), 111 | ], 112 | ), 113 | ), 114 | ], 115 | ), 116 | ), 117 | ); 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /lib/app/screens/settings.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 3 | import 'package:launch_review/launch_review.dart'; 4 | import 'package:provider/provider.dart'; 5 | import 'package:share/share.dart'; 6 | import 'package:wp_blog_app/const_values.dart'; 7 | import 'package:wp_blog_app/providers/theme_provider.dart'; 8 | 9 | class Settings extends StatefulWidget { 10 | const Settings({Key? key}) : super(key: key); 11 | 12 | @override 13 | _SettingsState createState() => _SettingsState(); 14 | } 15 | 16 | class _SettingsState extends State { 17 | String devInfo = "Hi, I'm Godsend Joseph by name, I am a Flutter " 18 | "Developer, you can click on contact us to get my contacts"; 19 | 20 | String aboutBlog = "NaijaTechGuy is a Nigerian Technology Website " 21 | "Focused on Publishing the latest news on technology, smartphones," 22 | " gadgets and more related content"; 23 | @override 24 | Widget build(BuildContext context) { 25 | final isThemeChange = Provider.of(context); 26 | return Scaffold( 27 | body: SingleChildScrollView( 28 | child: Padding( 29 | padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5), 30 | child: Column( 31 | mainAxisAlignment: MainAxisAlignment.center, 32 | children: [ 33 | Center( 34 | child: Column( 35 | children: [ 36 | Container( 37 | height: 100.h, 38 | width: 300.w, 39 | decoration: BoxDecoration( 40 | image: DecorationImage( 41 | image: isThemeChange.mTheme == false 42 | ? const AssetImage('assets/logo/naijatechguyD.png') 43 | : const AssetImage('assets/logo/naijatechguy.png'), 44 | ), 45 | ), 46 | ), 47 | Text( 48 | aboutBlog, 49 | style: TextStyle( 50 | fontSize: 15.sp, 51 | ), 52 | textAlign: TextAlign.center, 53 | ) 54 | ], 55 | ), 56 | ), 57 | const SizedBox( 58 | height: 50, 59 | ), 60 | ListTile( 61 | title: Text( 62 | "Notifications", 63 | style: TextStyle( 64 | fontSize: 18.sp, 65 | ), 66 | ), 67 | subtitle: Text( 68 | "Subscribe to notifications (Not Available Yet!)", 69 | style: TextStyle( 70 | fontSize: 13.sp, 71 | ), 72 | ), 73 | trailing: const Switch(value: true, onChanged: null), 74 | ), 75 | const Divider(), 76 | ListTile( 77 | title: Text( 78 | "About Us", 79 | style: TextStyle( 80 | fontSize: 18.sp, 81 | ), 82 | ), 83 | subtitle: Text( 84 | "About the developer", 85 | style: TextStyle( 86 | fontSize: 13.sp, 87 | ), 88 | ), 89 | trailing: const Icon( 90 | Icons.info, 91 | color: subColor, 92 | ), 93 | onTap: () { 94 | showDialog( 95 | context: context, 96 | builder: (_) { 97 | return AlertDialog( 98 | title: const Text( 99 | "About the Developer", 100 | ), 101 | content: Text( 102 | devInfo, 103 | style: TextStyle( 104 | fontSize: 15.sp, 105 | ), 106 | ), 107 | ); 108 | }, 109 | ); 110 | }, 111 | ), 112 | const Divider(), 113 | ListTile( 114 | title: Text( 115 | "Contact Us", 116 | style: TextStyle( 117 | fontSize: 18.sp, 118 | ), 119 | ), 120 | subtitle: Text( 121 | "Contact the developer", 122 | style: TextStyle( 123 | fontSize: 13.sp, 124 | ), 125 | ), 126 | trailing: const Icon( 127 | Icons.phone, 128 | color: subColor, 129 | ), 130 | onTap: () { 131 | showDialog( 132 | context: context, 133 | builder: (_) { 134 | return AlertDialog( 135 | title: const Text( 136 | "Developer Contact", 137 | ), 138 | content: Column( 139 | mainAxisSize: MainAxisSize.min, 140 | children: [ 141 | ListTile( 142 | leading: const Icon( 143 | Icons.email, 144 | ), 145 | title: Text( 146 | "godsendjoseph@gmail.com", 147 | style: TextStyle( 148 | fontSize: 15.sp, 149 | ), 150 | ), 151 | ), 152 | ListTile( 153 | leading: const Icon( 154 | Icons.phone, 155 | ), 156 | title: Text( 157 | "+234 8140864923", 158 | style: TextStyle( 159 | fontSize: 15.sp, 160 | ), 161 | ), 162 | ), 163 | ], 164 | ), 165 | ); 166 | }, 167 | ); 168 | }, 169 | ), 170 | const Divider(), 171 | ListTile( 172 | title: Text( 173 | "Share", 174 | style: TextStyle( 175 | fontSize: 18.sp, 176 | ), 177 | ), 178 | subtitle: Text( 179 | "Share the app with friends", 180 | style: TextStyle( 181 | fontSize: 13.sp, 182 | ), 183 | ), 184 | trailing: const Icon( 185 | Icons.share, 186 | color: subColor, 187 | ), 188 | onTap: () { 189 | Share.share('check out my blog app for Naija Tech Guy', 190 | subject: 'Look what I made!'); 191 | }, 192 | ), 193 | const Divider(), 194 | ListTile( 195 | title: Text( 196 | "Rate Us", 197 | style: TextStyle( 198 | fontSize: 18.sp, 199 | ), 200 | ), 201 | subtitle: Text( 202 | "Rate the app on play store", 203 | style: TextStyle( 204 | fontSize: 13.sp, 205 | ), 206 | ), 207 | trailing: const Icon( 208 | Icons.star, 209 | color: subColor, 210 | ), 211 | onTap: () { 212 | LaunchReview.launch( 213 | androidAppId: "com.viewus.wp_blog", 214 | ); 215 | }, 216 | ), 217 | ], 218 | ), 219 | ), 220 | ), 221 | ); 222 | } 223 | } 224 | -------------------------------------------------------------------------------- /lib/app/screens/tab_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:bottom_navy_bar/bottom_navy_bar.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:hive/hive.dart'; 4 | import 'package:provider/provider.dart'; 5 | import 'package:wp_blog_app/app/screens/bookmark.dart'; 6 | import 'package:wp_blog_app/app/screens/category.dart'; 7 | import 'package:wp_blog_app/app/screens/home_screen.dart'; 8 | import 'package:wp_blog_app/app/screens/settings.dart'; 9 | import 'package:wp_blog_app/const_values.dart'; 10 | import 'package:wp_blog_app/providers/theme_provider.dart'; 11 | 12 | class TabView extends StatefulWidget { 13 | const TabView({Key? key}) : super(key: key); 14 | 15 | @override 16 | _TabViewState createState() => _TabViewState(); 17 | } 18 | 19 | class _TabViewState extends State { 20 | final List> _pages = [ 21 | { 22 | 'page': const HomeScreen(), 23 | }, 24 | { 25 | 'page': const Bookmark(), 26 | }, 27 | { 28 | 'page': const Category(), 29 | }, 30 | { 31 | 'page': const Settings(), 32 | }, 33 | ]; 34 | 35 | int _selectedPageIndex = 0; 36 | 37 | void _selectPage(int index) { 38 | setState(() { 39 | _selectedPageIndex = index; 40 | }); 41 | } 42 | 43 | Box? storeData; 44 | 45 | @override 46 | void initState() { 47 | super.initState(); 48 | storeData = Hive.box(appState); 49 | } 50 | 51 | @override 52 | Widget build(BuildContext context) { 53 | final isThemeChange = Provider.of(context); 54 | return Scaffold( 55 | appBar: AppBar( 56 | title: const Text( 57 | "NaijaTechGuy Blog", 58 | ), 59 | actions: [ 60 | IconButton( 61 | icon: Icon( 62 | isThemeChange.mTheme ? Icons.brightness_6 : Icons.brightness_3), 63 | onPressed: () { 64 | isThemeChange.checkTheme(); 65 | }, 66 | ) 67 | ], 68 | ), 69 | body: _pages[_selectedPageIndex]['page'], 70 | bottomNavigationBar: BottomNavyBar( 71 | backgroundColor: 72 | isThemeChange.mTheme == false ? defaultWhite : Colors.grey[850], 73 | selectedIndex: _selectedPageIndex, 74 | onItemSelected: _selectPage, 75 | items: [ 76 | BottomNavyBarItem( 77 | icon: const Icon(Icons.home), 78 | title: const Text('Home'), 79 | activeColor: 80 | isThemeChange.mTheme == false ? subColor : defaultWhite, 81 | inactiveColor: 82 | isThemeChange.mTheme == false ? defaultBlack : defaultWhite, 83 | ), 84 | BottomNavyBarItem( 85 | icon: const Icon(Icons.bookmark), 86 | title: const Text('Bookmarked'), 87 | activeColor: 88 | isThemeChange.mTheme == false ? subColor : defaultWhite, 89 | inactiveColor: 90 | isThemeChange.mTheme == false ? defaultBlack : defaultWhite, 91 | ), 92 | BottomNavyBarItem( 93 | icon: const Icon(Icons.list), 94 | title: const Text('Category'), 95 | activeColor: 96 | isThemeChange.mTheme == false ? subColor : defaultWhite, 97 | inactiveColor: 98 | isThemeChange.mTheme == false ? defaultBlack : defaultWhite, 99 | ), 100 | BottomNavyBarItem( 101 | icon: const Icon(Icons.info), 102 | title: const Text('About'), 103 | activeColor: 104 | isThemeChange.mTheme == false ? subColor : defaultWhite, 105 | inactiveColor: 106 | isThemeChange.mTheme == false ? defaultBlack : defaultWhite, 107 | ) 108 | ], 109 | ), 110 | ); 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /lib/app/src/app.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 3 | import 'package:provider/provider.dart'; 4 | import 'package:wp_blog_app/app/src/splash.dart'; 5 | import 'package:wp_blog_app/custom_theme.dart'; 6 | import 'package:wp_blog_app/providers/theme_provider.dart'; 7 | 8 | class App extends StatefulWidget { 9 | const App({Key? key}) : super(key: key); 10 | 11 | @override 12 | _AppState createState() => _AppState(); 13 | } 14 | 15 | class _AppState extends State { 16 | @override 17 | Widget build(BuildContext context) { 18 | final isThemeChange = Provider.of(context); 19 | return ScreenUtilInit( 20 | builder: (BuildContext context, child) { 21 | return MaterialApp( 22 | debugShowCheckedModeBanner: false, 23 | title: 'NaijaTechGuy Blog', 24 | theme: isThemeChange.mTheme == false 25 | ? buildLightTheme() 26 | : buildDarkTheme(), 27 | home: const SplashScreen(), 28 | ); 29 | }, 30 | ); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/app/src/splash.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 5 | import 'package:hive/hive.dart'; 6 | import 'package:wp_blog_app/app/screens/tab_view.dart'; 7 | import 'package:wp_blog_app/const_values.dart'; 8 | 9 | class SplashScreen extends StatefulWidget { 10 | const SplashScreen({Key? key}) : super(key: key); 11 | 12 | @override 13 | _SplashScreenState createState() => _SplashScreenState(); 14 | } 15 | 16 | class _SplashScreenState extends State { 17 | Box? storeData; 18 | @override 19 | void initState() { 20 | super.initState(); 21 | storeData = Hive.box(appState); 22 | Timer(const Duration(seconds: 4), () { 23 | Navigator.of(context).pushReplacement(MaterialPageRoute(builder: (_) { 24 | return const TabView(); 25 | })); 26 | }); 27 | } 28 | 29 | @override 30 | Widget build(BuildContext context) { 31 | return Scaffold( 32 | body: SizedBox( 33 | height: MediaQuery.of(context).size.height, 34 | child: Center( 35 | child: Column( 36 | crossAxisAlignment: CrossAxisAlignment.center, 37 | mainAxisAlignment: MainAxisAlignment.center, 38 | children: [ 39 | Expanded( 40 | child: Image.asset( 41 | 'assets/logo/naijaguy.png', 42 | height: 150.h, 43 | width: 150.w, 44 | ), 45 | ), 46 | const Padding( 47 | padding: EdgeInsets.all(10), 48 | child: Text( 49 | "View Us", 50 | ), 51 | ) 52 | ], 53 | ), 54 | ), 55 | ), 56 | ); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /lib/const_values.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:wp_blog_app/size_config.dart'; 3 | 4 | //primary colors 5 | const mainColor = Color.fromRGBO(97, 44, 88, 1); 6 | const subColor = Color.fromRGBO(255, 133, 0, 1); 7 | // 8 | 9 | // dark and light theme color 10 | Color? darkColor = Colors.grey[900]; 11 | const darkColorTwo = Color.fromRGBO(32, 32, 96, 1); 12 | 13 | Color? cardColor = Colors.grey[850]; 14 | // 15 | 16 | double? hMultiplier = SizeConfig.heightMultiplier; 17 | double? wMultiplier = SizeConfig.widthMultiplier; 18 | 19 | setTextSize(double? size) { 20 | double? textMultiplier = SizeConfig.textMultiplier; 21 | double? textHeight = size! / hMultiplier!; 22 | double? textProperSize = textHeight * textMultiplier!; 23 | return textProperSize; 24 | } 25 | 26 | setContainerHeight(double? size) { 27 | double? containerMultiplier = SizeConfig.heightMultiplier; 28 | double? myHeight = size! / hMultiplier!; 29 | double? properHeight = myHeight * containerMultiplier!; 30 | return properHeight; 31 | } 32 | 33 | setContainerWidth(double? size) { 34 | double? containerMultiplier = SizeConfig.widthMultiplier; 35 | double? myWidth = size! / wMultiplier!; 36 | double? properWidth = myWidth * containerMultiplier!; 37 | return properWidth; 38 | } 39 | 40 | //other colors 41 | const defaultWhite = Color.fromRGBO(255, 255, 255, 1); 42 | const defaultBlack = Color.fromRGBO(0, 0, 0, 1); 43 | 44 | // hive box name 45 | const String appState = "appstate"; 46 | const String themeKey = 'state'; 47 | -------------------------------------------------------------------------------- /lib/custom_theme.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:wp_blog_app/const_values.dart'; 3 | 4 | ThemeData buildLightTheme() => ThemeData.light().copyWith( 5 | cardColor: Colors.white, 6 | backgroundColor: Colors.grey[100], 7 | accentColor: Colors.grey[800], 8 | scaffoldBackgroundColor: Colors.white, 9 | iconTheme: IconThemeData( 10 | color: defaultBlack, 11 | ), 12 | cardTheme: CardTheme( 13 | color: Colors.white, 14 | ), 15 | dialogTheme: DialogTheme( 16 | backgroundColor: defaultWhite, 17 | ), 18 | dividerColor: defaultWhite, 19 | appBarTheme: AppBarTheme( 20 | centerTitle: true, 21 | brightness: Brightness.dark, 22 | elevation: 0.0, 23 | color: defaultWhite, 24 | textTheme: TextTheme( 25 | headline6: TextStyle( 26 | fontSize: 20, 27 | fontWeight: FontWeight.bold, 28 | color: Colors.black, 29 | ), 30 | ), 31 | iconTheme: IconThemeData( 32 | color: Colors.grey[900], 33 | ), 34 | ), 35 | textTheme: Typography.blackCupertino, 36 | ); 37 | 38 | ThemeData buildDarkTheme() => ThemeData.dark().copyWith( 39 | cardColor: Colors.grey[850], 40 | backgroundColor: Colors.grey[900], 41 | accentColor: Colors.grey[400], 42 | scaffoldBackgroundColor: darkColor, 43 | dividerColor: defaultBlack, 44 | iconTheme: IconThemeData( 45 | color: defaultWhite, 46 | ), 47 | cardTheme: CardTheme( 48 | color: cardColor, 49 | ), 50 | dialogTheme: DialogTheme( 51 | backgroundColor: defaultBlack, 52 | ), 53 | appBarTheme: AppBarTheme( 54 | centerTitle: true, 55 | brightness: Brightness.dark, 56 | elevation: 0.0, 57 | textTheme: TextTheme( 58 | headline6: TextStyle( 59 | fontSize: 20, 60 | fontWeight: FontWeight.bold, 61 | color: Colors.white, 62 | ), 63 | ), 64 | color: Colors.grey[900], 65 | iconTheme: IconThemeData( 66 | color: Colors.grey[400], 67 | ), 68 | ), 69 | textTheme: Typography.whiteCupertino, 70 | ); 71 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter/services.dart'; 5 | import 'package:hive/hive.dart'; 6 | import 'package:path_provider/path_provider.dart'; 7 | import 'package:provider/provider.dart'; 8 | import 'package:wp_blog_app/app/src/app.dart'; 9 | import 'package:wp_blog_app/const_values.dart'; 10 | import 'package:wp_blog_app/models/posts.dart'; 11 | import 'package:wp_blog_app/providers/theme_provider.dart'; 12 | 13 | Future main() async { 14 | WidgetsFlutterBinding.ensureInitialized(); 15 | Directory document = await getApplicationDocumentsDirectory(); 16 | Hive 17 | ..init(document.path) 18 | ..registerAdapter(PostsAdapter()); 19 | await Hive.openBox(appState); 20 | 21 | SystemChrome.setPreferredOrientations([ 22 | DeviceOrientation.portraitUp, 23 | DeviceOrientation.portraitDown, 24 | ]); 25 | runApp( 26 | MultiProvider( 27 | providers: [ 28 | ChangeNotifierProvider.value( 29 | value: ThemeProvider(), 30 | ), 31 | ], 32 | child: const App(), 33 | ), 34 | ); 35 | } 36 | -------------------------------------------------------------------------------- /lib/models/posts.dart: -------------------------------------------------------------------------------- 1 | import 'package:hive/hive.dart'; 2 | 3 | part 'posts.g.dart'; 4 | 5 | @HiveType(typeId: 0) 6 | class Posts { 7 | @HiveField(0) 8 | bool? isDark = false; 9 | 10 | @HiveField(1) 11 | final String? title; 12 | 13 | @HiveField(2) 14 | final String? image; 15 | 16 | @HiveField(3) 17 | final String? contents; 18 | 19 | @HiveField(4) 20 | final String? time; 21 | 22 | @HiveField(5) 23 | final String? authur; 24 | 25 | Posts({ 26 | this.title, 27 | this.image, 28 | this.contents, 29 | this.time, 30 | this.authur, 31 | }); 32 | 33 | void changeTheme() { 34 | isDark = !isDark!; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/models/posts.g.dart: -------------------------------------------------------------------------------- 1 | // GENERATED CODE - DO NOT MODIFY BY HAND 2 | 3 | part of 'posts.dart'; 4 | 5 | // ************************************************************************** 6 | // TypeAdapterGenerator 7 | // ************************************************************************** 8 | 9 | class PostsAdapter extends TypeAdapter { 10 | @override 11 | final typeId = 0; 12 | 13 | @override 14 | Posts read(BinaryReader reader) { 15 | var numOfFields = reader.readByte(); 16 | var fields = { 17 | for (var i = 0; i < numOfFields; i++) reader.readByte(): reader.read(), 18 | }; 19 | return Posts( 20 | title: fields[1] as String, 21 | image: fields[2] as String, 22 | contents: fields[3] as String, 23 | time: fields[4] as String, 24 | authur: fields[5] as String, 25 | )..isDark = fields[0] as bool; 26 | } 27 | 28 | @override 29 | void write(BinaryWriter writer, Posts obj) { 30 | writer 31 | ..writeByte(6) 32 | ..writeByte(0) 33 | ..write(obj.isDark) 34 | ..writeByte(1) 35 | ..write(obj.title) 36 | ..writeByte(2) 37 | ..write(obj.image) 38 | ..writeByte(3) 39 | ..write(obj.contents) 40 | ..writeByte(4) 41 | ..write(obj.time) 42 | ..writeByte(5) 43 | ..write(obj.authur); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /lib/providers/theme_provider.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:shared_preferences/shared_preferences.dart'; 3 | 4 | class ThemeProvider with ChangeNotifier { 5 | final String? key = "appTheme"; 6 | SharedPreferences? _pref; 7 | bool? _mTheme; 8 | 9 | bool get mTheme => _mTheme!; 10 | 11 | ThemeProvider() { 12 | _mTheme = false; 13 | _loadFromPref(); 14 | } 15 | 16 | _initPrefs() async { 17 | if (_pref == null) _pref = await SharedPreferences.getInstance(); 18 | } 19 | 20 | _loadFromPref() async { 21 | await _initPrefs(); 22 | _mTheme = _pref!.getBool(key!) ?? false; 23 | notifyListeners(); 24 | } 25 | 26 | _saveToPref() async { 27 | await _initPrefs(); 28 | _pref!.setBool(key!, _mTheme!); 29 | } 30 | 31 | void checkTheme() { 32 | _mTheme = !_mTheme!; 33 | _saveToPref(); 34 | notifyListeners(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /lib/size_config.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/rendering.dart'; 2 | import 'package:flutter/widgets.dart'; 3 | 4 | class SizeConfig { 5 | static double? _screenWidth; 6 | static double? _screenHeight; 7 | static double? _blockWidth = 0; 8 | static double? _blockHeight = 0; 9 | 10 | static double? textMultiplier; 11 | static double? imageSizeMultiplier; 12 | static double? heightMultiplier; 13 | static double? widthMultiplier; 14 | static bool isPortrait = true; 15 | static bool isMobilePortrait = false; 16 | 17 | void init(BoxConstraints constraints, Orientation orientation) { 18 | if (orientation == Orientation.portrait) { 19 | _screenWidth = constraints.maxWidth; 20 | _screenHeight = constraints.maxHeight; 21 | isPortrait = true; 22 | if (_screenWidth! < 450) { 23 | isMobilePortrait = true; 24 | } 25 | } else { 26 | _screenWidth = constraints.maxHeight; 27 | _screenHeight = constraints.maxWidth; 28 | isPortrait = false; 29 | isMobilePortrait = false; 30 | } 31 | 32 | _blockWidth = _screenWidth! / 100; 33 | _blockHeight = _screenHeight! / 100; 34 | 35 | textMultiplier = _blockHeight; 36 | imageSizeMultiplier = _blockWidth; 37 | 38 | heightMultiplier = _blockHeight; 39 | widthMultiplier = _blockWidth; 40 | 41 | print(_blockWidth); 42 | print(_blockHeight); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /lib/widgets/example.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:wp_blog_app/wp_api.dart'; 3 | 4 | class Example extends StatefulWidget { 5 | @override 6 | _ExampleState createState() => _ExampleState(); 7 | } 8 | 9 | class _ExampleState extends State { 10 | WpApi api = WpApi(); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return Scaffold( 15 | appBar: AppBar( 16 | title: Text("Example"), 17 | ), 18 | body: Column(children: [ 19 | TextField( 20 | style: TextStyle(), 21 | textAlign: TextAlign.center, 22 | ) 23 | ])); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /lib/widgets/horizonatl_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:auto_size_text_pk/auto_size_text_pk.dart'; 2 | import 'package:cached_network_image/cached_network_image.dart'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 5 | import 'package:wp_blog_app/app/screens/post_view.dart'; 6 | import 'package:wp_blog_app/models/posts.dart'; 7 | import 'package:wp_blog_app/widgets/refresh_button.dart'; 8 | 9 | import '../wp_api.dart'; 10 | import '../const_values.dart'; 11 | 12 | class HorizontalView extends StatefulWidget { 13 | const HorizontalView({Key? key}) : super(key: key); 14 | 15 | @override 16 | _HorizontalViewState createState() => _HorizontalViewState(); 17 | } 18 | 19 | class _HorizontalViewState extends State { 20 | WpApi api = WpApi(); 21 | 22 | @override 23 | Widget build(BuildContext context) { 24 | return FutureBuilder( 25 | future: api.fetchTopPosts(), 26 | builder: (_, AsyncSnapshot snapshot) { 27 | if (snapshot.connectionState == ConnectionState.done && 28 | snapshot.hasData) { 29 | return SizedBox( 30 | height: 220.h, 31 | child: ListView.builder( 32 | scrollDirection: Axis.horizontal, 33 | itemCount: snapshot.data.length, 34 | itemBuilder: (_, index) { 35 | Posts post = snapshot.data[index]; 36 | return InkWell( 37 | onTap: () { 38 | Navigator.of(context).push( 39 | MaterialPageRoute(builder: (_) { 40 | return PostView( 41 | posts: post, 42 | ); 43 | }), 44 | ); 45 | }, 46 | child: Column( 47 | children: [ 48 | post.image != null 49 | ? Container( 50 | width: 250.w, 51 | height: 150.h, 52 | margin: const EdgeInsets.only(left: 20), 53 | decoration: const BoxDecoration( 54 | borderRadius: BorderRadius.all( 55 | Radius.circular(15.0), 56 | ), 57 | ), 58 | child: CachedNetworkImage( 59 | imageUrl: '${post.image}', 60 | fit: BoxFit.cover, 61 | width: 250.w, 62 | height: 150.h, 63 | placeholder: (_, url) { 64 | return Image.asset( 65 | 'assets/images/newLoading.gif', 66 | width: 50, 67 | height: 50, 68 | ); 69 | }, 70 | ), 71 | ) 72 | : Container( 73 | width: 250.w, 74 | height: 150.h, 75 | margin: const EdgeInsets.only(left: 20), 76 | decoration: const BoxDecoration( 77 | borderRadius: BorderRadius.all( 78 | Radius.circular(15.0), 79 | ), 80 | image: DecorationImage( 81 | image: AssetImage( 82 | "assets/img_error.jpg", 83 | ), 84 | fit: BoxFit.cover, 85 | ), 86 | ), 87 | ), 88 | Expanded( 89 | child: Container( 90 | width: 250.w, 91 | padding: const EdgeInsets.only(left: 5.0), 92 | child: Padding( 93 | padding: const EdgeInsets.all(8.0), 94 | child: AutoSizeText( 95 | '${post.title}', 96 | style: TextStyle( 97 | fontWeight: FontWeight.bold, 98 | fontSize: 18.sp, 99 | ), 100 | maxLines: 2, 101 | minFontSize: 15, 102 | overflow: TextOverflow.fade, 103 | softWrap: true, 104 | ), 105 | ), 106 | ), 107 | ), 108 | ], 109 | ), 110 | ); 111 | }, 112 | ), 113 | ); 114 | } else if (snapshot.connectionState == ConnectionState.none) { 115 | return Center( 116 | child: Column( 117 | children: [ 118 | const Text( 119 | "Sorry please check you intetnet connection, and swipe on pull down to refresh \n \n Or", 120 | style: TextStyle(), 121 | ), 122 | const SizedBox( 123 | height: 20.0, 124 | ), 125 | RefreshButton( 126 | text: 'Refresh', 127 | onPressed: () { 128 | setState(() {}); 129 | }, 130 | ), 131 | ], 132 | ), 133 | ); 134 | } else if (snapshot.connectionState == ConnectionState.waiting) { 135 | return Column( 136 | children: [ 137 | const SizedBox(height: 10.0), 138 | Center( 139 | child: Image.asset( 140 | 'assets/images/newLoading.gif', 141 | width: 350, 142 | height: 200, 143 | ), 144 | ), 145 | ], 146 | ); 147 | } else { 148 | return Center( 149 | child: Column( 150 | children: [ 151 | const Padding( 152 | padding: EdgeInsets.all(20.0), 153 | child: Text( 154 | "Please check if you are connected to the internet and swipe or pull down to refresh \n \n Or", 155 | style: TextStyle(), 156 | softWrap: true, 157 | textAlign: TextAlign.center, 158 | ), 159 | ), 160 | RefreshButton( 161 | text: 'Refresh', 162 | onPressed: () { 163 | setState(() {}); 164 | }, 165 | ), 166 | ], 167 | ), 168 | ); 169 | } 170 | }, 171 | ); 172 | } 173 | } 174 | -------------------------------------------------------------------------------- /lib/widgets/list_view_post.dart: -------------------------------------------------------------------------------- 1 | import 'package:cached_network_image/cached_network_image.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 4 | import 'package:intl/intl.dart'; 5 | import 'package:wp_blog_app/app/screens/post_view.dart'; 6 | import 'package:wp_blog_app/const_values.dart'; 7 | import 'package:wp_blog_app/models/posts.dart'; 8 | import 'package:wp_blog_app/widgets/refresh_button.dart'; 9 | 10 | import '../wp_api.dart'; 11 | 12 | class ListViewPost extends StatefulWidget { 13 | const ListViewPost({Key? key}) : super(key: key); 14 | 15 | @override 16 | _ListViewPostState createState() => _ListViewPostState(); 17 | } 18 | 19 | class _ListViewPostState extends State { 20 | WpApi api = WpApi(); 21 | 22 | String formatDateTime(DateTime dateTime) { 23 | return "${dateTime.day}/${dateTime.month}/${dateTime.year}"; 24 | } 25 | 26 | displayTime(String date) { 27 | return DateFormat.yMMMMEEEEd().format(DateTime.parse(date)); 28 | } 29 | 30 | @override 31 | Widget build(BuildContext context) { 32 | return Padding( 33 | padding: const EdgeInsets.only(left: 10), 34 | child: FutureBuilder( 35 | future: api.fetchListPosts(), 36 | builder: (context, AsyncSnapshot snapshot) { 37 | if (snapshot.connectionState == ConnectionState.done && 38 | snapshot.hasData) { 39 | return ListView.builder( 40 | primary: false, 41 | physics: const NeverScrollableScrollPhysics(), 42 | shrinkWrap: true, 43 | itemCount: snapshot.data.length, 44 | itemBuilder: (_, index) { 45 | Posts post = snapshot.data[index]; 46 | return InkWell( 47 | onTap: () { 48 | Navigator.of(context).push( 49 | MaterialPageRoute(builder: (_) { 50 | return PostView( 51 | posts: post, 52 | ); 53 | }), 54 | ); 55 | }, 56 | child: Container( 57 | margin: const EdgeInsets.only(bottom: 20, top: 20), 58 | width: MediaQuery.of(context).size.width, 59 | child: Row( 60 | crossAxisAlignment: CrossAxisAlignment.start, 61 | children: [ 62 | Container( 63 | width: 100.w, 64 | height: 100.h, 65 | margin: const EdgeInsets.only(left: 20), 66 | decoration: const BoxDecoration( 67 | borderRadius: BorderRadius.all( 68 | Radius.circular(15.0), 69 | ), 70 | ), 71 | child: CachedNetworkImage( 72 | imageUrl: '${post.image}', 73 | fit: BoxFit.cover, 74 | width: 100.w, 75 | height: 100.h, 76 | placeholder: (_, url) { 77 | return Image.asset( 78 | 'assets/images/newLoading.gif', 79 | width: 50, 80 | height: 50, 81 | ); 82 | }, 83 | ), 84 | ), 85 | const SizedBox( 86 | width: 15, 87 | ), 88 | Expanded( 89 | child: Column( 90 | crossAxisAlignment: CrossAxisAlignment.start, 91 | mainAxisAlignment: MainAxisAlignment.start, 92 | children: [ 93 | Padding( 94 | padding: const EdgeInsets.all(8.0), 95 | child: Text( 96 | "${post.title!.substring(0, 20)}...", 97 | style: TextStyle( 98 | fontWeight: FontWeight.bold, 99 | fontSize: 18.sp, 100 | ), 101 | softWrap: true, 102 | overflow: TextOverflow.fade, 103 | ), 104 | ), 105 | Padding( 106 | padding: const EdgeInsets.all(5.0), 107 | child: Text( 108 | "${displayTime(post.time.toString())}", 109 | ), 110 | ), 111 | ], 112 | ), 113 | ) 114 | ], 115 | ), 116 | ), 117 | ); 118 | }, 119 | ); 120 | } else if (snapshot.connectionState == ConnectionState.none) { 121 | return Center( 122 | child: Column( 123 | children: [ 124 | const Text( 125 | "Sorry please check you intetnet connection, and swipe on pull down to refresh \n \n Or", 126 | style: TextStyle(), 127 | ), 128 | RefreshButton( 129 | text: 'Refresh', 130 | onPressed: () { 131 | setState(() {}); 132 | }, 133 | ), 134 | ], 135 | ), 136 | ); 137 | } else if (snapshot.connectionState == ConnectionState.waiting) { 138 | return Column( 139 | children: [ 140 | const SizedBox(height: 10.0), 141 | Center( 142 | child: Image.asset( 143 | 'assets/images/newLoading.gif', 144 | width: 350, 145 | height: 200, 146 | ), 147 | ), 148 | ], 149 | ); 150 | } else { 151 | return Center( 152 | child: Column( 153 | children: [ 154 | const Padding( 155 | padding: EdgeInsets.all(20.0), 156 | child: Text( 157 | "Please check if you are connected to the internet and swipe or pull down to refresh \n \n Or", 158 | style: TextStyle(), 159 | softWrap: true, 160 | textAlign: TextAlign.center, 161 | ), 162 | ), 163 | RefreshButton( 164 | text: 'Refresh', 165 | onPressed: () { 166 | setState(() {}); 167 | }, 168 | ), 169 | ], 170 | ), 171 | ); 172 | } 173 | }, 174 | ), 175 | ); 176 | } 177 | } 178 | -------------------------------------------------------------------------------- /lib/widgets/refresh_button.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:hive/hive.dart'; 3 | import 'package:wp_blog_app/const_values.dart'; 4 | import 'package:wp_blog_app/models/posts.dart'; 5 | 6 | class RefreshButton extends StatefulWidget { 7 | final String? text; 8 | final VoidCallback? onPressed; 9 | 10 | RefreshButton({this.text, this.onPressed}); 11 | @override 12 | _RefreshButtonState createState() => _RefreshButtonState(); 13 | } 14 | 15 | class _RefreshButtonState extends State { 16 | @override 17 | Widget build(BuildContext context) { 18 | final Posts changeData = Hive.box(appState).get('state'); 19 | return TextButton( 20 | style: ButtonStyle( 21 | backgroundColor: MaterialStateProperty.resolveWith((states) { 22 | return changeData.isDark == false ? subColor : Colors.transparent; 23 | }), 24 | ), 25 | onPressed: widget.onPressed, 26 | child: Text( 27 | '${widget.text}', 28 | style: TextStyle( 29 | color: defaultWhite, 30 | ), 31 | ), 32 | ); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib/wp_api.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:html/parser.dart'; 3 | import 'package:http/http.dart' as http; 4 | import 'dart:convert'; 5 | 6 | import 'package:wp_blog_app/models/posts.dart'; 7 | 8 | class WpApi { 9 | static const api = "https://www.naijatechguy.com/wp-json/wp/v2/"; 10 | static const listApi = "https://www.naijatechguy.com/wp-json/wp/v2/"; 11 | static const headers = {"Accept": "application/json"}; 12 | 13 | String _parseHtmlString(String htmlString) { 14 | var document = parse(htmlString); 15 | 16 | String parsedString = parse(document.body!.text).documentElement!.text; 17 | 18 | return parsedString; 19 | } 20 | 21 | Future> fetchTopPosts() async { 22 | List posts = []; 23 | try { 24 | var response = await http.get( 25 | Uri.parse("$api/posts?_embed&per_page=20"), 26 | headers: headers, 27 | ); 28 | 29 | var convertDataToJson = json.decode(response.body); 30 | convertDataToJson.forEach((post) { 31 | String title = _parseHtmlString(post['title']['rendered']); 32 | 33 | // if (title.length > 30) { 34 | // title = _parseHtmlString(post['title']['rendered']).substring(0, 20) + "..."; 35 | // } 36 | 37 | var time = post['date']; 38 | 39 | var content = _parseHtmlString(post['content']['rendered']); 40 | 41 | var imageUrl = post['_embedded']['wp:featuredmedia'] != null 42 | ? post['_embedded']['wp:featuredmedia'][0]['source_url'] 43 | : ''; 44 | 45 | posts.add(Posts( 46 | title: title, 47 | image: imageUrl, 48 | contents: content, 49 | time: time, 50 | )); 51 | }); 52 | } catch (e) { 53 | print(e.toString()); 54 | throw (e); 55 | } 56 | 57 | return posts; 58 | } 59 | 60 | // call for all Game articles 61 | Future> fetchListPosts() async { 62 | var response = await http.get( 63 | Uri.parse(listApi + "posts?_embed&categories=467"), 64 | headers: headers, 65 | ); 66 | 67 | var convertDataToJson = jsonDecode(response.body); 68 | 69 | List posts = []; 70 | 71 | convertDataToJson.forEach((post) { 72 | String title = _parseHtmlString(post['title']['rendered']); 73 | 74 | var content = _parseHtmlString(post['content']['rendered']); 75 | var time = post['date']; 76 | 77 | var imageUrl = post['_embedded']['wp:featuredmedia'] != null 78 | ? post['_embedded']['wp:featuredmedia'][0]['source_url'] 79 | : Image.network( 80 | 'assets/images/img_error.jpg', 81 | fit: BoxFit.cover, 82 | width: 100, 83 | height: 90, 84 | ); 85 | 86 | posts.add( 87 | Posts(title: title, image: imageUrl, contents: content, time: time)); 88 | }); 89 | 90 | return posts; 91 | } 92 | 93 | // api call for categories sections 94 | Future> fetchOtherCategories(int cartCode) async { 95 | var response = await http.get( 96 | Uri.parse(listApi + "posts?_embed&categories=$cartCode"), 97 | headers: headers, 98 | ); 99 | 100 | var convertDataToJson = jsonDecode(response.body); 101 | 102 | List posts = []; 103 | 104 | convertDataToJson.forEach((post) { 105 | String title = _parseHtmlString(post['title']['rendered']); 106 | 107 | var content = _parseHtmlString(post['content']['rendered']); 108 | var time = post['date']; 109 | 110 | var imageUrl = post['_embedded']['wp:featuredmedia'] != null 111 | ? post['_embedded']['wp:featuredmedia'][0]['source_url'] 112 | : Image.network( 113 | 'assets/images/img_error.jpg', 114 | fit: BoxFit.cover, 115 | width: 100, 116 | height: 90, 117 | ); 118 | 119 | // var time = post['date']; 120 | 121 | posts.add( 122 | Posts(title: title, image: imageUrl, contents: content, time: time)); 123 | }); 124 | 125 | return posts; 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: wp_blog_app 2 | description: A new Flutter project. 3 | 4 | # The following defines the version and build number for your application. 5 | # A version number is three numbers separated by dots, like 1.2.43 6 | # followed by an optional build number separated by a +. 7 | # Both the version and the builder number may be overridden in flutter 8 | # build by specifying --build-name and --build-number, respectively. 9 | # In Android, build-name is used as versionName while build-number used as versionCode. 10 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 11 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 12 | # Read more about iOS versioning at 13 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 14 | version: 0.13.5 15 | 16 | environment: 17 | sdk: ">=2.12.0 <3.0.0" 18 | 19 | dependencies: 20 | flutter: 21 | sdk: flutter 22 | auto_size_text_pk: ^3.0.0 23 | bottom_navy_bar: ^6.0.0 24 | cached_network_image: ^3.2.1 25 | cupertino_icons: ^1.0.4 26 | flutter_device_type: ^0.4.0 27 | hive: ^2.2.1 28 | hive_flutter: ^1.1.0 29 | html: ^0.15.0 30 | http: ^0.13.4 31 | intl: ^0.17.0 32 | launch_review: ^3.0.1 33 | path_provider: ^2.0.10 34 | provider: ^6.0.3 35 | share: ^2.0.4 36 | shared_preferences: ^2.0.15 37 | shimmer: ^2.0.0 38 | fluttertoast: ^8.0.9 39 | flutter_screenutil: ^5.5.3+2 40 | pull_to_refresh: ^2.0.0 41 | 42 | dev_dependencies: 43 | flutter_test: 44 | sdk: flutter 45 | build_runner: ^2.1.11 46 | change_app_package_name: ^1.0.0 47 | hive_generator: ^1.1.3 48 | flutter_lints: ^2.0.1 49 | 50 | # For information on the generic Dart part of this file, see the 51 | # following page: https://dart.dev/tools/pub/pubspec 52 | # The following section is specific to Flutter. 53 | flutter: 54 | # The following line ensures that the Material Icons font is 55 | # included with your application, so that you can use the icons in 56 | # the material Icons class. 57 | uses-material-design: true 58 | # To add assets to your application, add an assets section, like this: 59 | assets: 60 | - assets/images/ 61 | - assets/logo/ 62 | # An image asset can refer to one or more resolution-specific "variants", see 63 | # https://flutter.dev/assets-and-images/#resolution-aware. 64 | # For details regarding adding assets from package dependencies, see 65 | # https://flutter.dev/assets-and-images/#from-packages 66 | # To add custom fonts to your application, add a fonts section here, 67 | # in this "flutter" section. Each entry in this list should have a 68 | # "family" key with the font family name, and a "fonts" key with a 69 | # list giving the asset and other descriptors for the font. For 70 | # example: 71 | # fonts: 72 | # - family: Schyler 73 | # fonts: 74 | # - asset: fonts/Schyler-Regular.ttf 75 | # - asset: fonts/Schyler-Italic.ttf 76 | # style: italic 77 | # - family: Trajan Pro 78 | # fonts: 79 | # - asset: fonts/TrajanPro.ttf 80 | # - asset: fonts/TrajanPro_Bold.ttf 81 | # weight: 700 82 | # 83 | # For details regarding fonts from package dependencies, 84 | # see https://flutter.dev/custom-fonts/#from-packages 85 | -------------------------------------------------------------------------------- /ss/naijatechguy.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudo-which-qp/wp_blog_app/815dbe5836f657a3b09014ca394455409507c26b/ss/naijatechguy.gif -------------------------------------------------------------------------------- /ss/naijtechguyTwo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sudo-which-qp/wp_blog_app/815dbe5836f657a3b09014ca394455409507c26b/ss/naijtechguyTwo.gif -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility in the flutter_test package. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | import 'package:wp_blog_app/app/src/app.dart'; 11 | 12 | import 'package:wp_blog_app/main.dart'; 13 | 14 | void main() { 15 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 16 | // Build our app and trigger a frame. 17 | await tester.pumpWidget(const App()); 18 | 19 | // Verify that our counter starts at 0. 20 | expect(find.text('0'), findsOneWidget); 21 | expect(find.text('1'), findsNothing); 22 | 23 | // Tap the '+' icon and trigger a frame. 24 | await tester.tap(find.byIcon(Icons.add)); 25 | await tester.pump(); 26 | 27 | // Verify that our counter has incremented. 28 | expect(find.text('0'), findsNothing); 29 | expect(find.text('1'), findsOneWidget); 30 | }); 31 | } 32 | --------------------------------------------------------------------------------