Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

flutter for cross platform wordpress

cross platform wordpress news app built with flutter.

cross platform

installation

you need to have a wordpress website before you implement the app.

if you have wordpress website already then follow the simple steps given below to build your own cross platform wordpress flutter app.

edit your wordpress theme

update the wordpress functions.php file on your theme by appending the following code at the end. the app will not function correctly if this step is not followed.

function flutter_news_rest_prepare_post($data, $post, $request)
{
    $_data = $data->data;
    $video = get_post_meta($post->id, 'td_post_video', true);
    if ($video) {
        $_data["custom"] = get_post_meta($post->id, 'td_post_video', true);
    } else {
        $_data["custom"]["td_video"] = "";
    }
    $featured_image_id  = $_data['featured_media'];
    $featured_image_url = get_the_post_thumbnail_url($post->id, "original");
    
    if ($featured_image_url) {
        $_data['custom']["featured_image"] = $featured_image_url;
    } else {
        $_data['custom']["featured_image"] = "";
    }
    
    $_data['custom']["author"]["name"]   = get_author_name($_data['author']);
    $_data['custom']["author"]["avatar"] = get_avatar_url($_data['author']);
	
	$categories = get_the_category($_data["id"]);
	$_data['custom']["categories"] = $categories;
    
    $data->data = $_data;
    
    return $data;
}

add_filter('rest_prepare_post', 'flutter_news_rest_prepare_post', 10, 3);

edit the constants

change the constants from the ./lib/common/constants.dart file. for the categories name and id refer to your wordpress website.

// your wordpress website url
const string wordpress_url = "https://flutterblog.crumet.com"; 

// featured category id (for home screen top section)
const int featured_id = 2;

// tab 2 page category name
const string page2_category_name = "lifestyle";

// tab 2 page category id
const int page2_category_id = 6;

// custom categories in search tab
// array in format
// ["category name", "image link", "category id"]
const list<dynamic> custom_categories = [
  ["lifestyle", "assets/boxed/lifestyle.png", 6],
  ["fashion", "assets/boxed/fashion.png", 12],
  ["music", "assets/boxed/music.png", 14],
  ["photography", "assets/boxed/photography.png", 15],
  ["sport", "assets/boxed/sport.png", 13],
  ["world", "assets/boxed/world.png", 11],
  ["health", "assets/boxed/health.png", 8],
  ["travel", "assets/boxed/travel.png", 7],
  ["recipies", "assets/boxed/recipies.png", 10],
];

push notification (optional)

this project uses firebase messenging for push notification.

to integrate push notification from firebase follow the steps:

  • go to firebase console
  • generate and download google-services.json file
  • place google-services.json file inside android/app
  • it should be ready now. test your push notification.

for further instruction read documentation from https://pub.dev/packages/firebase_messaging

screenshots

alt text alt text alt text
alt text alt text alt text
alt text alt text alt text
alt text alt text alt text

Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Comments are closed.