Skip to content

Commit

Permalink
app bar
Browse files Browse the repository at this point in the history
  • Loading branch information
Dat-TG committed Dec 9, 2023
1 parent c1d0641 commit 31cfa77
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 18 deletions.
22 changes: 12 additions & 10 deletions lib/constants/app_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class AppThemeData {
backgroundColor: colorScheme.background,
elevation: 0,
iconTheme: IconThemeData(color: colorScheme.primary),
titleTextStyle:
_textTheme.headlineMedium!.apply(color: colorScheme.primary),
),
iconTheme: IconThemeData(color: colorScheme.onPrimary),
canvasColor: colorScheme.background,
Expand Down Expand Up @@ -98,15 +100,15 @@ class AppThemeData {
static const _bold = FontWeight.w700;

static final TextTheme _textTheme = TextTheme(
headlineMedium: GoogleFonts.montserrat(fontWeight: _bold, fontSize: 20.0),
bodySmall: GoogleFonts.oswald(fontWeight: _semiBold, fontSize: 16.0),
headlineSmall: GoogleFonts.oswald(fontWeight: _medium, fontSize: 16.0),
titleMedium: GoogleFonts.montserrat(fontWeight: _medium, fontSize: 16.0),
labelSmall: GoogleFonts.montserrat(fontWeight: _medium, fontSize: 12.0),
bodyLarge: GoogleFonts.montserrat(fontWeight: _regular, fontSize: 14.0),
titleSmall: GoogleFonts.montserrat(fontWeight: _medium, fontSize: 14.0),
bodyMedium: GoogleFonts.montserrat(fontWeight: _regular, fontSize: 16.0),
titleLarge: GoogleFonts.montserrat(fontWeight: _bold, fontSize: 16.0),
labelLarge: GoogleFonts.montserrat(fontWeight: _semiBold, fontSize: 14.0),
headlineMedium: GoogleFonts.roboto(fontWeight: _bold, fontSize: 20.0),
bodySmall: GoogleFonts.roboto(fontWeight: _semiBold, fontSize: 16.0),
headlineSmall: GoogleFonts.roboto(fontWeight: _medium, fontSize: 16.0),
titleMedium: GoogleFonts.roboto(fontWeight: _medium, fontSize: 16.0),
labelSmall: GoogleFonts.roboto(fontWeight: _medium, fontSize: 12.0),
bodyLarge: GoogleFonts.roboto(fontWeight: _regular, fontSize: 14.0),
titleSmall: GoogleFonts.roboto(fontWeight: _medium, fontSize: 14.0),
bodyMedium: GoogleFonts.roboto(fontWeight: _regular, fontSize: 16.0),
titleLarge: GoogleFonts.roboto(fontWeight: _bold, fontSize: 16.0),
labelLarge: GoogleFonts.roboto(fontWeight: _semiBold, fontSize: 14.0),
);
}
2 changes: 1 addition & 1 deletion lib/constants/strings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ class Strings {
Strings._();

//General
static const String appName = "Boilerplate Project";
static const String appName = "ChatGPT";
}
27 changes: 27 additions & 0 deletions lib/core/widgets/main_app_bar.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';

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

@override
Widget build(BuildContext context) {
return AppBar(
title: Text('ChatGPT'),
actions: [
IconButton(
icon: FaIcon(FontAwesomeIcons.penToSquare),
splashRadius: 20,
iconSize: 20,
onPressed: () {},
),
IconButton(
icon: FaIcon(FontAwesomeIcons.ellipsisVertical),
splashRadius: 20,
iconSize: 20,
onPressed: () {},
),
],
);
}
}
6 changes: 3 additions & 3 deletions lib/presentation/home/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:material_dialog/material_dialog.dart';
import 'package:shared_preferences/shared_preferences.dart';

class HomeScreen extends StatefulWidget {
class HomeScreenDemo extends StatefulWidget {
@override
State<HomeScreen> createState() => _HomeScreenState();
State<HomeScreenDemo> createState() => _HomeScreenDemoState();
}

class _HomeScreenState extends State<HomeScreen> {
class _HomeScreenDemoState extends State<HomeScreenDemo> {
//stores:---------------------------------------------------------------------
final ThemeStore _themeStore = getIt<ThemeStore>();
final LanguageStore _languageStore = getIt<LanguageStore>();
Expand Down
5 changes: 2 additions & 3 deletions lib/presentation/my_app.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import 'package:boilerplate/constants/app_theme.dart';
import 'package:boilerplate/constants/strings.dart';
import 'package:boilerplate/presentation/home/home.dart';
import 'package:boilerplate/presentation/home/store/language/language_store.dart';
import 'package:boilerplate/presentation/home/store/theme/theme_store.dart';
import 'package:boilerplate/presentation/login/login.dart';
import 'package:boilerplate/presentation/login/store/login_store.dart';
import 'package:boilerplate/presentation/new_chat/new_chat_screen.dart';
import 'package:boilerplate/utils/locale/app_localization.dart';
import 'package:boilerplate/utils/routes/routes.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -46,7 +45,7 @@ class MyApp extends StatelessWidget {
// Built-in localization of basic text for Cupertino widgets
GlobalCupertinoLocalizations.delegate,
],
home: _userStore.isLoggedIn ? HomeScreen() : LoginScreen(),
home: NewChatScreen(),
);
},
);
Expand Down
21 changes: 21 additions & 0 deletions lib/presentation/new_chat/new_chat_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'package:boilerplate/core/widgets/main_app_bar.dart';
import 'package:flutter/material.dart';

class NewChatScreen extends StatefulWidget {
const NewChatScreen({super.key});

@override
State<NewChatScreen> createState() => _NewChatScreenState();
}

class _NewChatScreenState extends State<NewChatScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: PreferredSize(
preferredSize: Size.fromHeight(60),
child: MainAppBar(),
),
);
}
}
5 changes: 4 additions & 1 deletion lib/utils/routes/routes.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:boilerplate/presentation/home/home.dart';
import 'package:boilerplate/presentation/login/login.dart';
import 'package:boilerplate/presentation/new_chat/new_chat_screen.dart';
import 'package:flutter/material.dart';

class Routes {
Expand All @@ -9,9 +10,11 @@ class Routes {
static const String splash = '/splash';
static const String login = '/login';
static const String home = '/post';
static const String newchat = '/newchat';

static final routes = <String, WidgetBuilder>{
login: (BuildContext context) => LoginScreen(),
home: (BuildContext context) => HomeScreen(),
home: (BuildContext context) => HomeScreenDemo(),
newchat: (BuildContext context) => NewChatScreen(),
};
}
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ dependencies:
# X
xxtea: ^2.1.0
json_annotation: ^4.8.1
font_awesome_flutter: ^10.6.0
# Y
# Z

Expand Down

0 comments on commit 31cfa77

Please sign in to comment.