0% found this document useful (0 votes)
5 views

project code

The document contains a Flutter application codebase which initializes a mobile app with a customizable theme and localization support. It includes a navigation bar with three tabs: Dashboard, Profile, and Drive, and utilizes various Flutter packages for functionality. Additionally, the pubspec.yaml file outlines the app's dependencies and configurations for versioning and assets.

Uploaded by

subhasuji86
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

project code

The document contains a Flutter application codebase which initializes a mobile app with a customizable theme and localization support. It includes a navigation bar with three tabs: Dashboard, Profile, and Drive, and utilizes various Flutter packages for functionality. Additionally, the pubspec.yaml file outlines the app's dependencies and configurations for versioning and assets.

Uploaded by

subhasuji86
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

Main

import 'package:flutter/gestures.dart';

import 'package:flutter/material.dart';

import 'package:flutter_localizations/flutter_localizations.dart';

import 'package:flutter_web_plugins/url_strategy.dart';

import 'flutter_flow/flutter_flow_theme.dart';

import 'flutter_flow/flutter_flow_util.dart';

import 'flutter_flow/internationalization.dart';

import 'package:google_fonts/google_fonts.dart';

import 'package:floating_bottom_navigation_bar/floating_bottom_navigation_bar.dart';

import 'flutter_flow/nav/nav.dart';

import 'index.dart';

