home_page_provider 1.2.1 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
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)),
);
}
}