import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:robo_advisory/models/wallet.dart'; import 'package:robo_advisory/theme/theme.dart'; class HomeScreen extends StatelessWidget { HomeScreen({@required this.toggleDrawer, @required this.wallet}); final Function toggleDrawer; final Wallet wallet; double calculatePercentage(double fullWidth, int percentValue) { return (percentValue / 100) * fullWidth; } @override Widget build(BuildContext context) { return SingleChildScrollView( child: Center( child: SafeArea( child: Padding( padding: AppTheme.padding, child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( 'Hi Johne', style: GoogleFonts.inter( textStyle: TextStyle( fontWeight: FontWeight.bold, fontSize: 36.0, color: Colors.black, ), ), ), GestureDetector( onTap: toggleDrawer, child: Icon(Icons.more_vert), ), ], ), SizedBox( height: 30.0, ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( alignment: Alignment.centerLeft, width: double.infinity, padding: EdgeInsets.all(20.0), color: Color(0xFFC4C4C4), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Total Assets', style: GoogleFonts.inter( textStyle: TextStyle( fontWeight: FontWeight.normal, fontSize: 16, color: Colors.black, ), ), ), Text( wallet.totalAssets, style: GoogleFonts.inter( textStyle: TextStyle( fontWeight: FontWeight.w600, fontSize: 45, color: Colors.black, ), ), ), ], ), ), Container( padding: EdgeInsets.only( left: 20.0, right: 20.0, top: 7.0, bottom: 7.0), color: Color(0xFFE5E5E5), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( 'TRY pool', style: GoogleFonts.inter( textStyle: TextStyle( fontWeight: FontWeight.normal, fontSize: 16, color: Colors.black, ), ), ), Text( wallet.totalTurkishLiraPool, style: GoogleFonts.inter( textStyle: TextStyle( fontWeight: FontWeight.normal, fontSize: 16, color: Colors.black, ), ), ), ], ), ), Container( padding: EdgeInsets.only( left: 20.0, right: 20.0, top: 7.0, bottom: 7.0), color: Color(0xFFC4C4C4), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( 'Total XAU grams', style: GoogleFonts.inter( textStyle: TextStyle( fontWeight: FontWeight.normal, fontSize: 16, color: Colors.black, ), ), ), Text( wallet.totalGoldInGram, style: GoogleFonts.inter( textStyle: TextStyle( fontWeight: FontWeight.normal, fontSize: 16, color: Colors.black, ), ), ), ], ), ), ], ), SizedBox( height: 30.0, ), Container( width: double.infinity, padding: EdgeInsets.only( left: 20.0, right: 20.0, top: 7.0, bottom: 20.0), color: Color(0xFFE5E5E5), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( 'Financial Health Stream', style: GoogleFonts.inter( textStyle: TextStyle( fontWeight: FontWeight.normal, fontSize: 16, color: Colors.black, ), ), ), SizedBox( height: 10.0, ), Row( children: [ SizedBox( width: calculatePercentage( MediaQuery.of(context).size.width - 100, 30), height: 5.0, child: const DecoratedBox( decoration: const BoxDecoration( color: Color(0xFF892626), ), ), ), SizedBox( width: calculatePercentage( MediaQuery.of(context).size.width - 100, 50), height: 5.0, child: const DecoratedBox( decoration: const BoxDecoration( color: Color(0xFF896126), ), ), ), SizedBox( width: calculatePercentage( MediaQuery.of(context).size.width - 100, 20), height: 5.0, child: const DecoratedBox( decoration: const BoxDecoration( color: Color(0xFF348926), ), ), ) ], ) ], ), ), SizedBox( height: 30.0, ), Column( children: [ Container( padding: EdgeInsets.only( left: 20.0, right: 20.0, top: 7.0, bottom: 7.0), color: Color(0xFFE5E5E5), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( 'TRY pool', style: GoogleFonts.inter( textStyle: TextStyle( fontWeight: FontWeight.normal, fontSize: 16, color: Colors.black, ), ), ), Text( wallet.totalGoldInTurkishLira, style: GoogleFonts.inter( textStyle: TextStyle( fontWeight: FontWeight.normal, fontSize: 16, color: Color(0xFF896126), ), ), ), ], ), ), Container( padding: EdgeInsets.only( left: 20.0, right: 20.0, top: 7.0, bottom: 7.0), color: Color(0xFFC4C4C4), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( 'Total XAU grams', style: GoogleFonts.inter( textStyle: TextStyle( fontWeight: FontWeight.normal, fontSize: 16, color: Colors.black, ), ), ), Text( wallet.totalGoldInGram, style: GoogleFonts.inter( textStyle: TextStyle( fontWeight: FontWeight.normal, fontSize: 16, color: Colors.black, ), ), ), ], ), ), ], ) ], ), ), ), ), ); } }