app_sprout 0.0.5
app_sprout: ^0.0.5 copied to clipboard
Seed Project for Flutter Apps
This is a Seed Application which helps any Flutter Dev team to create a Flutter app ( Android, iOS, Web , Windows and Linux) from scratch that includes below features
- Left Navigation Nodes.
- App Bar, Botttom Tool bar, Slider Controls.
- Push Notification.
- Authentications (Face ID and Fingerprint).
- Build controls like Button, text field with custom styling.
Steps :
-
Create a Flutter App :
flutter create AppName -
To Run the base app flutter run
-
Import this package : flutter pub add app_sprout
-
Replace main.dart code
Widget build(BuildContext context) { return MaterialApp( home: SplashScreen( nextScreen: HomeScreen(), imagePath: 'assets/logo.png', ), ); } }
class HomeScreen extends StatelessWidget { HomeScreen({super.key});
@override Widget build(BuildContext context) { return Scaffold( body: Center(child: Text('Welcome to Home Screen')), ); } }
- Splash Screen Set up:
Create folder assets and add logo.png Add below line in pubspec assets:
- assets/logo.png
- App Bar Set up:
appBar: AppBar( title: const Text('Whats New!'), ),
- Left Drawer Set up:
List
final toolbarItems = [ Toolbar( label: 'new', ), Toolbar(label: 'notification'), ];
drawer: DrawerWidget( drawerItems: drawerItems, onTapFunction: (context, identifier) {}),
- Right Drawer Set up:
endDrawer: RightDrawer( drawerItems: drawerItems, onTapFunction: (context, identifier) {}),
- Bottom tool bar Set up:
bottomNavigationBar: BottomToolbar( items: toolbarItems, onTapFunction: (context, identifier) {}, ),
- Push Notification Set up:
void initState() { super.initState(); try { NotificationServices notificationServices = NotificationServices(); notificationServices.requestNotificationPermission(); notificationServices.firebaseInit(context); notificationServices.setupInteractMessage(context); final globalData = Provider.of
notificationServices.getDeviceToken().then((value) {
if (value == "invalid") {
const snackBar = SnackBar(
content: Text('token is invalid'),
);
ScaffoldMessenger.of(context).showSnackBar(snackBar);
} else {
globalData.setDeviceId(value);
print('device token is : $value');
}
});
} catch (e) {
print('issue getting token: $e');
}
}
- Authentication Complete Code
import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:local_auth/local_auth.dart'; import 'package:pinaka/components/new.dart'; import 'package:pinaka/components/notification.dart';
class AuthenticateScreen extends StatefulWidget { const AuthenticateScreen({super.key}); @override State
class AuthenticateScreenState extends State
final toolbarItems = [ Toolbar(identifier: 'new', label: 'new', icon: 'activity'), Toolbar( identifier: 'notification', label: 'notification', icon: 'appointments'), ];
final List
@override void initState() { super.initState(); auth = LocalAuthentication(); auth.isDeviceSupported().then( (bool isSupported) => setState(() { _supportState = isSupported; }), ); }
void onTapFunction(BuildContext context, String identifier) { if (routes.containsKey(identifier)) { Navigator.of(context).push( PageRouteBuilder( transitionDuration: const Duration(milliseconds: 500), pageBuilder: (context, animation, secondaryAnimation) { return SlideTransition( position: Tween
Scaffold.of(context).closeEndDrawer();
}
final Map<String, Widget> routes = { 'new': const NewScreen(), 'notification': const NotificationScreen(), 'authenticate': const AuthenticateScreen(), };
@override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Authentication'), ), body: Column( mainAxisAlignment: MainAxisAlignment.center, children:
Future
Future