home_page_provider 1.2.1 copy "home_page_provider: ^1.2.1" to clipboard
home_page_provider: ^1.2.1 copied to clipboard

A Flutter package project that gives the option to have a separate home page for web and mobile

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:home_page_provider/home_page_provider.dart';

Future<void> main() async {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Home Page Provider package demo',
      home: HomePageProvider().getWebOrMobileHomePage(
        const HomePageWeb(),
        const HomePageMobile(),
      ),
    );
  }
}

class HomePageWeb extends StatelessWidget {
  const HomePageWeb({super.key});

  @override
  Widget build(BuildContext context) {
    return const Material(
      child: Text('Welcome to the Web Home Page',
          textScaler: TextScaler.linear(3.0)),
    );
  }
}

class HomePageMobile extends StatelessWidget {
  const HomePageMobile({super.key});

  @override
  Widget build(BuildContext context) {
    return const Material(
      child: Text('Welcome to the Mobile Home Page',
          textScaler: TextScaler.linear(3.0)),
    );
  }
}
0
likes
130
pub points
18%
popularity

Publisher

unverified uploader

A Flutter package project that gives the option to have a separate home page for web and mobile

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on home_page_provider