vercel 0.0.2
vercel: ^0.0.2 copied to clipboard
A Flutter package for deploying Flutter web apps to Vercel with a single command
example/example.dart
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Vercel Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
primaryColor: Colors.blue,
colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
useMaterial3: true,
),
home: const HomePage(),
);
}
}
class HomePage extends StatelessWidget {
const HomePage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Flutter Vercel Demo'),
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Icon(
Icons.cloud_upload,
size: 80,
color: Colors.blue,
),
const SizedBox(height: 24),
const Text(
'Successfully Deployed to Vercel!',
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 16),
Text(
'Running on ${Uri.base.host}',
style: const TextStyle(
fontSize: 16,
color: Colors.grey,
),
),
const SizedBox(height: 48),
ElevatedButton.icon(
icon: const Icon(Icons.code),
label: const Text('View Package Source'),
onPressed: () {
// This would open a URL in a real app
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Package source: https://github.com/yourusername/vercel'),
),
);
},
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: () {
showDialog(
context: context,
builder: (context) => AlertDialog(
title: const Text('Deployment Info'),
content: const Text(
'This Flutter web app was deployed using the "vercel" package with a single command!',
),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: const Text('Close'),
),
],
),
);
},
tooltip: 'Deployment Info',
child: const Icon(Icons.info_outline),
),
);
}
}