118 lines
3.9 KiB
Dart
118 lines
3.9 KiB
Dart
import 'package:faucethub/Backend/brains.dart';
|
|
import 'package:faucethub/Backend/hoarder.dart';
|
|
import 'package:faucethub/Backend/login_mgr.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/rendering.dart';
|
|
|
|
class HomePage extends StatefulWidget {
|
|
const HomePage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<HomePage> createState() => _HomePageState();
|
|
}
|
|
|
|
int selectedBotNavIndex = 0;
|
|
|
|
class _HomePageState extends State<HomePage> {
|
|
static List<Widget> bodyOptions = <Widget>[
|
|
HomeWidget(),
|
|
Text("games"),
|
|
Text("Money!")
|
|
];
|
|
|
|
static Widget HomeWidget() {
|
|
final ScrollController _firstController = ScrollController();
|
|
return SingleChildScrollView(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
Container(
|
|
padding: EdgeInsets.all(10),
|
|
child: Text("Welcome ${Brain.UserJson['name']},",
|
|
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold)),
|
|
),
|
|
SizedBox(
|
|
height: 20,
|
|
),
|
|
HomeCard(child: Container(padding:EdgeInsets.symmetric(vertical: 50),child: Text("\$6.90", style: TextStyle(fontSize: 50),),), title: "Earnings"),
|
|
HomeCard(title:"Featured Games",child:
|
|
SizedBox(
|
|
height: 110,
|
|
child: Scrollbar(
|
|
thumbVisibility: true,
|
|
controller: _firstController,
|
|
child: ListView.builder(
|
|
scrollDirection: Axis.horizontal,
|
|
controller: _firstController,
|
|
itemCount: Hoarder.GamesJson.length,
|
|
itemBuilder: (BuildContext context, int index) {
|
|
return Card(
|
|
child: ClipRRect(
|
|
borderRadius: BorderRadius.circular(12),
|
|
child: Image.network(Hoarder.GamesJson[index]['icon'],
|
|
width: 100, height: 100),
|
|
),
|
|
);
|
|
}),
|
|
),
|
|
),
|
|
),
|
|
HomeCard(child: SizedBox(height: 250,), title: "Top Players"),
|
|
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SafeArea(
|
|
child: Scaffold(
|
|
// appBar: AppBar(title: Text('Faucet Hub'),),
|
|
|
|
body: bodyOptions.elementAt(selectedBotNavIndex),
|
|
bottomNavigationBar: BottomNavigationBar(
|
|
items: const <BottomNavigationBarItem>[
|
|
BottomNavigationBarItem(icon: Icon(Icons.home), label: "Home"),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.videogame_asset), label: "Games"),
|
|
BottomNavigationBarItem(
|
|
icon: Icon(Icons.account_balance_wallet), label: "Wallet"),
|
|
],
|
|
currentIndex: selectedBotNavIndex,
|
|
onTap: onBotNavTapped,
|
|
)),
|
|
);
|
|
}
|
|
|
|
static Widget HomeCard({required Widget child, required String title}) {
|
|
return Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: Card(
|
|
child: Container(
|
|
padding: EdgeInsets.symmetric(horizontal: 5, vertical: 10),
|
|
child: Column(children: [
|
|
Padding(
|
|
padding: const EdgeInsets.fromLTRB(8, 0, 8, 8),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.max,
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(
|
|
title,
|
|
style: TextStyle(fontSize: 17,fontWeight: FontWeight.bold),
|
|
),
|
|
Icon(Icons.arrow_right_alt)
|
|
],
|
|
),
|
|
),
|
|
child
|
|
]))));
|
|
}
|
|
|
|
void onBotNavTapped(int value) {
|
|
selectedBotNavIndex = value;
|
|
setState(() {});
|
|
}
|
|
}
|