creation of the first page of score with differents widgets

StateManagement
Lucas Delanier 2 years ago
parent 60cd2e31b0
commit 115f445029

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

@ -1,5 +1,7 @@
import 'package:bowl_in/views/main_screen.dart';
import 'package:bowl_in/views/welcome_screen.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() {
runApp(const MyApp());
@ -11,9 +13,11 @@ class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersive);
SystemChrome.setSystemUIOverlayStyle(
const SystemUiOverlayStyle(statusBarColor: Colors.transparent));
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
theme: ThemeData(
// This is the theme of your application.
@ -27,7 +31,7 @@ class MyApp extends StatelessWidget {
// is not restarted.
primarySwatch: Colors.blue,
),
home: const WelcomeScreen(),
home: const MainScreen(),
);
}
}

@ -0,0 +1,17 @@
import 'package:flutter/widgets.dart';
class BowlInFont {
BowlInFont._();
static const _kFontFam = 'BowlInFont';
static const String? _kFontPkg = null;
static const IconData stats_icon =
IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData profil_icon =
IconData(0xe804, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData home_icon =
IconData(0xe805, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData rank_icon =
IconData(0xe806, fontFamily: _kFontFam, fontPackage: _kFontPkg);
}

@ -0,0 +1,149 @@
import 'package:bowl_in/presentation/font.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../widgets/scores_list_widget.dart';
class MainScreen extends StatefulWidget {
const MainScreen({Key? key}) : super(key: key);
@override
State<MainScreen> createState() => _MainScreenState();
}
class _MainScreenState extends State<MainScreen> {
int _index = 0;
int get index => _index;
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: [
Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color(0xff19BDE0),
Color(0xff4A17DC),
],
)),
),
Align(
alignment: AlignmentDirectional.topCenter,
child: Container(
height: 120,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/image_score.png"),
)),
child: Center(
child: Text(
"Scores",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
fontSize: 20),
)),
),
),
Align(
alignment: Alignment.bottomCenter,
child: Positioned(
bottom: 0,
child: Container(
height: MediaQuery.of(context).size.height - 200,
width: MediaQuery.of(context).size.width,
child: ListCardGame(),
)),
)
],
),
bottomNavigationBar: SizedBox(
height: 75,
child: NavigationBarTheme(
data: NavigationBarThemeData(
indicatorColor: Colors.transparent,
),
child: ConstrainedBox(
constraints: const BoxConstraints(
minHeight: 200,
maxHeight: 200,
),
child: Container(
decoration: BoxDecoration(
boxShadow: <BoxShadow>[
BoxShadow(
color: Colors.black.withOpacity(0.8),
blurRadius: 500,
),
],
),
child: NavigationBar(
animationDuration: const Duration(microseconds: 800),
selectedIndex: index,
labelBehavior:
NavigationDestinationLabelBehavior.alwaysHide,
height: MediaQuery.of(context).size.height * 0.1,
onDestinationSelected: (index) =>
setState(() => _index = index),
backgroundColor: Colors.white,
destinations: const [
NavigationDestination(
icon: Icon(
BowlInFont.home_icon,
color: Colors.grey,
size: 21,
),
label: 'Profil',
selectedIcon: Icon(
BowlInFont.home_icon,
size: 21,
),
),
NavigationDestination(
icon: Icon(
Icons.show_chart,
color: Colors.grey,
size: 21,
),
label: '',
selectedIcon: Icon(
Icons.show_chart,
size: 21,
),
),
NavigationDestination(
icon: Icon(
BowlInFont.rank_icon,
color: Colors.grey,
size: 21,
),
label: '',
selectedIcon: Icon(
BowlInFont.rank_icon,
size: 21,
),
),
NavigationDestination(
icon: Icon(
BowlInFont.profil_icon,
color: Colors.grey,
size: 21,
),
label: '',
selectedIcon: Icon(
BowlInFont.profil_icon,
size: 21,
),
),
],
),
),
),
)));
}
}

@ -0,0 +1,52 @@
import 'package:flutter/cupertino.dart';
class CardGame extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.fromLTRB(0, 0, 0, 10),
child: Container(
width: MediaQuery.of(context).size.width,
height: 100,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/images/card_game.png"),
),
)),
);
}
}
class CustomScroll extends ScrollBehavior {
@override
Widget buildViewportChrome(
BuildContext context, Widget child, AxisDirection axisDirection) {
return child;
}
}
class ListCardGame extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ScrollConfiguration(
behavior: CustomScroll(),
child: Expanded(
child: ListView(
shrinkWrap: true,
children: <Widget>[
CardGame(),
CardGame(),
CardGame(),
CardGame(),
CardGame(),
CardGame(),
CardGame(),
CardGame(),
CardGame(),
CardGame(),
CardGame(),
CardGame(),
],
)));
}
}

@ -62,6 +62,7 @@ flutter:
# To add assets to your application, add an assets section, like this:
assets:
- assets/images/
- assets/fonts/
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware
@ -74,17 +75,9 @@ flutter:
# "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
#
fonts:
- family: BowlInFont
fonts:
- asset: assets/fonts/BowlInFont.ttf
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages

Loading…
Cancel
Save