void main() async {

WidgetsFlutterBinding.ensureInitialized();

usePathUrlStrategy();

await FlutterFlowTheme.initialize();

runApp(MyApp());

class MyApp extends StatefulWidget {

// This widget is the root of your application.

@override

State<MyApp> createState() => _MyAppState();


static _MyAppState of(BuildContext context) =>

context.findAncestorStateOfType<_MyAppState>()!;

class _MyAppState extends State<MyApp> {

Locale? _locale;

ThemeMode _themeMode = FlutterFlowTheme.themeMode;

late AppStateNotifier _appStateNotifier;

late GoRouter _router;

@override

void initState() {

super.initState();

_appStateNotifier = AppStateNotifier.instance;

_router = createRouter(_appStateNotifier);

void setLocale(String language) {

setState(() => _locale = createLocale(language));

void setThemeMode(ThemeMode mode) => setState(() {

_themeMode = mode;

FlutterFlowTheme.saveThemeMode(mode);

});
@override

Widget build(BuildContext context) {

return MaterialApp.router(

title: 'cong-app',

localizationsDelegates: [

FFLocalizationsDelegate(),

GlobalMaterialLocalizations.delegate,

GlobalWidgetsLocalizations.delegate,

GlobalCupertinoLocalizations.delegate,

],

locale: _locale,

supportedLocales: const [Locale('en', '')],

theme: ThemeData(

brightness: Brightness.light,

scrollbarTheme: ScrollbarThemeData(),

),

darkTheme: ThemeData(

brightness: Brightness.dark,

scrollbarTheme: ScrollbarThemeData(),

),

themeMode: _themeMode,

routerConfig: _router,

);

class NavBarPage extends StatefulWidget {

NavBarPage({Key? key, this.initialPage, this.page}) : super(key: key);


final String? initialPage;

final Widget? page;

@override

_NavBarPageState createState() => _NavBarPageState();

/// This is the private State class that goes with NavBarPage.

class _NavBarPageState extends State<NavBarPage> {

String _currentPageName = 'dashboard';

late Widget? _currentPage;

@override

void initState() {

super.initState();

_currentPageName = widget.initialPage ?? _currentPageName;

_currentPage = widget.page;

@override

Widget build(BuildContext context) {

final tabs = {

'dashboard': DashboardWidget(),

'profile': ProfileWidget(),

'drive_mode_off': DriveModeOffWidget(),

};

final currentIndex = tabs.keys.toList().indexOf(_currentPageName);


final MediaQueryData queryData = MediaQuery.of(context);

return Scaffold(

body: MediaQuery(

data: queryData

.removeViewInsets(removeBottom: true)

.removeViewPadding(removeBottom: true),

child: _currentPage ?? tabs[_currentPageName]!),

extendBody: true,

bottomNavigationBar: FloatingNavbar(

currentIndex: currentIndex,

onTap: (i) => setState(() {

_currentPage = null;

_currentPageName = tabs.keys.toList()[i];

}),

backgroundColor: Colors.white,

selectedItemColor: Color(0xFFF78B45),

unselectedItemColor: Color(0xFF5A6174),

selectedBackgroundColor: Color(0x00000000),

borderRadius: 8.0,

itemBorderRadius: 8.0,

margin: EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),

padding: EdgeInsetsDirectional.fromSTEB(0.0, 0.0, 0.0, 0.0),

width: double.infinity,

elevation: 0.0,

items: [

FloatingNavbarItem(
customWidget: Column(

mainAxisAlignment: MainAxisAlignment.center,

children: [

Icon(

Icons.home_outlined,

color:

currentIndex == 0 ? Color(0xFFF78B45) : Color(0xFF5A6174),

size: 24.0,

),

Text(

'Home',

overflow: TextOverflow.ellipsis,

style: TextStyle(

color: currentIndex == 0

? Color(0xFFF78B45)

: Color(0xFF5A6174),

fontSize: 11.0,

),

),

],

),

),

FloatingNavbarItem(

customWidget: Column(

mainAxisAlignment: MainAxisAlignment.center,

children: [

Icon(

Icons.person_outline,
color:

currentIndex == 1 ? Color(0xFFF78B45) : Color(0xFF5A6174),

size: 24.0,

),

Text(

'Profile',

overflow: TextOverflow.ellipsis,

style: TextStyle(

color: currentIndex == 1

? Color(0xFFF78B45)

: Color(0xFF5A6174),

fontSize: 11.0,

),

),

],

),

),

FloatingNavbarItem(

customWidget: Column(

mainAxisAlignment: MainAxisAlignment.center,

children: [

Icon(

Icons.directions_car_filled_outlined,

color:

currentIndex == 2 ? Color(0xFFF78B45) : Color(0xFF5A6174),

size: 24.0,

),

Text(
'Drive',

overflow: TextOverflow.ellipsis,

style: TextStyle(

color: currentIndex == 2

? Color(0xFFF78B45)

: Color(0xFF5A6174),

fontSize: 11.0,

),

),

],

),

],

),

);

Pubspec.yaml
name: cong_app

description: A new Flutter project.

# The following line prevents the package from being accidentally published to

# pub.dev using `pub publish`. This is preferred for private packages.

publish_to: 'none' # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43

# followed by an optional build number separated by a +.

# Both the version and the builder number may be overridden in flutter

# build by specifying --build-name and --build-number, respectively.

# In Android, build-name is used as versionName while build-number used as versionCode.

# Read more about Android versioning at


https://developer.android.com/studio/publish/versioning

# In iOS, build-name is used as CFBundleShortVersionString while build-number used as


CFBundleVersion.

# Read more about iOS versioning at

#
https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKe
yReference/Articles/CoreFoundationKeys.html

version: 1.0.0+1

environment:

sdk: ">=3.0.0 <4.0.0"

dependencies:

flutter:

sdk: flutter

flutter_localizations:

sdk: flutter

auto_size_text: 3.0.0

cached_network_image: ^3.3.0

collection: ^1.17.2

dropdown_button2: ^2.3.9

flip_card: ^0.7.0

floating_bottom_navigation_bar: 1.5.2
flutter_animate: ^4.2.0+1

flutter_cache_manager: ^3.3.1

flutter_google_places:

git:

url: https://github.com/fluttercommunity/flutter_google_places

ref: v0.3.2

flutter_plugin_android_lifecycle: ^2.0.16

font_awesome_flutter: ^10.5.0

from_css_color: 2.0.0

geolocator: ^12.0.0

geolocator_android: ^4.3.1

geolocator_apple: ^2.3.2

geolocator_platform_interface: ^4.1.1

geolocator_web: ^4.1.3

go_router: ^15.0.0

google_api_headers: ^1.2.0

google_fonts: ^4.0.4

google_maps: ^8.1.1

google_maps_flutter: ^2.5.0

google_maps_flutter_platform_interface: ^2.4.1

google_maps_flutter_web: ^0.5.4+2

intl: ^0.19.0

json_path: ^0.7.5

json_annotation: ^4.8.1

package_info_plus: ^4.1.0

package_info_plus_platform_interface: 2.0.1

page_transition: ^2.1.0

path_provider: ^2.1.1
path_provider_android: ^2.2.0

path_provider_foundation: ^2.3.1

path_provider_platform_interface: ^2.1.1

provider: ^6.0.5

shared_preferences: ^2.2.1

shared_preferences_android: ^2.2.1

shared_preferences_ios: 2.1.1

shared_preferences_platform_interface: ^2.3.1

shared_preferences_web: ^2.2.1

sqflite: ^2.3.0

timeago: ^3.5.0

url_launcher: ^6.1.14

url_launcher_android: ^6.1.0

url_launcher_ios: ^6.1.5

url_launcher_platform_interface: ^2.1.5

webview_flutter: ^4.4.1

webview_flutter_android: ^3.12.0

webview_flutter_platform_interface: ^2.6.0

webview_flutter_wkwebview: ^3.9.1

webviewx_plus: 0.3.3

# The following adds the Cupertino Icons font to your application.

# Use with the CupertinoIcons class for iOS style icons.

cupertino_icons: ^1.0.0

dev_dependencies:

flutter_test:
sdk: flutter

build_runner: ^2.4.6

json_serializable: ^6.7.1

# For information on the generic Dart part of this file, see the

# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.

flutter:

# The following line ensures that the Material Icons font is

# included with your application, so that you can use the icons in

# the material Icons class.

uses-material-design: true

# To add assets to your application, add an assets section, like this:

assets:

- assets/fonts/

- assets/images/

- assets/videos/

- assets/audios/

- assets/lottie_animations/

- assets/rive_animations/

- assets/pdfs/

fonts:

- family: 'san francisco'


fonts:

- asset: assets/fonts/SFUIDisplay-Thin.otf

weight: 100

- asset: assets/fonts/SFUIDisplay-Light.ttf

weight: 300

- asset: assets/fonts/SFUIDisplay-Regular.otf

- asset: assets/fonts/SFUIDisplay-Medium.otf

weight: 500

- asset: assets/fonts/SFUIDisplay-Semibold.otf

weight: 600

- asset: assets/fonts/SFUIDisplay-Bold.ttf

weight: 700

- asset: assets/fonts/SFUIDisplay-Black.otf

weight: 900

# An image asset can refer to one or more resolution-specific "variants", see

# https://flutter.dev/assets-and-images/#resolution-aware.

# For details regarding adding assets from package dependencies, see

# https://flutter.dev/assets-and-images/#from-packages

# To add custom fonts to your application, add a fonts section here,

# in this "flutter" section. Each entry in this list should have a

# "family" key with the font family name, and a "fonts" key with a

# list giving the asset and other descriptors for the font. For

# example:

# fonts:

# - family: Schyler
# fonts:

# - asset: fonts/Schyler-Regular.ttf

# - asset: fonts/Schyler-Italic.ttf

# style: italic

# - family: Trajan Pro

# fonts:

# - asset: fonts/TrajanPro.ttf

# - asset: fonts/TrajanPro_Bold.ttf

# weight: 700

# For details regarding fonts from package dependencies,

# see https://flutter.dev/custom-fonts/#from-packages

You might also like