repo_id
stringlengths
21
168
file_path
stringlengths
36
210
content
stringlengths
1
9.98M
__index_level_0__
int64
0
0
mirrored_repositories/flutter_realestate/lib/view
mirrored_repositories/flutter_realestate/lib/view/screens/InvestScr.dart
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/src/widgets/framework.dart'; import 'package:flutter/src/widgets/placeholder.dart'; import 'package:flutter_realestate/view/widgets/BlogCards.dart'; import 'package:flutter_realestate/view/widgets/Customelevatedbuttons.dart'; import 'package:flutter_realestate/view/widgets/OADDcontainers.dart'; import 'package:flutter_realestate/view/widgets/gradientContainer.dart'; import 'package:flutter_realestate/view/widgets/investCards.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:flutter_realestate/view/widgets/textwidget.dart'; import 'package:flutter_realestate/view/widgets/constants.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class InvestScr extends StatefulWidget { const InvestScr({super.key}); @override State<InvestScr> createState() => _InvestScrState(); } class _InvestScrState extends State<InvestScr> { @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.white, body: SafeArea( child: ListView( children: [ Padding( padding: const EdgeInsets.only(left: 17, right: 14, top: 12), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const textwidget( txt: "Best investment in Pakistan", fontWeight: FontWeight.w700, color: Colors.black, fontsize: 23), const SizedBox( height: 4, ), const textwidget( txt: "100% Refundable, safe & secure investment", fontWeight: FontWeight.w600, color: Colors.black, fontsize: 16), const SizedBox( height: 4, ), const textwidget( txt: "Our criteria to choose best projects", fontWeight: FontWeight.w400, color: Colors.black, fontsize: 15), const SizedBox( height: 29, ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: const [ OADDcontainers(mainLetter: "O", mainStr: "Ownership"), OADDcontainers(mainLetter: "A", mainStr: "Approval"), OADDcontainers(mainLetter: "D", mainStr: "Demand"), OADDcontainers(mainLetter: "D", mainStr: "Delivery"), ], ), const SizedBox( height: 29, ), const textwidget( txt: "See more", fontWeight: FontWeight.w700, color: brownClr, fontsize: 18), const SizedBox( height: 10, ), const textwidget( txt: "Projects in Pakistan", fontWeight: FontWeight.w700, color: Colors.black, fontsize: 23), const SizedBox( height: 20, ), InvestCards( image: Image.asset("assets/images/Rectangle 160 (1).png"), price: "38 Lac (PKR) - 4.03 Crore (PKR)", title: "Mega Project", ), const SizedBox( height: 20, ), InvestCards( image: Image.asset("assets/images/buildings.png"), price: "1.03 Crore (PKR) - 4.03 Crore (PKR)", title: "Project", ), const SizedBox( height: 20, ), InvestCards( image: Image.asset("assets/images/Rectangle 160 (1).png"), price: "38 Lac (PKR) - 4.03 Crore (PKR)", title: "Mega Project", ), const SizedBox( height: 20, ), InvestCards( image: Image.asset("assets/images/buildings.png"), price: "1.03 Crore (PKR) - 4.03 Crore (PKR)", title: "Project", ), const SizedBox( height: 20, ), InvestCards( image: Image.asset( "assets/images/Rectangle 160 (1).png", ), price: "38 Lac (PKR) - 4.03 Crore (PKR)", title: "Mega Project", ), ], ), ) ], )), ); } }
0
mirrored_repositories/flutter_realestate/lib/view
mirrored_repositories/flutter_realestate/lib/view/screens/HomeScr.dart
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/src/widgets/framework.dart'; import 'package:flutter/src/widgets/placeholder.dart'; import 'package:flutter_realestate/view/screens/filtersScr.dart'; import 'package:flutter_realestate/view/screens/rentScr.dart'; import 'package:flutter_realestate/view/widgets/BlogCards.dart'; import 'package:flutter_realestate/view/widgets/gradientContainer.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:flutter_realestate/view/widgets/textwidget.dart'; import 'package:flutter_realestate/view/widgets/constants.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'dart:math' as math; class HomeScr extends StatefulWidget { const HomeScr({super.key}); @override State<HomeScr> createState() => _HomeScrState(); } class _HomeScrState extends State<HomeScr> { @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.white, body: ListView( children: [ Column( children: [ Padding( padding: const EdgeInsets.only(top: 14, right: 8, left: 14), child: Row( children: [ GestureDetector( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => filtersScr(), )); }, child: const gradientContainer( colorMain: Color.fromARGB(255, 43, 77, 106), txt: "Rent", icon: Icon(FontAwesomeIcons.userGroup, color: Colors.white, size: 45), color1: Color.fromARGB(255, 69, 204, 222), color2: Color.fromARGB(255, 210, 225, 252)), ), const SizedBox( width: 17, ), GestureDetector( onTap: () { Navigator.push( context, MaterialPageRoute( builder: (context) => filtersScr(), )); }, child: const gradientContainer( colorMain: Color.fromARGB(255, 81, 58, 34), txt: "Buy", icon: Icon( FontAwesomeIcons.play, size: 50, color: Colors.white, ), color1: Color.fromARGB(249, 249, 149, 67), color2: Color.fromARGB(249, 255, 185, 119)), ) ], ), ), const SizedBox( height: 20, ), Padding( padding: const EdgeInsets.only(top: 14, right: 8, left: 14), child: Row( children: const [ gradientContainer( icon: Icon( Icons.abc, size: 1, ), txt: "Rent Out", color1: Color.fromARGB(255, 73, 146, 206), color2: Color.fromARGB(255, 206, 219, 243), colorMain: Color.fromARGB(255, 30, 70, 105)), SizedBox( width: 17, ), gradientContainer( colorMain: Color.fromARGB(255, 40, 52, 101), txt: "Sell", icon: Icon( FontAwesomeIcons.moneyBill, size: 45, color: Colors.white, ), color1: Color.fromARGB(248, 93, 138, 252), color2: Color.fromARGB(248, 170, 177, 250)) ], ), ), const SizedBox( height: 25, ), LayoutBuilder(builder: (context, constraint) { if (constraint.maxWidth < 400) { return Container( height: MediaQuery.of(context).size.height * 0.2, width: MediaQuery.of(context).size.width * 0.94, decoration: BoxDecoration( boxShadow: [ BoxShadow( offset: Offset(-4, 4), blurRadius: 2, blurStyle: BlurStyle.normal, color: Colors.grey.shade400, spreadRadius: 1.5) ], borderRadius: BorderRadius.circular(13), gradient: const LinearGradient( colors: [ Color.fromARGB(255, 255, 107, 191), Color.fromARGB(255, 254, 166, 196) ], begin: Alignment.topLeft, end: Alignment.bottomRight, stops: [0.3, 1.0]), ), child: Stack( children: [ const Positioned( top: 13, left: 15, child: textwidget( txt: "Wanted", fontWeight: FontWeight.w700, color: Colors.white, fontsize: 27), ), const Positioned( top: 45, left: 15, child: textwidget( txt: "Don’t want the hassle?\nGet in touch", fontWeight: FontWeight.w400, color: Colors.white, fontsize: 16), ), Positioned( bottom: 45, right: 170, child: Transform.rotate( angle: -45 * math.pi / 180, child: const Icon( FontAwesomeIcons.home, color: Color.fromARGB(255, 84, 57, 49), size: 20, )), ), Positioned( bottom: 95, right: 130, child: Transform.rotate( angle: 0 * math.pi / 180, child: const Icon( FontAwesomeIcons.home, color: Color.fromARGB(255, 84, 57, 49), size: 20, )), ), Positioned( bottom: 45, right: 125, child: Transform.rotate( angle: -45 * math.pi / 180, child: const Icon( FontAwesomeIcons.home, color: Colors.white, size: 35, )), ), Positioned( bottom: 2, right: 15, child: Image.asset( "assets/images/Group 2.png", )) ], ), ); } else { return Container( height: MediaQuery.of(context).size.height * 0.27, width: MediaQuery.of(context).size.width * 0.92, decoration: BoxDecoration( boxShadow: [ BoxShadow( offset: Offset(-4, 4), blurRadius: 2, blurStyle: BlurStyle.normal, color: Colors.grey.shade400, spreadRadius: 1.5) ], borderRadius: BorderRadius.circular(13), gradient: const LinearGradient( colors: [ Color.fromARGB(255, 255, 107, 191), Color.fromARGB(255, 254, 166, 196) ], begin: Alignment.topLeft, end: Alignment.bottomRight, stops: [0.3, 1.0]), ), child: Stack( children: [ const Positioned( top: 13, left: 15, child: textwidget( txt: "Wanted", fontWeight: FontWeight.w700, color: Colors.white, fontsize: 27), ), const Positioned( top: 45, left: 15, child: textwidget( txt: "Don’t want the hassle? Get in touch", fontWeight: FontWeight.w400, color: Colors.white, fontsize: 16), ), Positioned( bottom: 30, right: 210, child: Transform.rotate( angle: -45 * math.pi / 180, child: const Icon( FontAwesomeIcons.home, color: Color.fromARGB(255, 84, 57, 49), size: 20, )), ), Positioned( bottom: 55, right: 145, child: Transform.rotate( angle: 0 * math.pi / 180, child: const Icon( FontAwesomeIcons.home, color: Color.fromARGB(255, 84, 57, 49), size: 20, )), ), Positioned( bottom: 15, right: 160, child: Transform.rotate( angle: -45 * math.pi / 180, child: const Icon( FontAwesomeIcons.home, color: Colors.white, size: 35, )), ), Positioned( bottom: 0, right: 15, child: Image.asset( "assets/images/Group 2.png", )) ], ), ); } }), const SizedBox( height: 30, ), Padding( padding: const EdgeInsets.only(left: 15, right: 15), child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.start, children: const [ textwidget( txt: "Hot Deals 🔥", fontWeight: FontWeight.w600, color: Colors.black, fontsize: 27), ], ), const SizedBox( height: 20, ), Stack( children: [ ClipRRect( borderRadius: BorderRadius.circular(15), child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(13)), height: MediaQuery.of(context).size.height * 0.3, width: MediaQuery.of(context).size.width * 0.95, child: Image.asset( "assets/images/Rectangle 155.png", fit: BoxFit.fitWidth, ), ), ), Positioned( top: MediaQuery.of(context).size.height * 0.03, left: MediaQuery.of(context).size.width * 0.04, child: Container( height: MediaQuery.of(context).size.height * 0.05, width: MediaQuery.of(context).size.width * 0.22, decoration: BoxDecoration( borderRadius: BorderRadius.circular(10), color: Colors.transparent, border: Border.all( color: Colors.white, width: 2)), child: const Center( child: textwidget( txt: "Mall Of Arabia", fontWeight: FontWeight.w700, color: Colors.white, fontsize: 11), ), ), ), Positioned( top: MediaQuery.of(context).size.height * 0.09, left: MediaQuery.of(context).size.width * 0.05, child: const textwidget( txt: "Starting From", fontWeight: FontWeight.w700, color: Colors.white, fontsize: 14), ), Positioned( top: MediaQuery.of(context).size.height * 0.117, left: MediaQuery.of(context).size.width * 0.08, child: RichText( text: TextSpan( text: "PKR", style: GoogleFonts.openSans( fontWeight: FontWeight.w700, fontSize: 11, color: Colors.yellow), children: [ TextSpan( text: " 36 ", style: GoogleFonts.openSans( fontWeight: FontWeight.w800, fontSize: 14, color: Colors.yellow)), TextSpan( text: "lac", style: GoogleFonts.openSans( fontWeight: FontWeight.w800, fontSize: 11, color: Colors.yellow)) ])), ), Positioned( top: MediaQuery.of(context).size.height * 0.02, right: MediaQuery.of(context).size.width * 0.04, child: const textwidget( txt: "Glimpse Of \n mid - century", fontWeight: FontWeight.w700, color: Colors.white, fontsize: 17), ), Positioned( top: MediaQuery.of(context).size.height * 0.095, right: MediaQuery.of(context).size.width * 0.07, child: const textwidget( txt: " Arabian\n architecture", fontWeight: FontWeight.w400, color: Colors.white, fontsize: 16), ), ], ) ], ), ), const SizedBox( height: 35, ), Container( height: MediaQuery.of(context).size.width < 400 ? MediaQuery.of(context).size.height * 0.48 : MediaQuery.of(context).size.height * 0.59, width: double.infinity, color: Colors.grey.shade200, child: Column( children: [ Padding( padding: const EdgeInsets.only(top: 15, left: 14, right: 14), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: const [ textwidget( txt: "Area Guide", fontWeight: FontWeight.w600, color: Colors.black, fontsize: 27), textwidget( txt: "View All", fontWeight: FontWeight.w400, color: brownClr, fontsize: 15) ], ), ), const SizedBox( height: 31, ), Stack( children: [ ClipRRect( borderRadius: BorderRadius.circular(13), child: Container( height: MediaQuery.of(context).size.width < 400 ? MediaQuery.of(context).size.height * 0.31 : MediaQuery.of(context).size.height * 0.35, width: MediaQuery.of(context).size.width * 0.95, child: Image.asset( "assets/images/qasim-nagori-1x3qakkpzZU-unsplash.jpg", fit: BoxFit.cover, ), ), ), const Positioned( bottom: 50, left: 10, child: textwidget( txt: "Moving to capital?", fontWeight: FontWeight.w900, color: Colors.white, fontsize: 24), ), const Positioned( bottom: 34, left: 10, child: textwidget( txt: "Scroll through the area lines to..", fontWeight: FontWeight.w600, color: Colors.white, fontsize: 13), ) ], ) ], ), ), const SizedBox( height: 30, ), Column( children: [ Padding( padding: const EdgeInsets.only(left: 15, right: 15), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: const [ textwidget( txt: "Blogs", fontWeight: FontWeight.w600, color: Colors.black, fontsize: 27), textwidget( txt: "View All", fontWeight: FontWeight.w400, color: brownClr, fontsize: 15) ], ), ), SingleChildScrollView( scrollDirection: Axis.horizontal, child: Padding( padding: const EdgeInsets.all(10.0), child: Row( children: [ BlogCards( img: Image.asset( "assets/images/Rectangle 160.png"), title: "List of tallest building in Pakistan", date: "20 May 2022"), BlogCards( img: Image.asset( "assets/images/Rectangle 160.png", ), title: "Investing in a trust fund", date: "7 april 2022"), BlogCards( img: Image.asset( "assets/images/Rectangle 160.png", ), title: "Investing in a trust fund", date: "7 april 2022"), BlogCards( img: Image.asset( "assets/images/Rectangle 160.png", ), title: "Investing in a trust fund", date: "7 april 2022"), BlogCards( img: Image.asset( "assets/images/Rectangle 160.png", ), title: "Investing in a trust fund", date: "7 april 2022"), ], ), ), ) ], ), ], ), ], )); } }
0
mirrored_repositories/flutter_realestate/lib/view
mirrored_repositories/flutter_realestate/lib/view/screens/buyScr.dart
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/src/widgets/framework.dart'; import 'package:flutter/src/widgets/placeholder.dart'; import 'package:flutter_realestate/view/screens/GridViewFiltersScr.dart'; import 'package:flutter_realestate/view/widgets/ApplyButtonFilterScr.dart'; import 'package:flutter_realestate/view/widgets/BlogCards.dart'; import 'package:flutter_realestate/view/widgets/FiltersTextFields.dart'; import 'package:flutter_realestate/view/widgets/RowWithRangeSlider.dart'; import 'package:flutter_realestate/view/widgets/filterTextFieldsKanal.dart'; // import 'package:flutter_realestate/view/widgets/filterTabBar.dart'; import 'package:flutter_realestate/view/widgets/gradientContainer.dart'; import 'package:flutter_realestate/view/widgets/outlinedContainer.dart'; import 'package:flutter_realestate/view/widgets/rangeSlider.dart'; import 'package:flutter_realestate/view/widgets/slider.dart'; import 'package:flutter_realestate/view/widgets/switchListTile.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:flutter_realestate/view/widgets/textwidget.dart'; import 'package:flutter_realestate/view/widgets/constants.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class buyScr extends StatefulWidget { const buyScr({super.key}); @override State<buyScr> createState() => _buyScrState(); } class _buyScrState extends State<buyScr> with TickerProviderStateMixin { List dropDownItemsList = [ {"title": "Islamabad", "value": "1"}, {"title": "Karachi", "value": "2"}, {"title": "Lahore", "value": "3"}, ]; String selectedCityVal = ""; List dropDownItemsList1 = [ {"title": "DHA", "value": "1"}, {"title": "Gulshan", "value": "2"}, {"title": "Gulmohar", "value": "3"}, ]; String selectedAreaVal = ""; // double _value = 20; double _startValue = 0.0; double _endValue = 100.0; // RangeValues valuesBottom = RangeValues(0, 2); bool myVal = true; double sliderVal = 80; @override Widget build(BuildContext context) { TabController tabController = TabController(length: 3, vsync: this); var height = MediaQuery.of(context).size.height; var width = MediaQuery.of(context).size.width; return Scaffold( backgroundColor: Colors.white, body: SafeArea( child: ListView( children: [ Padding( padding: const EdgeInsets.all(12.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const textwidget( txt: "City", fontWeight: FontWeight.w700, color: Colors.black, fontsize: 20), SizedBox( height: 20, ), InputDecorator( decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.circular(15), borderSide: BorderSide(color: brownClr, width: 0.5), ), contentPadding: EdgeInsets.only(left: 7, right: 7, top: 5)), child: DropdownButtonHideUnderline( child: DropdownButton<String>( value: selectedCityVal, items: [ DropdownMenuItem( child: Text( "Select City", style: TextStyle(color: Colors.grey.shade600), ), value: "", ), ...dropDownItemsList.map<DropdownMenuItem<String>>((e) { return DropdownMenuItem( child: Text( e['title'], ), value: e['value'], ); }).toList(), ], onChanged: (value) { setState(() { selectedCityVal = value!; }); }, ), ), ), SizedBox( height: height * 0.05, ), Container( height: 1, width: double.infinity, color: Colors.grey.shade400, ), SizedBox( height: 20, ), const textwidget( txt: "Area", fontWeight: FontWeight.w700, color: Colors.black, fontsize: 20), SizedBox( height: 20, ), InputDecorator( decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.circular(15), borderSide: BorderSide(color: brownClr, width: 0.5), ), contentPadding: EdgeInsets.only(left: 7, right: 7, top: 5)), child: DropdownButtonHideUnderline( child: DropdownButton<String>( value: selectedAreaVal, items: [ DropdownMenuItem( child: Text("Select Area", style: TextStyle(color: Colors.grey.shade600)), value: "", ), ...dropDownItemsList1 .map<DropdownMenuItem<String>>((e) { return DropdownMenuItem( child: Text( e['title'], ), value: e['value'], ); }).toList(), ], onChanged: (value) { setState(() { selectedAreaVal = value!; }); }, ), ), ), SizedBox( height: height * 0.05, ), Container( height: 1, width: double.infinity, color: Colors.grey.shade400, ), const SizedBox( height: 20, ), const textwidget( txt: "Price (Rs)", fontWeight: FontWeight.w700, color: Colors.black, fontsize: 20), const SizedBox( height: 20, ), Row( mainAxisAlignment: MainAxisAlignment.center, children: const [ textwidget( txt: "100k 200k 300k 400k 500k", fontWeight: FontWeight.w400, color: Colors.black, fontsize: 15) ], ), rangeSlider(), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: const [ Padding( padding: EdgeInsets.all(8.0), child: textwidget( txt: "From", fontWeight: FontWeight.w600, color: Colors.black, fontsize: 16), ), FiltersTextFields(), ], ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: const [ Padding( padding: EdgeInsets.all(8.0), child: textwidget( txt: "To", fontWeight: FontWeight.w600, color: Colors.black, fontsize: 16), ), FiltersTextFields(), ], ), ], ), SizedBox( height: height * 0.04, ), Container( height: 1, width: double.infinity, color: Colors.grey.shade400, ), const SizedBox( height: 20, ), const textwidget( txt: "Property type", fontWeight: FontWeight.w700, color: Colors.black, fontsize: 20), TabBar( indicatorColor: brownClr, labelColor: brownClr, unselectedLabelColor: Colors.grey.shade700, controller: tabController, tabs: const [ Tab( text: "Residential", ), Tab( text: "Commercial", ), Tab( text: "Plots", ), ]), SizedBox( height: height * 0.02, ), Container( height: width < 400 ? height * 0.75 : height * 0.9, width: width * 0.9, // color: Colors.brown, child: TabBarView(controller: tabController, children: [ GridViewFilterScr(), Container( color: Colors.amber, ), Container( color: Colors.green, ), ]), ), // SizedBox( // height: height * 0.03, // ), Container( height: 1, width: double.infinity, color: Colors.grey.shade400, ), const SizedBox( height: 20, ), const Padding( padding: EdgeInsets.all(8.0), child: textwidget( txt: "Size", fontWeight: FontWeight.w700, color: Colors.black, fontsize: 20), ), // const SizedBox( // height: 20, // ), Padding( padding: EdgeInsets.all(8.0), child: Center( child: SizedBox( width: width * 0.8, child: filterTextFieldsKanal()), ), ), SizedBox( height: height * 0.04, ), RowWithRangeSlider(), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ const Padding( padding: EdgeInsets.all(8.0), child: textwidget( txt: "From", fontWeight: FontWeight.w600, color: Colors.black, fontsize: 16), ), SizedBox( width: width * 0.4, child: filterTextFieldsKanal()) ], ), Column( children: [ const Padding( padding: EdgeInsets.all(8.0), child: textwidget( txt: "To", fontWeight: FontWeight.w600, color: Colors.black, fontsize: 16), ), SizedBox( width: width * 0.4, child: filterTextFieldsKanal()) ], ) ], ), SizedBox( height: height * 0.03, ), Container( height: 1, width: double.infinity, color: Colors.grey.shade400, ), const SizedBox( height: 20, ), const Padding( padding: EdgeInsets.all(8.0), child: textwidget( txt: "Bedrooms", fontWeight: FontWeight.w700, color: Colors.black, fontsize: 20), ), SizedBox( height: height * 0.04, ), RowWithRangeSlider(), SizedBox( height: height * 0.03, ), Container( height: 1, width: double.infinity, color: Colors.grey.shade400, ), const SizedBox( height: 20, ), const Padding( padding: EdgeInsets.all(8.0), child: textwidget( txt: "Baths", fontWeight: FontWeight.w700, color: Colors.black, fontsize: 20), ), SizedBox( height: height * 0.04, ), RowWithRangeSlider(), SizedBox( height: height * 0.03, ), Container( height: 1, width: double.infinity, color: Colors.grey.shade400, ), // const SizedBox( // height: 20, // ), switchListTile(), Container( height: 1, width: double.infinity, color: Colors.grey.shade400, ), const SizedBox( height: 20, ), const textwidget( txt: "Age of Property", fontWeight: FontWeight.w700, color: Colors.black, fontsize: 19), SizedBox( height: height * 0.04, ), Center( child: SizedBox( width: width * 0.7, child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ textwidget( txt: "<1 year", fontWeight: FontWeight.w600, color: Colors.grey.shade500, fontsize: 12), textwidget( txt: "<1 year", fontWeight: FontWeight.w600, color: Colors.grey.shade500, fontsize: 12), textwidget( txt: "<1 year", fontWeight: FontWeight.w600, color: Colors.grey.shade500, fontsize: 12), ], ), slider(), ], ), ), ), SizedBox( height: height * 0.03, ), Container( height: 1, width: double.infinity, color: Colors.grey.shade400, ), const SizedBox( height: 20, ), const textwidget( txt: "Days On Graana", fontWeight: FontWeight.w700, color: Colors.black, fontsize: 19), SizedBox( height: height * 0.04, ), Center( child: SizedBox( width: width * 0.7, child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ textwidget( txt: "<7", fontWeight: FontWeight.w600, color: Colors.grey.shade500, fontsize: 12), textwidget( txt: "<15", fontWeight: FontWeight.w600, color: Colors.grey.shade500, fontsize: 12), textwidget( txt: "<30", fontWeight: FontWeight.w600, color: Colors.grey.shade500, fontsize: 12), textwidget( txt: "<90", fontWeight: FontWeight.w600, color: Colors.grey.shade500, fontsize: 12), ], ), slider(), ], ), ), ), SizedBox( height: height * 0.03, ), Container( height: 1, width: double.infinity, color: Colors.grey.shade400, ), const SizedBox( height: 20, ), const textwidget( txt: "Utilities", fontWeight: FontWeight.w700, color: Colors.black, fontsize: 19), SizedBox( height: height * 0.02, ), Wrap( spacing: width * 0.04, runSpacing: height * 0.02, children: [ outlinedContainer( icon: Icon( Icons.electric_bolt_outlined, size: 15, color: Colors.grey.shade600, ), txt: "Electricity"), outlinedContainer( icon: Icon( FontAwesomeIcons.fire, size: 15, color: Colors.grey.shade600, ), txt: "Gas"), outlinedContainer( icon: Icon( FontAwesomeIcons.screwdriver, size: 15, color: Colors.grey.shade600, ), txt: "Maintenece"), outlinedContainer( icon: Icon( FontAwesomeIcons.droplet, size: 15, color: Colors.grey.shade600, ), txt: "Water"), ], ), SizedBox( height: height * 0.03, ), Container( height: 1, width: double.infinity, color: Colors.grey.shade400, ), const SizedBox( height: 20, ), const textwidget( txt: "Features", fontWeight: FontWeight.w700, color: Colors.black, fontsize: 19), SizedBox( height: height * 0.02, ), Wrap( spacing: width * 0.04, runSpacing: height * 0.02, children: [ outlinedContainer( icon: Icon( Icons.person_pin_circle_sharp, size: 16, color: Colors.grey.shade600, ), txt: "Accessbility"), outlinedContainer( icon: Icon( FontAwesomeIcons.building, size: 15, color: Colors.grey.shade600, ), txt: "Balcony"), ], ), SizedBox( height: height * 0.02, ), Center(child: ApplyButtonFilterScr()) ], ), ) ], )), ); } }
0
mirrored_repositories/flutter_realestate/lib/view
mirrored_repositories/flutter_realestate/lib/view/screens/inquiries.dart
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/src/widgets/framework.dart'; import 'package:flutter/src/widgets/placeholder.dart'; import 'package:flutter_realestate/view/screens/HomeScr.dart'; import 'package:flutter_realestate/view/screens/InvestScr.dart'; import 'package:flutter_realestate/view/widgets/SignUpButtons.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:flutter_realestate/view/widgets/textwidget.dart'; import 'package:flutter_realestate/view/widgets/constants.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class Inquiries extends StatefulWidget { const Inquiries({super.key}); @override State<Inquiries> createState() => _InquiriesState(); } class _InquiriesState extends State<Inquiries> { @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.white, body: SafeArea( child: ListView( children: [ Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ Padding( padding: const EdgeInsets.only(top: 15), child: Center( child: SizedBox( height: MediaQuery.of(context).size.height * 0.1, width: MediaQuery.of(context).size.width * 0.9, child: TextField( decoration: InputDecoration( hintText: "Email address or Phone", hintStyle: GoogleFonts.poppins( fontWeight: FontWeight.w400, fontSize: 16, color: Colors.grey.shade700), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(13), borderSide: BorderSide( color: Colors.grey.shade700, width: 1)), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(13), borderSide: BorderSide(color: brownClr, width: 1))), ), ), ), ), SizedBox( height: MediaQuery.of(context).size.width < 400 ? 0 : 15, ), Padding( padding: const EdgeInsets.only(top: 12), child: Center( child: SizedBox( height: MediaQuery.of(context).size.height * 0.1, width: MediaQuery.of(context).size.width * 0.9, child: TextField( decoration: InputDecoration( suffixIcon: Icon(FontAwesomeIcons.solidEye), hintText: "Password", hintStyle: GoogleFonts.poppins( fontWeight: FontWeight.w400, fontSize: 16, color: Colors.grey.shade700), enabledBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(13), borderSide: BorderSide( color: Colors.grey.shade700, width: 1)), focusedBorder: OutlineInputBorder( borderRadius: BorderRadius.circular(13), borderSide: const BorderSide(color: brownClr, width: 1))), ), ), ), ), SizedBox( height: MediaQuery.of(context).size.width < 400 ? 0 : 15, ), Padding( padding: const EdgeInsets.only(top: 10), child: SizedBox( height: MediaQuery.of(context).size.width < 400 ? MediaQuery.of(context).size.height * 0.07 : MediaQuery.of(context).size.height * 0.1, width: MediaQuery.of(context).size.width * 0.9, child: ClipRRect( borderRadius: BorderRadius.circular(15), child: ElevatedButton( style: ElevatedButton.styleFrom( backgroundColor: brownClr, elevation: 0), onPressed: () {}, child: const textwidget( txt: "Sign in", fontWeight: FontWeight.w600, color: Colors.white, fontsize: 23)), ), ), ), const SizedBox( height: 35, ), const textwidget( txt: "Forgot Password?", fontWeight: FontWeight.w600, color: brownClr, fontsize: 23), const SizedBox( height: 45, ), Row( children: [ // Container( // height: 1, // width: MediaQuery.of(context).size.width < 400 // ? MediaQuery.of(context).size.width * 0.3 // : MediaQuery.of(context).size.width * 0.37, // color: Colors.grey.shade500, // ), Flexible( child: Container( height: 1, color: Colors.grey.shade500, )), textwidget( txt: " Or Sign In With ", fontWeight: FontWeight.w400, color: Colors.grey.shade600, fontsize: 18), // Container( // height: 1, // width: MediaQuery.of(context).size.width < 400 // ? MediaQuery.of(context).size.width * 0.29 // : MediaQuery.of(context).size.width * 0.375, // color: Colors.grey.shade500, // ), Flexible( child: Container( height: 1, color: Colors.grey.shade500, )) ], ), const SizedBox( height: 45, ), Row( mainAxisAlignment: MainAxisAlignment.spaceAround, children: const [ SignUpButtons( icon: Icon(FontAwesomeIcons.google, size: 25, color: brownClr), txt: "Google"), SignUpButtons( icon: Icon(FontAwesomeIcons.facebook, size: 25, color: brownClr), txt: "Facebook"), ], ), const SizedBox( height: 45, ), RichText( text: TextSpan( text: "Don’t have an account?", style: GoogleFonts.montserrat( fontSize: 18, color: Colors.black, fontWeight: FontWeight.w600), children: [ TextSpan( text: "SignUp", style: GoogleFonts.montserrat( fontSize: 18, color: brownClr, fontWeight: FontWeight.w600), ) ]), ) ], ) ], )), ); } }
0
mirrored_repositories/flutter_realestate/lib/view
mirrored_repositories/flutter_realestate/lib/view/screens/CompanyName.dart
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/src/widgets/framework.dart'; import 'package:flutter/src/widgets/placeholder.dart'; import 'package:flutter_realestate/view/screens/HomeScr.dart'; import 'package:flutter_realestate/view/screens/InvestScr.dart'; import 'package:flutter_realestate/view/screens/inquiries.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:flutter_realestate/view/widgets/textwidget.dart'; import 'package:flutter_realestate/view/widgets/constants.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class CompanyName extends StatefulWidget { const CompanyName({super.key}); @override State<CompanyName> createState() => _CompanyNameState(); } class _CompanyNameState extends State<CompanyName> { int myIndex = 0; PageController pageController = PageController(); void ontapped(int index) { setState(() { myIndex = index; }); pageController.jumpToPage(index); } @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.white, appBar: AppBar( leading: const Icon( CupertinoIcons.line_horizontal_3, color: Colors.black, size: 29, ), backgroundColor: Colors.white, elevation: 0, shadowColor: Colors.transparent, title: const textwidget( txt: "Company Name", fontWeight: FontWeight.w700, color: brownClr, fontsize: 23), centerTitle: true, ), bottomNavigationBar: BottomNavigationBar( onTap: ontapped, currentIndex: myIndex, backgroundColor: Colors.white, elevation: 0, selectedItemColor: brownClr, items: const [ BottomNavigationBarItem( icon: Icon( FontAwesomeIcons.home, ), label: "Home"), BottomNavigationBarItem( icon: Icon(FontAwesomeIcons.arrowTrendUp), label: "Invest"), BottomNavigationBarItem( icon: Icon(CupertinoIcons.question_circle_fill), label: "Inquiries"), ]), body: PageView( controller: pageController, children: [HomeScr(), InvestScr(), Inquiries()], ), ); } }
0
mirrored_repositories/flutter_realestate
mirrored_repositories/flutter_realestate/test/widget_test.dart
// This is a basic Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility in the flutter_test package. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_realestate/main.dart'; void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. await tester.pumpWidget(const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget); expect(find.text('1'), findsNothing); // Tap the '+' icon and trigger a frame. await tester.tap(find.byIcon(Icons.add)); await tester.pump(); // Verify that our counter has incremented. expect(find.text('0'), findsNothing); expect(find.text('1'), findsOneWidget); }); }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/init_services_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/init_services_demo/lib/main.dart
import 'package:flutter/material.dart'; import 'src/app.dart'; import 'src/settings/settings_controller.dart'; import 'src/settings/settings_service.dart'; void main() async { // Set up the SettingsController, which will glue user settings to multiple // Flutter Widgets. final settingsController = SettingsController(SettingsService()); // Load the user's preferred theme while the splash screen is displayed. // This prevents a sudden theme change when the app is first displayed. await settingsController.loadSettings(); // Run the app and pass in the SettingsController. The app listens to the // SettingsController for changes, then passes it further down to the // SettingsView. runApp(MyApp(settingsController: settingsController)); }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/init_services_demo/lib
mirrored_repositories/flutter_bytes_devops/code_infrastructure/init_services_demo/lib/src/app.dart
import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'sample_feature/sample_item_details_view.dart'; import 'sample_feature/sample_item_list_view.dart'; import 'settings/settings_controller.dart'; import 'settings/settings_view.dart'; /// The Widget that configures your application. class MyApp extends StatelessWidget { const MyApp({ super.key, required this.settingsController, }); final SettingsController settingsController; @override Widget build(BuildContext context) { // Glue the SettingsController to the MaterialApp. // // The ListenableBuilder Widget listens to the SettingsController for changes. // Whenever the user updates their settings, the MaterialApp is rebuilt. return ListenableBuilder( listenable: settingsController, builder: (BuildContext context, Widget? child) { return MaterialApp( // Providing a restorationScopeId allows the Navigator built by the // MaterialApp to restore the navigation stack when a user leaves and // returns to the app after it has been killed while running in the // background. restorationScopeId: 'app', // Provide the generated AppLocalizations to the MaterialApp. This // allows descendant Widgets to display the correct translations // depending on the user's locale. localizationsDelegates: const [ AppLocalizations.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, ], supportedLocales: const [ Locale('en', ''), // English, no country code ], // Use AppLocalizations to configure the correct application title // depending on the user's locale. // // The appTitle is defined in .arb files found in the localization // directory. onGenerateTitle: (BuildContext context) => AppLocalizations.of(context)!.appTitle, // Define a light and dark color theme. Then, read the user's // preferred ThemeMode (light, dark, or system default) from the // SettingsController to display the correct theme. theme: ThemeData(), darkTheme: ThemeData.dark(), themeMode: settingsController.themeMode, // Define a function to handle named routes in order to support // Flutter web url navigation and deep linking. onGenerateRoute: (RouteSettings routeSettings) { return MaterialPageRoute<void>( settings: routeSettings, builder: (BuildContext context) { switch (routeSettings.name) { case SettingsView.routeName: return SettingsView(controller: settingsController); case SampleItemDetailsView.routeName: return const SampleItemDetailsView(); case SampleItemListView.routeName: default: return const SampleItemListView(); } }, ); }, ); }, ); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/init_services_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/init_services_demo/lib/src/settings/settings_controller.dart
import 'package:flutter/material.dart'; import 'settings_service.dart'; /// A class that many Widgets can interact with to read user settings, update /// user settings, or listen to user settings changes. /// /// Controllers glue Data Services to Flutter Widgets. The SettingsController /// uses the SettingsService to store and retrieve user settings. class SettingsController with ChangeNotifier { SettingsController(this._settingsService); // Make SettingsService a private variable so it is not used directly. final SettingsService _settingsService; // Make ThemeMode a private variable so it is not updated directly without // also persisting the changes with the SettingsService. late ThemeMode _themeMode; // Allow Widgets to read the user's preferred ThemeMode. ThemeMode get themeMode => _themeMode; /// Load the user's settings from the SettingsService. It may load from a /// local database or the internet. The controller only knows it can load the /// settings from the service. Future<void> loadSettings() async { _themeMode = await _settingsService.themeMode(); // Important! Inform listeners a change has occurred. notifyListeners(); } /// Update and persist the ThemeMode based on the user's selection. Future<void> updateThemeMode(ThemeMode? newThemeMode) async { if (newThemeMode == null) return; // Do not perform any work if new and old ThemeMode are identical if (newThemeMode == _themeMode) return; // Otherwise, store the new ThemeMode in memory _themeMode = newThemeMode; // Important! Inform listeners a change has occurred. notifyListeners(); // Persist the changes to a local database or the internet using the // SettingService. await _settingsService.updateThemeMode(newThemeMode); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/init_services_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/init_services_demo/lib/src/settings/settings_view.dart
import 'package:flutter/material.dart'; import 'settings_controller.dart'; /// Displays the various settings that can be customized by the user. /// /// When a user changes a setting, the SettingsController is updated and /// Widgets that listen to the SettingsController are rebuilt. class SettingsView extends StatelessWidget { const SettingsView({super.key, required this.controller}); static const routeName = '/settings'; final SettingsController controller; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Settings'), ), body: Padding( padding: const EdgeInsets.all(16), // Glue the SettingsController to the theme selection DropdownButton. // // When a user selects a theme from the dropdown list, the // SettingsController is updated, which rebuilds the MaterialApp. child: DropdownButton<ThemeMode>( // Read the selected themeMode from the controller value: controller.themeMode, // Call the updateThemeMode method any time the user selects a theme. onChanged: controller.updateThemeMode, items: const [ DropdownMenuItem( value: ThemeMode.system, child: Text('System Theme'), ), DropdownMenuItem( value: ThemeMode.light, child: Text('Light Theme'), ), DropdownMenuItem( value: ThemeMode.dark, child: Text('Dark Theme'), ) ], ), ), ); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/init_services_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/init_services_demo/lib/src/settings/settings_service.dart
import 'package:flutter/material.dart'; /// A service that stores and retrieves user settings. /// /// By default, this class does not persist user settings. If you'd like to /// persist the user settings locally, use the shared_preferences package. If /// you'd like to store settings on a web server, use the http package. class SettingsService { /// Loads the User's preferred ThemeMode from local or remote storage. Future<ThemeMode> themeMode() async => ThemeMode.system; /// Persists the user's preferred ThemeMode to local or remote storage. Future<void> updateThemeMode(ThemeMode theme) async { // Use the shared_preferences package to persist settings locally or the // http package to persist settings over the network. } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/init_services_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/init_services_demo/lib/src/sample_feature/sample_item_details_view.dart
import 'package:flutter/material.dart'; /// Displays detailed information about a SampleItem. class SampleItemDetailsView extends StatelessWidget { const SampleItemDetailsView({super.key}); static const routeName = '/sample_item'; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Item Details'), ), body: const Center( child: Text('More Information Here'), ), ); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/init_services_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/init_services_demo/lib/src/sample_feature/sample_item.dart
/// A placeholder class that represents an entity or model. class SampleItem { const SampleItem(this.id); final int id; }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/init_services_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/init_services_demo/lib/src/sample_feature/sample_item_list_view.dart
import 'package:flutter/material.dart'; import '../settings/settings_view.dart'; import 'sample_item.dart'; import 'sample_item_details_view.dart'; /// Displays a list of SampleItems. class SampleItemListView extends StatelessWidget { const SampleItemListView({ super.key, this.items = const [SampleItem(1), SampleItem(2), SampleItem(3)], }); static const routeName = '/'; final List<SampleItem> items; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Sample Items'), actions: [ IconButton( icon: const Icon(Icons.settings), onPressed: () { // Navigate to the settings page. If the user leaves and returns // to the app after it has been killed while running in the // background, the navigation stack is restored. Navigator.restorablePushNamed(context, SettingsView.routeName); }, ), ], ), // To work with lists that may contain a large number of items, it’s best // to use the ListView.builder constructor. // // In contrast to the default ListView constructor, which requires // building all Widgets up front, the ListView.builder constructor lazily // builds Widgets as they’re scrolled into view. body: ListView.builder( // Providing a restorationId allows the ListView to restore the // scroll position when a user leaves and returns to the app after it // has been killed while running in the background. restorationId: 'sampleItemListView', itemCount: items.length, itemBuilder: (BuildContext context, int index) { final item = items[index]; return ListTile( title: Text('SampleItem ${item.id}'), leading: const CircleAvatar( // Display the Flutter Logo image asset. foregroundImage: AssetImage('assets/images/flutter_logo.png'), ), onTap: () { // Navigate to the details page. If the user leaves and returns to // the app after it has been killed while running in the // background, the navigation stack is restored. Navigator.restorablePushNamed( context, SampleItemDetailsView.routeName, ); } ); }, ), ); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/init_services_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/init_services_demo/test/unit_test.dart
// This is an example unit test. // // A unit test tests a single function, method, or class. To learn more about // writing unit tests, visit // https://flutter.dev/docs/cookbook/testing/unit/introduction import 'package:flutter_test/flutter_test.dart'; void main() { group('Plus Operator', () { test('should add two numbers together', () { expect(1 + 1, 2); }); }); }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/init_services_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/init_services_demo/test/widget_test.dart
// This is an example Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility in the flutter_test package. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. // // Visit https://flutter.dev/docs/cookbook/testing/widget/introduction for // more information about Widget testing. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; void main() { group('MyWidget', () { testWidgets('should display a string of text', (WidgetTester tester) async { // Define a Widget const myWidget = MaterialApp( home: Scaffold( body: Text('Hello'), ), ); // Build myWidget and trigger a frame. await tester.pumpWidget(myWidget); // Verify myWidget shows some text expect(find.byType(Text), findsOneWidget); }); }); }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo/lib/main_profile.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:buildvariants_demo/main_delegate.dart'; void main() { // No need to directly call the enbironment config setup as it is // lazy loaded. In the story board case one uses overrides to // set isMockOverride and buildVariantOverride mainDelegate(); }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo/lib/environment_config.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. bool? isMockOverride; String? buildVariantOverride; bool? isMockDefine; String? buildVariantDefine; /// [EnvironmentConfig] assumptions are /// that there are gitignored files of /// debug.json /// release.json /// staging.json /// preview.json /// profile.json /// /// That sets the vars per environment via /// the dart-define command. Thus, this /// is a services start entry in app start up services /// blocks /// And in test tear down it is: /// /// ```dart /// EnvironmentConfig.resetOverrides(); /// ``` /// /// Note, for story boarding one sets the overrides as part of starting the story board app /// as when the story board app is started we will not have a proper dart-define-from-file /// entry in our launch config. /// /// @author Fredrick Allan Grott. class EnvironmentConfig { bool get isMockDefine => isMockOverride ?? const bool.fromEnvironment('isMock'); String get buildVariantDefine => buildVariantOverride ?? const String.fromEnvironment('buildVariant'); void resetOverrides() { isMockOverride = null; buildVariantOverride = null; } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo/lib/main_release.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:buildvariants_demo/main_delegate.dart'; void main() { // No need to directly call the enbironment config setup as it is // lazy loaded. In the story board case one uses overrides to // set isMockOverride and buildVariantOverride mainDelegate(); }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo/lib/main_delegate.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:buildvariants_demo/main.dart'; void mainDelegate() => main();
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo/lib/main_stagging.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:buildvariants_demo/main_delegate.dart'; void main() { // No need to directly call the enbironment config setup as it is // lazy loaded. In the story board case one uses overrides to // set isMockOverride and buildVariantOverride mainDelegate(); }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo/lib/main_preview.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // ignore_for_file: unused_import // import 'package:device_preview/device_preview.dart'; // import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; void main() { // No need to directly call the enbironment config setup as it is // lazy loaded. In the story board case one uses overrides to // set isMockOverride and buildVariantOverride //DevopsConstants.setEnvironment(Environment.preview); //runApp(DevicePreview( //enabled: !kReleaseMode, // using builder to build the app and scaffold frame // thus builder slot gets a home MaterialApp with // scaffold wrapper //builder: (_) => MyAppPreviewWrapper(), //tools: [ // ...DevicePreview.defaultTools, // advancedScreenShotModesPlugin, // ], //)); }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo/lib/main.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:buildvariants_demo/src/app_logging.dart'; import 'package:buildvariants_demo/src/catcher_two_options.dart'; import 'package:buildvariants_demo/src/my_app.dart'; import 'package:buildvariants_demo/src/settings/settings_controller.dart'; import 'package:buildvariants_demo/src/settings/settings_service.dart'; import 'package:catcher_2/catcher_2.dart'; void main() async { // Set up the SettingsController, which will glue user settings to multiple // Flutter Widgets. final settingsController = SettingsController(SettingsService()); // Load the user's preferred theme while the splash screen is displayed. // This prevents a sudden theme change when the app is first displayed. await settingsController.loadSettings(); // init app logging AppLogging(); // Run the app and pass in the SettingsController. The app listens to the // SettingsController for changes, then passes it further down to the // SettingsView. Catcher2( rootWidget: MyApp(settingsController: settingsController), releaseConfig: releaseOptions, debugConfig: debugOptions, ); }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo/lib/main_debug.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:buildvariants_demo/main_delegate.dart'; void main() { // No need to directly call the enbironment config setup as it is // lazy loaded. In the story board case one uses overrides to // set isMockOverride and buildVariantOverride mainDelegate(); }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo/lib
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo/lib/src/my_app.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:buildvariants_demo/src/localization/l10n.dart'; import 'package:buildvariants_demo/src/sample_feature/sample_item_details_view.dart'; import 'package:buildvariants_demo/src/sample_feature/sample_item_list_view.dart'; import 'package:buildvariants_demo/src/settings/settings_controller.dart'; import 'package:buildvariants_demo/src/settings/settings_view.dart'; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; /// The Widget that configures your application. class MyApp extends StatelessWidget { const MyApp({ super.key, required this.settingsController, }); final SettingsController settingsController; @override Widget build(BuildContext context) { // Glue the SettingsController to the MaterialApp. // // The ListenableBuilder Widget listens to the SettingsController for changes. // Whenever the user updates their settings, the MaterialApp is rebuilt. return ListenableBuilder( listenable: settingsController, builder: (BuildContext context, Widget? child,) { return MaterialApp( onGenerateRoute: (RouteSettings routeSettings) { return MaterialPageRoute<void>( builder: (BuildContext context) { switch (routeSettings.name) { case SettingsView.routeName: return SettingsView(controller: settingsController); case SampleItemDetailsView.routeName: return const SampleItemDetailsView(); case SampleItemListView.routeName: default: return const SampleItemListView(); } }, settings: routeSettings, ); }, onGenerateTitle: (BuildContext context) => AppLocalizations.of(context)!.appTitle, theme: ThemeData(), darkTheme: ThemeData.dark(), themeMode: settingsController.themeMode, localizationsDelegates: const [ CustomAppLocalizations.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, ], supportedLocales: CustomAppLocalizations.delegate.supportedLocales, debugShowCheckedModeBanner: false, restorationScopeId: 'app',); }, ); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo/lib
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo/lib/src/app_logging.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // ignore_for_file: unused_local_variable import 'dart:developer'; import 'package:logging/logging.dart'; import 'package:logging_appenders/logging_appenders.dart'; /// The app Global logger. final appLogger = Logger("LoggingDemo"); /// AppLogging class initializes the logging set up at object creation. /// To call it is just AppLogging() within the main function block. /// /// Note, this an obseverable log that operates in all modes including /// release which means we do not use print but instead use log to output. /// /// @author Fredrick Allan Grott. class AppLogging { factory AppLogging() { return _appLogging; } AppLogging._internal() { _init(); } static final AppLogging _appLogging = AppLogging._internal(); void _init() { // disable hierarchical logger hierarchicalLoggingEnabled = false; Logger.root.level = Level.ALL; // stack traces are expensive so we turn this on for // severe and above recordStackTraceAtLevel = Level.SEVERE; // just so during a log level change that we know about it. // log is used instead of print as this is for observable // logging even in release mode Logger.root.onLevelChanged.listen((event) { log('${event?.name} changed'); }); // now to get the log output Logger.root.onRecord.listen((record) { if (record.error != null && record.stackTrace != null) { log( '${record.level.name}: ${record.loggerName}: ${record.time}: ${record.message}: ${record.error}: ${record.stackTrace}', ); log( 'level: ${record.level.name} loggerName: ${record.loggerName} time: ${record.time} message: ${record.message} error: ${record.error} exception: ${record.stackTrace}', ); } else if (record.error != null) { log( 'level: ${record.level.name} loggerName: ${record.loggerName} time: ${record.time} message: ${record.message} error: ${record.error}', ); } else { log( 'level: ${record.level.name} loggerName: ${record.loggerName} time: ${record.time} message: ${record.message}', ); } }); // Appenders set up for color logs PrintAppender(formatter: const ColorFormatter()).attachToLogger(Logger.root); // Any appendeing logs to 3rd party observable logging services // would be here using the logging appenders other appenders } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo/lib
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo/lib/src/custom_catcher_two_logger.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'dart:developer'; import 'package:catcher_2/catcher_2.dart'; /// CustomCatcherTwoLogger where the Dart developer log /// method is used to output the correct log message. Have to use /// log instead of print for observable logs as print is stripped /// in release mode. /// /// @author Fredrick Allan Grott. class CustomCatcherTwoLogger extends Catcher2Logger { @override void info(String message) { log('Custom Catcher Logger | Info | $message'); } @override void fine(String message) { log('Custom Catcher Logger | Fine | $message'); } @override void warning(String message) { log('Custom Catcher Logger | Warning | $message'); } @override void severe(String message) { log('Custom Catcher Logger | Severe | $message'); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo/lib
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo/lib/src/catcher_two_options.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // ignore_for_file: avoid_redundant_argument_values import 'package:buildvariants_demo/src/custom_catcher_two_logger.dart'; import 'package:catcher_2/catcher_2.dart'; final debugOptions = Catcher2Options( PageReportMode(), [ EmailManualHandler(['[email protected]']), ConsoleHandler(), ], localizationOptions: [ LocalizationOptions( 'en', pageReportModeTitle: 'Exception Report', pageReportModeDescription: 'Page report mode.', pageReportModeAccept: 'Accept', pageReportModeCancel: 'Cancel', ), LocalizationOptions( 'de', pageReportModeTitle: 'Ausnahmebericht', pageReportModeDescription: 'Seitenberichtsmodus', pageReportModeAccept: 'Akzeptieren', pageReportModeCancel: 'Stornieren', ), ], logger: CustomCatcherTwoLogger(), ); final releaseOptions = Catcher2Options( PageReportMode(), [ EmailManualHandler(['[email protected]']), ], localizationOptions: [ LocalizationOptions( 'en', pageReportModeTitle: 'Exception Report', pageReportModeDescription: 'Page report mode.', pageReportModeAccept: 'Accept', pageReportModeCancel: 'Cancel', ), LocalizationOptions( 'de', pageReportModeTitle: 'Ausnahmebericht', pageReportModeDescription: 'Seitenberichtsmodus', pageReportModeAccept: 'Akzeptieren', pageReportModeCancel: 'Stornieren', ), ], logger: CustomCatcherTwoLogger(), );
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo/lib/src/settings/settings_controller.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:buildvariants_demo/src/settings/settings_service.dart'; import 'package:flutter/material.dart'; /// A class that many Widgets can interact with to read user settings, update /// user settings, or listen to user settings changes. /// /// Controllers glue Data Services to Flutter Widgets. The SettingsController /// uses the SettingsService to store and retrieve user settings. class SettingsController with ChangeNotifier { SettingsController(this._settingsService); // Make SettingsService a private variable so it is not used directly. final SettingsService _settingsService; // Make ThemeMode a private variable so it is not updated directly without // also persisting the changes with the SettingsService. late ThemeMode _themeMode; // Allow Widgets to read the user's preferred ThemeMode. ThemeMode get themeMode => _themeMode; /// Load the user's settings from the SettingsService. It may load from a /// local database or the internet. The controller only knows it can load the /// settings from the service. Future<void> loadSettings() async { _themeMode = await _settingsService.themeMode(); // Important! Inform listeners a change has occurred. notifyListeners(); } /// Update and persist the ThemeMode based on the user's selection. Future<void> updateThemeMode(ThemeMode? newThemeMode) async { if (newThemeMode == null) return; // Do not perform any work if new and old ThemeMode are identical if (newThemeMode == _themeMode) return; // Otherwise, store the new ThemeMode in memory _themeMode = newThemeMode; // Important! Inform listeners a change has occurred. notifyListeners(); // Persist the changes to a local database or the internet using the // SettingService. await _settingsService.updateThemeMode(newThemeMode); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo/lib/src/settings/settings_view.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:buildvariants_demo/src/localization/l10n.dart'; import 'package:buildvariants_demo/src/settings/settings_controller.dart'; import 'package:flutter/material.dart'; /// Displays the various settings that can be customized by the user. /// /// When a user changes a setting, the SettingsController is updated and /// Widgets that listen to the SettingsController are rebuilt. class SettingsView extends StatelessWidget { const SettingsView({super.key, required this.controller,}); static const routeName = '/settings'; final SettingsController controller; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(CustomAppLocalizations.of(context).settingsViewTitle), ), body: Padding( padding: const EdgeInsets.all(16), // Glue the SettingsController to the theme selection DropdownButton. // // When a user selects a theme from the dropdown list, the // SettingsController is updated, which rebuilds the MaterialApp. child: DropdownButton<ThemeMode>( items: [ DropdownMenuItem(value: ThemeMode.system, child: Text(CustomAppLocalizations.of(context).settingsSystemTheme),), DropdownMenuItem(value: ThemeMode.light, child: Text(CustomAppLocalizations.of(context).settingsLightTheme),), DropdownMenuItem(value: ThemeMode.dark, child: Text(CustomAppLocalizations.of(context).settingsDarkTheme),), ], value: controller.themeMode, onChanged: controller.updateThemeMode, ), ), ); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo/lib/src/settings/settings_service.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:flutter/material.dart'; /// A service that stores and retrieves user settings. /// /// By default, this class does not persist user settings. If you'd like to /// persist the user settings locally, use the shared_preferences package. If /// you'd like to store settings on a web server, use the http package. class SettingsService { /// Loads the User's preferred ThemeMode from local or remote storage. Future<ThemeMode> themeMode() async => ThemeMode.system; /// Persists the user's preferred ThemeMode to local or remote storage. Future<void> updateThemeMode(ThemeMode theme) async { // Use the shared_preferences package to persist settings locally or the // http package to persist settings over the network. } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo/lib/src/sample_feature/sample_item_details_view.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:buildvariants_demo/src/localization/l10n.dart'; import 'package:flutter/material.dart'; /// Displays detailed information about a SampleItem. class SampleItemDetailsView extends StatelessWidget { const SampleItemDetailsView({super.key}); static const routeName = '/sample_item'; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(CustomAppLocalizations.of(context).sampleItemDetailsViewTitle), ), body: Center( child: Text(CustomAppLocalizations.of(context).sampleItemDetailsViewDetail), ), ); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo/lib/src/sample_feature/sample_item.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. /// A placeholder class that represents an entity or model. class SampleItem { const SampleItem(this.id); final int id; }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo/lib/src/sample_feature/sample_item_list_view.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:buildvariants_demo/src/localization/l10n.dart'; import 'package:buildvariants_demo/src/sample_feature/sample_item.dart'; import 'package:buildvariants_demo/src/sample_feature/sample_item_details_view.dart'; import 'package:buildvariants_demo/src/settings/settings_view.dart'; import 'package:flutter/material.dart'; /// Displays a list of SampleItems. class SampleItemListView extends StatelessWidget { const SampleItemListView({ super.key, this.items = const [SampleItem(1), SampleItem(2), SampleItem(3),], }); static const routeName = '/'; final List<SampleItem> items; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(CustomAppLocalizations.of(context).sampleItemListViewTitle), actions: [ IconButton( onPressed: () {Navigator.restorablePushNamed(context, SettingsView.routeName,);}, icon: const Icon(Icons.settings),), ], ), // To work with lists that may contain a large number of items, it’s best // to use the ListView.builder constructor. // // In contrast to the default ListView constructor, which requires // building all Widgets up front, the ListView.builder constructor lazily // builds Widgets as they’re scrolled into view. body: ListView.builder( itemBuilder: (BuildContext context, int index,) {final item = items[index]; return ListTile( leading: const CircleAvatar(foregroundImage: AssetImage('assets/images/flutter_logo.png')), title: Text(CustomAppLocalizations.of(context).listTileTitle(item.id)), onTap: () {Navigator.restorablePushNamed(context, SampleItemDetailsView.routeName,);}, ); }, itemCount: items.length, restorationId: 'sampleItemListView', ), ); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo/test/unit_test.dart
// This is an example unit test. // // A unit test tests a single function, method, or class. To learn more about // writing unit tests, visit // https://flutter.dev/docs/cookbook/testing/unit/introduction import 'package:flutter_test/flutter_test.dart'; void main() { group('Plus Operator', () { test('should add two numbers together', () { expect(1 + 1, 2,); },); },); }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/codemagic_demo/test/widget_test.dart
// This is an example Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility in the flutter_test package. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. // // Visit https://flutter.dev/docs/cookbook/testing/widget/introduction for // more information about Widget testing. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; void main() { group('MyWidget', () { testWidgets('should display a string of text', (WidgetTester tester) async { // Define a Widget const myWidget = MaterialApp( home: Scaffold( body: Text('Hello'), ), ); // Build myWidget and trigger a frame. await tester.pumpWidget(myWidget); // Verify myWidget shows some text expect(find.byType(Text), findsOneWidget,); },); },); }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/logging_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/logging_demo/lib/main.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:flutter/material.dart'; import 'package:logging_demo/src/my_app.dart'; import 'package:logging_demo/src/settings/settings_controller.dart'; import 'package:logging_demo/src/settings/settings_service.dart'; void main() async { // Set up the SettingsController, which will glue user settings to multiple // Flutter Widgets. final settingsController = SettingsController(SettingsService()); // Load the user's preferred theme while the splash screen is displayed. // This prevents a sudden theme change when the app is first displayed. await settingsController.loadSettings(); // Run the app and pass in the SettingsController. The app listens to the // SettingsController for changes, then passes it further down to the // SettingsView. runApp(MyApp(settingsController: settingsController)); }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/logging_demo/lib
mirrored_repositories/flutter_bytes_devops/code_infrastructure/logging_demo/lib/src/my_app.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:logging_demo/src/sample_feature/sample_item_details_view.dart'; import 'package:logging_demo/src/sample_feature/sample_item_list_view.dart'; import 'package:logging_demo/src/settings/settings_controller.dart'; import 'package:logging_demo/src/settings/settings_view.dart'; /// The Widget that configures your application. class MyApp extends StatelessWidget { const MyApp({ super.key, required this.settingsController, }); final SettingsController settingsController; @override Widget build(BuildContext context) { // Glue the SettingsController to the MaterialApp. // // The ListenableBuilder Widget listens to the SettingsController for changes. // Whenever the user updates their settings, the MaterialApp is rebuilt. return ListenableBuilder( listenable: settingsController, builder: (BuildContext context, Widget? child,) { return MaterialApp( onGenerateRoute: (RouteSettings routeSettings) { return MaterialPageRoute<void>( builder: (BuildContext context) { switch (routeSettings.name) { case SettingsView.routeName: return SettingsView(controller: settingsController); case SampleItemDetailsView.routeName: return const SampleItemDetailsView(); case SampleItemListView.routeName: default: return const SampleItemListView(); } }, settings: routeSettings, ); }, onGenerateTitle: (BuildContext context) => AppLocalizations.of(context)!.appTitle, theme: ThemeData(), darkTheme: ThemeData.dark(), themeMode: settingsController.themeMode, localizationsDelegates: const [ AppLocalizations.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, ], supportedLocales: const [Locale('en', '',)], debugShowCheckedModeBanner: false, restorationScopeId: 'app', ); }, ); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/logging_demo/lib
mirrored_repositories/flutter_bytes_devops/code_infrastructure/logging_demo/lib/src/app_logging.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // ignore_for_file: unused_local_variable import 'dart:developer'; import 'package:logging/logging.dart'; import 'package:logging_appenders/logging_appenders.dart'; /// The app Global logger. final appLogger = Logger("LoggingDemo"); /// AppLogging class initializes the logging set up at object creation. /// To call it is just AppLogging() within the main function block. /// /// Note, this an obseverable log that operates in all modes including /// release which means we do not use print but instead use log to output. /// /// @author Fredrick Allan Grott. class AppLogging { factory AppLogging() { return _appLogging; } AppLogging._internal() { _init(); } static final AppLogging _appLogging = AppLogging._internal(); void _init() { // disable hierarchical logger hierarchicalLoggingEnabled = false; Logger.root.level = Level.ALL; // stack traces are expensive so we turn this on for // severe and above recordStackTraceAtLevel = Level.SEVERE; // just so during a log level change that we know about it. // log is used instead of print as this is for observable // logging even in release mode Logger.root.onLevelChanged.listen((event) { log('${event?.name} changed'); }); // now to get the log output Logger.root.onRecord.listen((record) { if (record.error != null && record.stackTrace != null) { log( '${record.level.name}: ${record.loggerName}: ${record.time}: ${record.message}: ${record.error}: ${record.stackTrace}', ); log( 'level: ${record.level.name} loggerName: ${record.loggerName} time: ${record.time} message: ${record.message} error: ${record.error} exception: ${record.stackTrace}', ); } else if (record.error != null) { log( 'level: ${record.level.name} loggerName: ${record.loggerName} time: ${record.time} message: ${record.message} error: ${record.error}', ); } else { log( 'level: ${record.level.name} loggerName: ${record.loggerName} time: ${record.time} message: ${record.message}', ); } }); // Appenders set up for color logs PrintAppender(formatter: const ColorFormatter()).attachToLogger(Logger.root); // Any appendeing logs to 3rd party observable logging services // would be here using the logging appenders other appenders } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/logging_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/logging_demo/lib/src/settings/settings_controller.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:flutter/material.dart'; import 'package:logging_demo/src/settings/settings_service.dart'; /// A class that many Widgets can interact with to read user settings, update /// user settings, or listen to user settings changes. /// /// Controllers glue Data Services to Flutter Widgets. The SettingsController /// uses the SettingsService to store and retrieve user settings. class SettingsController with ChangeNotifier { SettingsController(this._settingsService); // Make SettingsService a private variable so it is not used directly. final SettingsService _settingsService; // Make ThemeMode a private variable so it is not updated directly without // also persisting the changes with the SettingsService. late ThemeMode _themeMode; // Allow Widgets to read the user's preferred ThemeMode. ThemeMode get themeMode => _themeMode; /// Load the user's settings from the SettingsService. It may load from a /// local database or the internet. The controller only knows it can load the /// settings from the service. Future<void> loadSettings() async { _themeMode = await _settingsService.themeMode(); // Important! Inform listeners a change has occurred. notifyListeners(); } /// Update and persist the ThemeMode based on the user's selection. Future<void> updateThemeMode(ThemeMode? newThemeMode) async { if (newThemeMode == null) return; // Do not perform any work if new and old ThemeMode are identical if (newThemeMode == _themeMode) return; // Otherwise, store the new ThemeMode in memory _themeMode = newThemeMode; // Important! Inform listeners a change has occurred. notifyListeners(); // Persist the changes to a local database or the internet using the // SettingService. await _settingsService.updateThemeMode(newThemeMode); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/logging_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/logging_demo/lib/src/settings/settings_view.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:flutter/material.dart'; import 'package:logging_demo/src/settings/settings_controller.dart'; /// Displays the various settings that can be customized by the user. /// /// When a user changes a setting, the SettingsController is updated and /// Widgets that listen to the SettingsController are rebuilt. class SettingsView extends StatelessWidget { const SettingsView({super.key, required this.controller,}); static const routeName = '/settings'; final SettingsController controller; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Settings'), ), body: Padding( padding: const EdgeInsets.all(16), // Glue the SettingsController to the theme selection DropdownButton. // // When a user selects a theme from the dropdown list, the // SettingsController is updated, which rebuilds the MaterialApp. child: DropdownButton<ThemeMode>( items: const [ DropdownMenuItem(value: ThemeMode.system, child: Text('System Theme'),), DropdownMenuItem(value: ThemeMode.light, child: Text('Light Theme'),), DropdownMenuItem(value: ThemeMode.dark, child: Text('Dark Theme'),), ], value: controller.themeMode, onChanged: controller.updateThemeMode, ), ), ); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/logging_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/logging_demo/lib/src/settings/settings_service.dart
import 'package:flutter/material.dart'; /// A service that stores and retrieves user settings. /// /// By default, this class does not persist user settings. If you'd like to /// persist the user settings locally, use the shared_preferences package. If /// you'd like to store settings on a web server, use the http package. class SettingsService { /// Loads the User's preferred ThemeMode from local or remote storage. Future<ThemeMode> themeMode() async => ThemeMode.system; /// Persists the user's preferred ThemeMode to local or remote storage. Future<void> updateThemeMode(ThemeMode theme) async { // Use the shared_preferences package to persist settings locally or the // http package to persist settings over the network. } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/logging_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/logging_demo/lib/src/sample_feature/sample_item_details_view.dart
import 'package:flutter/material.dart'; /// Displays detailed information about a SampleItem. class SampleItemDetailsView extends StatelessWidget { const SampleItemDetailsView({super.key}); static const routeName = '/sample_item'; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Item Details'), ), body: const Center( child: Text('More Information Here'), ), ); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/logging_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/logging_demo/lib/src/sample_feature/sample_item.dart
/// A placeholder class that represents an entity or model. class SampleItem { const SampleItem(this.id); final int id; }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/logging_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/logging_demo/lib/src/sample_feature/sample_item_list_view.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:flutter/material.dart'; import 'package:logging_demo/src/sample_feature/sample_item.dart'; import 'package:logging_demo/src/sample_feature/sample_item_details_view.dart'; import 'package:logging_demo/src/settings/settings_view.dart'; /// Displays a list of SampleItems. class SampleItemListView extends StatelessWidget { const SampleItemListView({ super.key, this.items = const [SampleItem(1), SampleItem(2), SampleItem(3),], }); static const routeName = '/'; final List<SampleItem> items; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Sample Items'), actions: [ IconButton( onPressed: () {Navigator.restorablePushNamed(context, SettingsView.routeName,);}, icon: const Icon(Icons.settings), ), ], ), // To work with lists that may contain a large number of items, it’s best // to use the ListView.builder constructor. // // In contrast to the default ListView constructor, which requires // building all Widgets up front, the ListView.builder constructor lazily // builds Widgets as they’re scrolled into view. body: ListView.builder( itemBuilder: (BuildContext context, int index,) {final item = items[index]; return ListTile( leading: const CircleAvatar(foregroundImage: AssetImage('assets/images/flutter_logo.png')), title: Text('SampleItem ${item.id}'), onTap: () {Navigator.restorablePushNamed(context, SampleItemDetailsView.routeName,);}, ); }, itemCount: items.length, restorationId: 'sampleItemListView', ), ); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/logging_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/logging_demo/test/unit_test.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This is an example unit test. // // A unit test tests a single function, method, or class. To learn more about // writing unit tests, visit // https://flutter.dev/docs/cookbook/testing/unit/introduction import 'package:flutter_test/flutter_test.dart'; void main() { group( 'Plus Operator', () { test( 'should add two numbers together', () { expect( 1 + 1, 2, ); }, ); }, ); }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/logging_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/logging_demo/test/widget_test.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This is an example Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility in the flutter_test package. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. // // Visit https://flutter.dev/docs/cookbook/testing/widget/introduction for // more information about Widget testing. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; void main() { group( 'MyWidget', () { testWidgets( 'should display a string of text', (WidgetTester tester) async { // Define a Widget const myWidget = MaterialApp( home: Scaffold( body: Text('Hello'), ), ); // Build myWidget and trigger a frame. await tester.pumpWidget(myWidget); // Verify myWidget shows some text expect( find.byType(Text), findsOneWidget, ); }, ); }, ); }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/localization_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/localization_demo/lib/main.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:flutter/material.dart'; import 'package:localization_demo/src/my_app.dart'; import 'package:localization_demo/src/settings/settings_controller.dart'; import 'package:localization_demo/src/settings/settings_service.dart'; void main() async { // Set up the SettingsController, which will glue user settings to multiple // Flutter Widgets. final settingsController = SettingsController(SettingsService()); // Load the user's preferred theme while the splash screen is displayed. // This prevents a sudden theme change when the app is first displayed. await settingsController.loadSettings(); // Run the app and pass in the SettingsController. The app listens to the // SettingsController for changes, then passes it further down to the // SettingsView. runApp(MyApp(settingsController: settingsController)); }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/localization_demo/lib
mirrored_repositories/flutter_bytes_devops/code_infrastructure/localization_demo/lib/src/my_app.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:localization_demo/src/localization/l10n.dart'; import 'package:localization_demo/src/sample_feature/sample_item_details_view.dart'; import 'package:localization_demo/src/sample_feature/sample_item_list_view.dart'; import 'package:localization_demo/src/settings/settings_controller.dart'; import 'package:localization_demo/src/settings/settings_view.dart'; /// The Widget that configures your application. class MyApp extends StatelessWidget { const MyApp({ super.key, required this.settingsController, }); final SettingsController settingsController; @override Widget build(BuildContext context) { // Glue the SettingsController to the MaterialApp. // // The ListenableBuilder Widget listens to the SettingsController for changes. // Whenever the user updates their settings, the MaterialApp is rebuilt. return ListenableBuilder( listenable: settingsController, builder: (BuildContext context, Widget? child,) { return MaterialApp(onGenerateRoute: (RouteSettings routeSettings) { return MaterialPageRoute<void>( builder: (BuildContext context) { switch (routeSettings.name) { case SettingsView.routeName: return SettingsView(controller: settingsController); case SampleItemDetailsView.routeName: return const SampleItemDetailsView(); case SampleItemListView.routeName: default: return const SampleItemListView(); } }, settings: routeSettings, ); }, onGenerateTitle: (BuildContext context) => CustomAppLocalizations.of(context).title, theme: ThemeData(), darkTheme: ThemeData.dark(), themeMode: settingsController.themeMode, localizationsDelegates: const [ CustomAppLocalizations.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, ], supportedLocales: CustomAppLocalizations.delegate.supportedLocales, debugShowCheckedModeBanner: false, restorationScopeId: 'app', ); }, ); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/localization_demo/lib
mirrored_repositories/flutter_bytes_devops/code_infrastructure/localization_demo/lib/src/app_logging.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // ignore_for_file: unused_local_variable import 'dart:developer'; import 'package:logging/logging.dart'; import 'package:logging_appenders/logging_appenders.dart'; /// The app Global logger. final appLogger = Logger("LoggingDemo"); /// AppLogging class initializes the logging set up at object creation. /// To call it is just AppLogging() within the main function block. /// /// Note, this an obseverable log that operates in all modes including /// release which means we do not use print but instead use log to output. /// /// @author Fredrick Allan Grott. class AppLogging { factory AppLogging() { return _appLogging; } AppLogging._internal() { _init(); } static final AppLogging _appLogging = AppLogging._internal(); void _init() { // disable hierarchical logger hierarchicalLoggingEnabled = false; Logger.root.level = Level.ALL; // stack traces are expensive so we turn this on for // severe and above recordStackTraceAtLevel = Level.SEVERE; // just so during a log level change that we know about it. // log is used instead of print as this is for observable // logging even in release mode Logger.root.onLevelChanged.listen((event) { log('${event?.name} changed'); }); // now to get the log output Logger.root.onRecord.listen((record) { if (record.error != null && record.stackTrace != null) { log( '${record.level.name}: ${record.loggerName}: ${record.time}: ${record.message}: ${record.error}: ${record.stackTrace}', ); log( 'level: ${record.level.name} loggerName: ${record.loggerName} time: ${record.time} message: ${record.message} error: ${record.error} exception: ${record.stackTrace}', ); } else if (record.error != null) { log( 'level: ${record.level.name} loggerName: ${record.loggerName} time: ${record.time} message: ${record.message} error: ${record.error}', ); } else { log( 'level: ${record.level.name} loggerName: ${record.loggerName} time: ${record.time} message: ${record.message}', ); } }); // Appenders set up for color logs PrintAppender(formatter: const ColorFormatter()).attachToLogger(Logger.root); // Any appendeing logs to 3rd party observable logging services // would be here using the logging appenders other appenders } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/localization_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/localization_demo/lib/src/settings/settings_controller.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:flutter/material.dart'; import 'package:localization_demo/src/settings/settings_service.dart'; /// A class that many Widgets can interact with to read user settings, update /// user settings, or listen to user settings changes. /// /// Controllers glue Data Services to Flutter Widgets. The SettingsController /// uses the SettingsService to store and retrieve user settings. class SettingsController with ChangeNotifier { SettingsController(this._settingsService); // Make SettingsService a private variable so it is not used directly. final SettingsService _settingsService; // Make ThemeMode a private variable so it is not updated directly without // also persisting the changes with the SettingsService. late ThemeMode _themeMode; // Allow Widgets to read the user's preferred ThemeMode. ThemeMode get themeMode => _themeMode; /// Load the user's settings from the SettingsService. It may load from a /// local database or the internet. The controller only knows it can load the /// settings from the service. Future<void> loadSettings() async { _themeMode = await _settingsService.themeMode(); // Important! Inform listeners a change has occurred. notifyListeners(); } /// Update and persist the ThemeMode based on the user's selection. Future<void> updateThemeMode(ThemeMode? newThemeMode) async { if (newThemeMode == null) return; // Do not perform any work if new and old ThemeMode are identical if (newThemeMode == _themeMode) return; // Otherwise, store the new ThemeMode in memory _themeMode = newThemeMode; // Important! Inform listeners a change has occurred. notifyListeners(); // Persist the changes to a local database or the internet using the // SettingService. await _settingsService.updateThemeMode(newThemeMode); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/localization_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/localization_demo/lib/src/settings/settings_view.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:flutter/material.dart'; import 'package:localization_demo/src/localization/l10n.dart'; import 'package:localization_demo/src/settings/settings_controller.dart'; /// Displays the various settings that can be customized by the user. /// /// When a user changes a setting, the SettingsController is updated and /// Widgets that listen to the SettingsController are rebuilt. class SettingsView extends StatelessWidget { const SettingsView({ super.key, required this.controller, }); static const routeName = '/settings'; final SettingsController controller; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Settings'), ), body: Padding( padding: const EdgeInsets.all(16), // Glue the SettingsController to the theme selection DropdownButton. // // When a user selects a theme from the dropdown list, the // SettingsController is updated, which rebuilds the MaterialApp. child: DropdownButton<ThemeMode>( items: [ DropdownMenuItem(value: ThemeMode.system, child: Text(CustomAppLocalizations.of(context).settingsSystemTheme),), DropdownMenuItem(value: ThemeMode.light, child: Text(CustomAppLocalizations.of(context).settingsLightTheme),), DropdownMenuItem(value: ThemeMode.dark, child: Text(CustomAppLocalizations.of(context).settingsDarkTheme),), ], value: controller.themeMode, onChanged: controller.updateThemeMode, ), ), ); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/localization_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/localization_demo/lib/src/settings/settings_service.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:flutter/material.dart'; /// A service that stores and retrieves user settings. /// /// By default, this class does not persist user settings. If you'd like to /// persist the user settings locally, use the shared_preferences package. If /// you'd like to store settings on a web server, use the http package. class SettingsService { /// Loads the User's preferred ThemeMode from local or remote storage. Future<ThemeMode> themeMode() async => ThemeMode.system; /// Persists the user's preferred ThemeMode to local or remote storage. Future<void> updateThemeMode(ThemeMode theme) async { // Use the shared_preferences package to persist settings locally or the // http package to persist settings over the network. } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/localization_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/localization_demo/lib/src/sample_feature/sample_item_details_view.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:flutter/material.dart'; import 'package:localization_demo/src/localization/l10n.dart'; /// Displays detailed information about a SampleItem. class SampleItemDetailsView extends StatelessWidget { const SampleItemDetailsView({super.key}); static const routeName = '/sample_item'; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(CustomAppLocalizations.of(context).sampleItemDetailsViewTitle), ), body: Center( child: Text(CustomAppLocalizations.of(context).sampleItemDetailsViewDetail), ), ); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/localization_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/localization_demo/lib/src/sample_feature/sample_item.dart
/// A placeholder class that represents an entity or model. class SampleItem { const SampleItem(this.id); final int id; }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/localization_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/localization_demo/lib/src/sample_feature/sample_item_list_view.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:flutter/material.dart'; import 'package:localization_demo/src/localization/l10n.dart'; import 'package:localization_demo/src/sample_feature/sample_item.dart'; import 'package:localization_demo/src/sample_feature/sample_item_details_view.dart'; import 'package:localization_demo/src/settings/settings_view.dart'; /// Displays a list of SampleItems. class SampleItemListView extends StatelessWidget { const SampleItemListView({ super.key, this.items = const [SampleItem(1), SampleItem(2), SampleItem(3),], }); static const routeName = '/'; final List<SampleItem> items; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title:Text(CustomAppLocalizations.of(context).sampleItemListViewTitle), actions: [ IconButton(onPressed: () {Navigator.restorablePushNamed(context, SettingsView.routeName,);}, icon: const Icon(Icons.settings),), ], ), // To work with lists that may contain a large number of items, it’s best // to use the ListView.builder constructor. // // In contrast to the default ListView constructor, which requires // building all Widgets up front, the ListView.builder constructor lazily // builds Widgets as they’re scrolled into view. body: ListView.builder( itemBuilder: (BuildContext context, int index,) {final item = items[index]; return ListTile( leading: const CircleAvatar( foregroundImage: AssetImage('assets/images/flutter_logo.png'), ), title: Text(CustomAppLocalizations.of(context).listTileTitle(item.id)), onTap: () {Navigator.restorablePushNamed(context, SampleItemDetailsView.routeName,);},);}, itemCount: items.length, restorationId: 'sampleItemListView', ), ); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/localization_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/localization_demo/lib/src/localization/l10n.dart
// GENERATED CODE - DO NOT MODIFY BY HAND import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import 'intl/messages_all.dart'; // ************************************************************************** // Generator: Flutter Intl IDE plugin // Made by Localizely // ************************************************************************** // ignore_for_file: non_constant_identifier_names, lines_longer_than_80_chars // ignore_for_file: join_return_with_assignment, prefer_final_in_for_each // ignore_for_file: avoid_redundant_argument_values, avoid_escaping_inner_quotes class CustomAppLocalizations { CustomAppLocalizations(); static CustomAppLocalizations? _current; static CustomAppLocalizations get current { assert(_current != null, 'No instance of CustomAppLocalizations was loaded. Try to initialize the CustomAppLocalizations delegate before accessing CustomAppLocalizations.current.'); return _current!; } static const AppLocalizationDelegate delegate = AppLocalizationDelegate(); static Future<CustomAppLocalizations> load(Locale locale) { final name = (locale.countryCode?.isEmpty ?? false) ? locale.languageCode : locale.toString(); final localeName = Intl.canonicalizedLocale(name); return initializeMessages(localeName).then((_) { Intl.defaultLocale = localeName; final instance = CustomAppLocalizations(); CustomAppLocalizations._current = instance; return instance; }); } static CustomAppLocalizations of(BuildContext context) { final instance = CustomAppLocalizations.maybeOf(context); assert(instance != null, 'No instance of CustomAppLocalizations present in the widget tree. Did you add CustomAppLocalizations.delegate in localizationsDelegates?'); return instance!; } static CustomAppLocalizations? maybeOf(BuildContext context) { return Localizations.of<CustomAppLocalizations>( context, CustomAppLocalizations); } /// `App` String get title { return Intl.message( 'App', name: 'title', desc: 'Title for the App', args: [], ); } /// `SampleItem {value}` String listTileTitle(int value) { return Intl.message( 'SampleItem $value', name: 'listTileTitle', desc: 'ListTile title', args: [value], ); } /// `Sample Items` String get sampleItemListViewTitle { return Intl.message( 'Sample Items', name: 'sampleItemListViewTitle', desc: 'Sample Item List View Title', args: [], ); } /// `Item Details` String get sampleItemDetailsViewTitle { return Intl.message( 'Item Details', name: 'sampleItemDetailsViewTitle', desc: 'Sample Item Detials view Title', args: [], ); } /// `Settings` String get settingsViewTitle { return Intl.message( 'Settings', name: 'settingsViewTitle', desc: 'Settings View Title', args: [], ); } /// `System Theme` String get settingsSystemTheme { return Intl.message( 'System Theme', name: 'settingsSystemTheme', desc: 'Settings System Theme', args: [], ); } /// `Light Theme` String get settingsLightTheme { return Intl.message( 'Light Theme', name: 'settingsLightTheme', desc: 'Settings Light Theme', args: [], ); } /// `Dark Theme` String get settingsDarkTheme { return Intl.message( 'Dark Theme', name: 'settingsDarkTheme', desc: 'Settings Dark Theme', args: [], ); } /// `More Information Here` String get sampleItemDetailsViewDetail { return Intl.message( 'More Information Here', name: 'sampleItemDetailsViewDetail', desc: 'Sample Item Detials View Detail', args: [], ); } } class AppLocalizationDelegate extends LocalizationsDelegate<CustomAppLocalizations> { const AppLocalizationDelegate(); List<Locale> get supportedLocales { return const <Locale>[ Locale.fromSubtags(languageCode: 'en'), Locale.fromSubtags(languageCode: 'de'), ]; } @override bool isSupported(Locale locale) => _isSupported(locale); @override Future<CustomAppLocalizations> load(Locale locale) => CustomAppLocalizations.load(locale); @override bool shouldReload(AppLocalizationDelegate old) => false; bool _isSupported(Locale locale) { for (var supportedLocale in supportedLocales) { if (supportedLocale.languageCode == locale.languageCode) { return true; } } return false; } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/localization_demo/lib/src/localization
mirrored_repositories/flutter_bytes_devops/code_infrastructure/localization_demo/lib/src/localization/intl/messages_en.dart
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart // This is a library that provides messages for a en locale. All the // messages from the main program should be duplicated here with the same // function name. // Ignore issues from commonly used lints in this file. // ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new // ignore_for_file:prefer_single_quotes,comment_references, directives_ordering // ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases // ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes // ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes import 'package:intl/intl.dart'; import 'package:intl/message_lookup_by_library.dart'; final messages = new MessageLookup(); typedef String MessageIfAbsent(String messageStr, List<dynamic> args); class MessageLookup extends MessageLookupByLibrary { String get localeName => 'en'; static String m0(value) => "SampleItem ${value}"; final messages = _notInlinedMessages(_notInlinedMessages); static Map<String, Function> _notInlinedMessages(_) => <String, Function>{ "listTileTitle": m0, "sampleItemDetailsViewDetail": MessageLookupByLibrary.simpleMessage("More Information Here"), "sampleItemDetailsViewTitle": MessageLookupByLibrary.simpleMessage("Item Details"), "sampleItemListViewTitle": MessageLookupByLibrary.simpleMessage("Sample Items"), "settingsDarkTheme": MessageLookupByLibrary.simpleMessage("Dark Theme"), "settingsLightTheme": MessageLookupByLibrary.simpleMessage("Light Theme"), "settingsSystemTheme": MessageLookupByLibrary.simpleMessage("System Theme"), "settingsViewTitle": MessageLookupByLibrary.simpleMessage("Settings"), "title": MessageLookupByLibrary.simpleMessage("App") }; }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/localization_demo/lib/src/localization
mirrored_repositories/flutter_bytes_devops/code_infrastructure/localization_demo/lib/src/localization/intl/messages_de.dart
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart // This is a library that provides messages for a de locale. All the // messages from the main program should be duplicated here with the same // function name. // Ignore issues from commonly used lints in this file. // ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new // ignore_for_file:prefer_single_quotes,comment_references, directives_ordering // ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases // ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes // ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes import 'package:intl/intl.dart'; import 'package:intl/message_lookup_by_library.dart'; final messages = new MessageLookup(); typedef String MessageIfAbsent(String messageStr, List<dynamic> args); class MessageLookup extends MessageLookupByLibrary { String get localeName => 'de'; static String m0(value) => "Musterartikel ${value}"; final messages = _notInlinedMessages(_notInlinedMessages); static Map<String, Function> _notInlinedMessages(_) => <String, Function>{ "listTileTitle": m0, "sampleItemDetailsViewDetail": MessageLookupByLibrary.simpleMessage("Weitere Informationen Hier"), "sampleItemDetailsViewTitle": MessageLookupByLibrary.simpleMessage("Artikeldetails"), "sampleItemListViewTitle": MessageLookupByLibrary.simpleMessage("Beispielartikel"), "settingsDarkTheme": MessageLookupByLibrary.simpleMessage("Dunkles Thema"), "settingsLightTheme": MessageLookupByLibrary.simpleMessage("Licht Thema"), "settingsSystemTheme": MessageLookupByLibrary.simpleMessage("System Thema"), "settingsViewTitle": MessageLookupByLibrary.simpleMessage("Einstellungen"), "title": MessageLookupByLibrary.simpleMessage("App") }; }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/localization_demo/lib/src/localization
mirrored_repositories/flutter_bytes_devops/code_infrastructure/localization_demo/lib/src/localization/intl/messages_all.dart
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart // This is a library that looks up messages for specific locales by // delegating to the appropriate library. // Ignore issues from commonly used lints in this file. // ignore_for_file:implementation_imports, file_names, unnecessary_new // ignore_for_file:unnecessary_brace_in_string_interps, directives_ordering // ignore_for_file:argument_type_not_assignable, invalid_assignment // ignore_for_file:prefer_single_quotes, prefer_generic_function_type_aliases // ignore_for_file:comment_references import 'dart:async'; import 'package:flutter/foundation.dart'; import 'package:intl/intl.dart'; import 'package:intl/message_lookup_by_library.dart'; import 'package:intl/src/intl_helpers.dart'; import 'messages_de.dart' as messages_de; import 'messages_en.dart' as messages_en; typedef Future<dynamic> LibraryLoader(); Map<String, LibraryLoader> _deferredLibraries = { 'de': () => new SynchronousFuture(null), 'en': () => new SynchronousFuture(null), }; MessageLookupByLibrary? _findExact(String localeName) { switch (localeName) { case 'de': return messages_de.messages; case 'en': return messages_en.messages; default: return null; } } /// User programs should call this before using [localeName] for messages. Future<bool> initializeMessages(String localeName) { var availableLocale = Intl.verifiedLocale( localeName, (locale) => _deferredLibraries[locale] != null, onFailure: (_) => null); if (availableLocale == null) { return new SynchronousFuture(false); } var lib = _deferredLibraries[availableLocale]; lib == null ? new SynchronousFuture(false) : lib(); initializeInternalMessageLookup(() => new CompositeMessageLookup()); messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor); return new SynchronousFuture(true); } bool _messagesExistFor(String locale) { try { return _findExact(locale) != null; } catch (e) { return false; } } MessageLookupByLibrary? _findGeneratedMessagesFor(String locale) { var actualLocale = Intl.verifiedLocale(locale, _messagesExistFor, onFailure: (_) => null); if (actualLocale == null) return null; return _findExact(actualLocale); }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/localization_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/localization_demo/test/unit_test.dart
// This is an example unit test. // // A unit test tests a single function, method, or class. To learn more about // writing unit tests, visit // https://flutter.dev/docs/cookbook/testing/unit/introduction import 'package:flutter_test/flutter_test.dart'; void main() { group('Plus Operator', () { test('should add two numbers together', () { expect(1 + 1, 2,); },); },); }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/localization_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/localization_demo/test/widget_test.dart
// This is an example Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility in the flutter_test package. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. // // Visit https://flutter.dev/docs/cookbook/testing/widget/introduction for // more information about Widget testing. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; void main() { group('MyWidget', () { testWidgets('should display a string of text', (WidgetTester tester) async { // Define a Widget const myWidget = MaterialApp( home: Scaffold( body: Text('Hello'), ), ); // Build myWidget and trigger a frame. await tester.pumpWidget(myWidget); // Verify myWidget shows some text expect(find.byType(Text), findsOneWidget,); },); },); }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/metrics_lint_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/metrics_lint_demo/lib/main.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:flutter/material.dart'; import 'package:metrics_lint_demo/src/my_app.dart'; import 'package:metrics_lint_demo/src/settings/settings_controller.dart'; import 'package:metrics_lint_demo/src/settings/settings_service.dart'; void main() async { // Set up the SettingsController, which will glue user settings to multiple // Flutter Widgets. final settingsController = SettingsController(SettingsService()); // Load the user's preferred theme while the splash screen is displayed. // This prevents a sudden theme change when the app is first displayed. await settingsController.loadSettings(); // Run the app and pass in the SettingsController. The app listens to the // SettingsController for changes, then passes it further down to the // SettingsView. runApp(MyApp(settingsController: settingsController)); }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/metrics_lint_demo/lib
mirrored_repositories/flutter_bytes_devops/code_infrastructure/metrics_lint_demo/lib/src/my_app.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:metrics_lint_demo/src/sample_feature/sample_item_details_view.dart'; import 'package:metrics_lint_demo/src/sample_feature/sample_item_list_view.dart'; import 'package:metrics_lint_demo/src/settings/settings_controller.dart'; import 'package:metrics_lint_demo/src/settings/settings_view.dart'; /// The Widget that configures your application. class MyApp extends StatelessWidget { const MyApp({ super.key, required this.settingsController, }); final SettingsController settingsController; @override Widget build(BuildContext context) { // Glue the SettingsController to the MaterialApp. // // The ListenableBuilder Widget listens to the SettingsController for changes. // Whenever the user updates their settings, the MaterialApp is rebuilt. return ListenableBuilder( listenable: settingsController, builder: (BuildContext context, Widget? child,) { return MaterialApp( onGenerateRoute: (RouteSettings routeSettings) { return MaterialPageRoute<void>( builder: (BuildContext context) { switch (routeSettings.name) { case SettingsView.routeName: return SettingsView(controller: settingsController); case SampleItemDetailsView.routeName: return const SampleItemDetailsView(); case SampleItemListView.routeName: default: return const SampleItemListView(); } }, settings: routeSettings, ); }, onGenerateTitle: (BuildContext context) => AppLocalizations.of(context)!.appTitle, theme: ThemeData(), darkTheme: ThemeData.dark(), themeMode: settingsController.themeMode, localizationsDelegates: const [ AppLocalizations.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, ], supportedLocales: const [Locale('en', '',)], debugShowCheckedModeBanner: false, restorationScopeId: 'app', ); }, ); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/metrics_lint_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/metrics_lint_demo/lib/src/settings/settings_controller.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:flutter/material.dart'; import 'package:metrics_lint_demo/src/settings/settings_service.dart'; /// A class that many Widgets can interact with to read user settings, update /// user settings, or listen to user settings changes. /// /// Controllers glue Data Services to Flutter Widgets. The SettingsController /// uses the SettingsService to store and retrieve user settings. class SettingsController with ChangeNotifier { SettingsController(this._settingsService); // Make SettingsService a private variable so it is not used directly. final SettingsService _settingsService; // Make ThemeMode a private variable so it is not updated directly without // also persisting the changes with the SettingsService. late ThemeMode _themeMode; // Allow Widgets to read the user's preferred ThemeMode. ThemeMode get themeMode => _themeMode; /// Load the user's settings from the SettingsService. It may load from a /// local database or the internet. The controller only knows it can load the /// settings from the service. Future<void> loadSettings() async { _themeMode = await _settingsService.themeMode(); // Important! Inform listeners a change has occurred. notifyListeners(); } /// Update and persist the ThemeMode based on the user's selection. Future<void> updateThemeMode(ThemeMode? newThemeMode) async { if (newThemeMode == null) return; // Do not perform any work if new and old ThemeMode are identical if (newThemeMode == _themeMode) return; // Otherwise, store the new ThemeMode in memory _themeMode = newThemeMode; // Important! Inform listeners a change has occurred. notifyListeners(); // Persist the changes to a local database or the internet using the // SettingService. await _settingsService.updateThemeMode(newThemeMode); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/metrics_lint_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/metrics_lint_demo/lib/src/settings/settings_view.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:flutter/material.dart'; import 'package:metrics_lint_demo/src/settings/settings_controller.dart'; /// Displays the various settings that can be customized by the user. /// /// When a user changes a setting, the SettingsController is updated and /// Widgets that listen to the SettingsController are rebuilt. class SettingsView extends StatelessWidget { const SettingsView({super.key, required this.controller,}); static const routeName = '/settings'; final SettingsController controller; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Settings'), ), body: Padding( padding: const EdgeInsets.all(16), // Glue the SettingsController to the theme selection DropdownButton. // // When a user selects a theme from the dropdown list, the // SettingsController is updated, which rebuilds the MaterialApp. child: DropdownButton<ThemeMode>( items: const [ DropdownMenuItem(value: ThemeMode.system, child: Text('System Theme'),), DropdownMenuItem(value: ThemeMode.light, child: Text('Light Theme'),), DropdownMenuItem(value: ThemeMode.dark, child: Text('Dark Theme'),), ], value: controller.themeMode, onChanged: controller.updateThemeMode, ), ), ); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/metrics_lint_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/metrics_lint_demo/lib/src/settings/settings_service.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:flutter/material.dart'; /// A service that stores and retrieves user settings. /// /// By default, this class does not persist user settings. If you'd like to /// persist the user settings locally, use the shared_preferences package. If /// you'd like to store settings on a web server, use the http package. class SettingsService { /// Loads the User's preferred ThemeMode from local or remote storage. Future<ThemeMode> themeMode() async => ThemeMode.system; /// Persists the user's preferred ThemeMode to local or remote storage. Future<void> updateThemeMode(ThemeMode theme) async { // Use the shared_preferences package to persist settings locally or the // http package to persist settings over the network. } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/metrics_lint_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/metrics_lint_demo/lib/src/sample_feature/sample_item_details_view.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:flutter/material.dart'; /// Displays detailed information about a SampleItem. class SampleItemDetailsView extends StatelessWidget { const SampleItemDetailsView({super.key}); static const routeName = '/sample_item'; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Item Details'), ), body: const Center( child: Text('More Information Here'), ), ); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/metrics_lint_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/metrics_lint_demo/lib/src/sample_feature/sample_item.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. /// A placeholder class that represents an entity or model. class SampleItem { const SampleItem(this.id); final int id; }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/metrics_lint_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/metrics_lint_demo/lib/src/sample_feature/sample_item_list_view.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:flutter/material.dart'; import 'package:metrics_lint_demo/src/sample_feature/sample_item.dart'; import 'package:metrics_lint_demo/src/sample_feature/sample_item_details_view.dart'; import 'package:metrics_lint_demo/src/settings/settings_view.dart'; /// Displays a list of SampleItems. class SampleItemListView extends StatelessWidget { const SampleItemListView({ super.key, this.items = const [SampleItem(1), SampleItem(2), SampleItem(3),], }); static const routeName = '/'; final List<SampleItem> items; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: const Text('Sample Items'), actions: [ IconButton( onPressed: () { Navigator.restorablePushNamed(context, SettingsView.routeName,); }, icon: const Icon(Icons.settings), ), ], ), // To work with lists that may contain a large number of items, it’s best // to use the ListView.builder constructor. // // In contrast to the default ListView constructor, which requires // building all Widgets up front, the ListView.builder constructor lazily // builds Widgets as they’re scrolled into view. body: ListView.builder( itemBuilder: (BuildContext context, int index,) { final item = items[index]; return ListTile( leading: const CircleAvatar( foregroundImage: AssetImage('assets/images/flutter_logo.png'), ), title: Text('SampleItem ${item.id}'), onTap: () { Navigator.restorablePushNamed(context, SampleItemDetailsView.routeName,); }, ); }, itemCount: items.length, restorationId: 'sampleItemListView', ), ); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/metrics_lint_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/metrics_lint_demo/test/unit_test.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This is an example unit test. // // A unit test tests a single function, method, or class. To learn more about // writing unit tests, visit // https://flutter.dev/docs/cookbook/testing/unit/introduction import 'package:flutter_test/flutter_test.dart'; void main() { group('Plus Operator', () { test('should add two numbers together', () { expect(1 + 1, 2,); },); },); }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/metrics_lint_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/metrics_lint_demo/test/widget_test.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // This is an example Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility in the flutter_test package. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. // // Visit https://flutter.dev/docs/cookbook/testing/widget/introduction for // more information about Widget testing. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; void main() { group('MyWidget', () { testWidgets('should display a string of text', (WidgetTester tester) async { // Define a Widget const myWidget = MaterialApp( home: Scaffold( body: Text('Hello'), ), ); // Build myWidget and trigger a frame. await tester.pumpWidget(myWidget); // Verify myWidget shows some text expect(find.byType(Text), findsOneWidget,); },); },); }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib/main_profile.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:buildvariants_demo/main_delegate.dart'; void main() { // No need to directly call the enbironment config setup as it is // lazy loaded. In the story board case one uses overrides to // set isMockOverride and buildVariantOverride mainDelegate(); }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib/environment_config.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. bool? isMockOverride; String? buildVariantOverride; bool? isMockDefine; String? buildVariantDefine; /// [EnvironmentConfig] assumptions are /// that there are gitignored files of /// debug.json /// release.json /// staging.json /// preview.json /// profile.json /// /// That sets the vars per environment via /// the dart-define command. Thus, this /// is a services start entry in app start up services /// blocks /// And in test tear down it is: /// /// ```dart /// EnvironmentConfig.resetOverrides(); /// ``` /// /// Note, for story boarding one sets the overrides as part of starting the story board app /// as when the story board app is started we will not have a proper dart-define-from-file /// entry in our launch config. /// /// @author Fredrick Allan Grott. class EnvironmentConfig { bool get isMockDefine => isMockOverride ?? const bool.fromEnvironment('isMock'); String get buildVariantDefine => buildVariantOverride ?? const String.fromEnvironment('buildVariant'); void resetOverrides() { isMockOverride = null; buildVariantOverride = null; } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib/main_release.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:buildvariants_demo/main_delegate.dart'; void main() { // No need to directly call the enbironment config setup as it is // lazy loaded. In the story board case one uses overrides to // set isMockOverride and buildVariantOverride mainDelegate(); }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib/main_delegate.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:buildvariants_demo/main.dart'; void mainDelegate() => main();
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib/main_stagging.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:buildvariants_demo/main_delegate.dart'; void main() { // No need to directly call the enbironment config setup as it is // lazy loaded. In the story board case one uses overrides to // set isMockOverride and buildVariantOverride mainDelegate(); }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib/main_preview.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // ignore_for_file: unused_import // import 'package:device_preview/device_preview.dart'; // import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; void main() { // No need to directly call the enbironment config setup as it is // lazy loaded. In the story board case one uses overrides to // set isMockOverride and buildVariantOverride //DevopsConstants.setEnvironment(Environment.preview); //runApp(DevicePreview( //enabled: !kReleaseMode, // using builder to build the app and scaffold frame // thus builder slot gets a home MaterialApp with // scaffold wrapper //builder: (_) => MyAppPreviewWrapper(), //tools: [ // ...DevicePreview.defaultTools, // advancedScreenShotModesPlugin, // ], //)); }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib/main.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:buildvariants_demo/src/app_logging.dart'; import 'package:buildvariants_demo/src/catcher_two_options.dart'; import 'package:buildvariants_demo/src/my_app.dart'; import 'package:buildvariants_demo/src/settings/settings_controller.dart'; import 'package:buildvariants_demo/src/settings/settings_service.dart'; import 'package:catcher_2/catcher_2.dart'; void main() async { // Set up the SettingsController, which will glue user settings to multiple // Flutter Widgets. final settingsController = SettingsController(SettingsService()); // Load the user's preferred theme while the splash screen is displayed. // This prevents a sudden theme change when the app is first displayed. await settingsController.loadSettings(); // init app logging AppLogging(); // Run the app and pass in the SettingsController. The app listens to the // SettingsController for changes, then passes it further down to the // SettingsView. Catcher2( rootWidget: MyApp(settingsController: settingsController), releaseConfig: releaseOptions, debugConfig: debugOptions, ); }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib/main_debug.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:buildvariants_demo/main_delegate.dart'; void main() { // No need to directly call the enbironment config setup as it is // lazy loaded. In the story board case one uses overrides to // set isMockOverride and buildVariantOverride mainDelegate(); }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib/src/my_app.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:buildvariants_demo/src/localization/l10n.dart'; import 'package:buildvariants_demo/src/sample_feature/sample_item_details_view.dart'; import 'package:buildvariants_demo/src/sample_feature/sample_item_list_view.dart'; import 'package:buildvariants_demo/src/settings/settings_controller.dart'; import 'package:buildvariants_demo/src/settings/settings_view.dart'; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; /// The Widget that configures your application. class MyApp extends StatelessWidget { const MyApp({ super.key, required this.settingsController, }); final SettingsController settingsController; @override Widget build(BuildContext context) { // Glue the SettingsController to the MaterialApp. // // The ListenableBuilder Widget listens to the SettingsController for changes. // Whenever the user updates their settings, the MaterialApp is rebuilt. return ListenableBuilder( listenable: settingsController, builder: (BuildContext context, Widget? child,) { return MaterialApp( onGenerateRoute: (RouteSettings routeSettings) { return MaterialPageRoute<void>( builder: (BuildContext context) { switch (routeSettings.name) { case SettingsView.routeName: return SettingsView(controller: settingsController); case SampleItemDetailsView.routeName: return const SampleItemDetailsView(); case SampleItemListView.routeName: default: return const SampleItemListView(); } }, settings: routeSettings, ); }, onGenerateTitle: (BuildContext context) => AppLocalizations.of(context)!.appTitle, theme: ThemeData(), darkTheme: ThemeData.dark(), themeMode: settingsController.themeMode, localizationsDelegates: const [ CustomAppLocalizations.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, ], supportedLocales: CustomAppLocalizations.delegate.supportedLocales, debugShowCheckedModeBanner: false, restorationScopeId: 'app',); }, ); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib/src/app_logging.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // ignore_for_file: unused_local_variable import 'dart:developer'; import 'package:logging/logging.dart'; import 'package:logging_appenders/logging_appenders.dart'; /// The app Global logger. final appLogger = Logger("LoggingDemo"); /// AppLogging class initializes the logging set up at object creation. /// To call it is just AppLogging() within the main function block. /// /// Note, this an obseverable log that operates in all modes including /// release which means we do not use print but instead use log to output. /// /// @author Fredrick Allan Grott. class AppLogging { factory AppLogging() { return _appLogging; } AppLogging._internal() { _init(); } static final AppLogging _appLogging = AppLogging._internal(); void _init() { // disable hierarchical logger hierarchicalLoggingEnabled = false; Logger.root.level = Level.ALL; // stack traces are expensive so we turn this on for // severe and above recordStackTraceAtLevel = Level.SEVERE; // just so during a log level change that we know about it. // log is used instead of print as this is for observable // logging even in release mode Logger.root.onLevelChanged.listen((event) { log('${event?.name} changed'); }); // now to get the log output Logger.root.onRecord.listen((record) { if (record.error != null && record.stackTrace != null) { log( '${record.level.name}: ${record.loggerName}: ${record.time}: ${record.message}: ${record.error}: ${record.stackTrace}', ); log( 'level: ${record.level.name} loggerName: ${record.loggerName} time: ${record.time} message: ${record.message} error: ${record.error} exception: ${record.stackTrace}', ); } else if (record.error != null) { log( 'level: ${record.level.name} loggerName: ${record.loggerName} time: ${record.time} message: ${record.message} error: ${record.error}', ); } else { log( 'level: ${record.level.name} loggerName: ${record.loggerName} time: ${record.time} message: ${record.message}', ); } }); // Appenders set up for color logs PrintAppender(formatter: const ColorFormatter()).attachToLogger(Logger.root); // Any appendeing logs to 3rd party observable logging services // would be here using the logging appenders other appenders } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib/src/custom_catcher_two_logger.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'dart:developer'; import 'package:catcher_2/catcher_2.dart'; /// CustomCatcherTwoLogger where the Dart developer log /// method is used to output the correct log message. Have to use /// log instead of print for observable logs as print is stripped /// in release mode. /// /// @author Fredrick Allan Grott. class CustomCatcherTwoLogger extends Catcher2Logger { @override void info(String message) { log('Custom Catcher Logger | Info | $message'); } @override void fine(String message) { log('Custom Catcher Logger | Fine | $message'); } @override void warning(String message) { log('Custom Catcher Logger | Warning | $message'); } @override void severe(String message) { log('Custom Catcher Logger | Severe | $message'); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib/src/catcher_two_options.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // ignore_for_file: avoid_redundant_argument_values import 'package:buildvariants_demo/src/custom_catcher_two_logger.dart'; import 'package:catcher_2/catcher_2.dart'; final debugOptions = Catcher2Options( PageReportMode(), [ EmailManualHandler(['[email protected]']), ConsoleHandler(), ], localizationOptions: [ LocalizationOptions( 'en', pageReportModeTitle: 'Exception Report', pageReportModeDescription: 'Page report mode.', pageReportModeAccept: 'Accept', pageReportModeCancel: 'Cancel', ), LocalizationOptions( 'de', pageReportModeTitle: 'Ausnahmebericht', pageReportModeDescription: 'Seitenberichtsmodus', pageReportModeAccept: 'Akzeptieren', pageReportModeCancel: 'Stornieren', ), ], logger: CustomCatcherTwoLogger(), ); final releaseOptions = Catcher2Options( PageReportMode(), [ EmailManualHandler(['[email protected]']), ], localizationOptions: [ LocalizationOptions( 'en', pageReportModeTitle: 'Exception Report', pageReportModeDescription: 'Page report mode.', pageReportModeAccept: 'Accept', pageReportModeCancel: 'Cancel', ), LocalizationOptions( 'de', pageReportModeTitle: 'Ausnahmebericht', pageReportModeDescription: 'Seitenberichtsmodus', pageReportModeAccept: 'Akzeptieren', pageReportModeCancel: 'Stornieren', ), ], logger: CustomCatcherTwoLogger(), );
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib/src/settings/settings_controller.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:buildvariants_demo/src/settings/settings_service.dart'; import 'package:flutter/material.dart'; /// A class that many Widgets can interact with to read user settings, update /// user settings, or listen to user settings changes. /// /// Controllers glue Data Services to Flutter Widgets. The SettingsController /// uses the SettingsService to store and retrieve user settings. class SettingsController with ChangeNotifier { SettingsController(this._settingsService); // Make SettingsService a private variable so it is not used directly. final SettingsService _settingsService; // Make ThemeMode a private variable so it is not updated directly without // also persisting the changes with the SettingsService. late ThemeMode _themeMode; // Allow Widgets to read the user's preferred ThemeMode. ThemeMode get themeMode => _themeMode; /// Load the user's settings from the SettingsService. It may load from a /// local database or the internet. The controller only knows it can load the /// settings from the service. Future<void> loadSettings() async { _themeMode = await _settingsService.themeMode(); // Important! Inform listeners a change has occurred. notifyListeners(); } /// Update and persist the ThemeMode based on the user's selection. Future<void> updateThemeMode(ThemeMode? newThemeMode) async { if (newThemeMode == null) return; // Do not perform any work if new and old ThemeMode are identical if (newThemeMode == _themeMode) return; // Otherwise, store the new ThemeMode in memory _themeMode = newThemeMode; // Important! Inform listeners a change has occurred. notifyListeners(); // Persist the changes to a local database or the internet using the // SettingService. await _settingsService.updateThemeMode(newThemeMode); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib/src/settings/settings_view.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:buildvariants_demo/src/localization/l10n.dart'; import 'package:buildvariants_demo/src/settings/settings_controller.dart'; import 'package:flutter/material.dart'; /// Displays the various settings that can be customized by the user. /// /// When a user changes a setting, the SettingsController is updated and /// Widgets that listen to the SettingsController are rebuilt. class SettingsView extends StatelessWidget { const SettingsView({super.key, required this.controller,}); static const routeName = '/settings'; final SettingsController controller; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(CustomAppLocalizations.of(context).settingsViewTitle), ), body: Padding( padding: const EdgeInsets.all(16), // Glue the SettingsController to the theme selection DropdownButton. // // When a user selects a theme from the dropdown list, the // SettingsController is updated, which rebuilds the MaterialApp. child: DropdownButton<ThemeMode>( items: [ DropdownMenuItem(value: ThemeMode.system, child: Text(CustomAppLocalizations.of(context).settingsSystemTheme),), DropdownMenuItem(value: ThemeMode.light, child: Text(CustomAppLocalizations.of(context).settingsLightTheme),), DropdownMenuItem(value: ThemeMode.dark, child: Text(CustomAppLocalizations.of(context).settingsDarkTheme),), ], value: controller.themeMode, onChanged: controller.updateThemeMode, ), ), ); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib/src/settings/settings_service.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:flutter/material.dart'; /// A service that stores and retrieves user settings. /// /// By default, this class does not persist user settings. If you'd like to /// persist the user settings locally, use the shared_preferences package. If /// you'd like to store settings on a web server, use the http package. class SettingsService { /// Loads the User's preferred ThemeMode from local or remote storage. Future<ThemeMode> themeMode() async => ThemeMode.system; /// Persists the user's preferred ThemeMode to local or remote storage. Future<void> updateThemeMode(ThemeMode theme) async { // Use the shared_preferences package to persist settings locally or the // http package to persist settings over the network. } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib/src/sample_feature/sample_item_details_view.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:buildvariants_demo/src/localization/l10n.dart'; import 'package:flutter/material.dart'; /// Displays detailed information about a SampleItem. class SampleItemDetailsView extends StatelessWidget { const SampleItemDetailsView({super.key}); static const routeName = '/sample_item'; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(CustomAppLocalizations.of(context).sampleItemDetailsViewTitle), ), body: Center( child: Text(CustomAppLocalizations.of(context).sampleItemDetailsViewDetail), ), ); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib/src/sample_feature/sample_item.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. /// A placeholder class that represents an entity or model. class SampleItem { const SampleItem(this.id); final int id; }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib/src/sample_feature/sample_item_list_view.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:buildvariants_demo/src/localization/l10n.dart'; import 'package:buildvariants_demo/src/sample_feature/sample_item.dart'; import 'package:buildvariants_demo/src/sample_feature/sample_item_details_view.dart'; import 'package:buildvariants_demo/src/settings/settings_view.dart'; import 'package:flutter/material.dart'; /// Displays a list of SampleItems. class SampleItemListView extends StatelessWidget { const SampleItemListView({ super.key, this.items = const [SampleItem(1), SampleItem(2), SampleItem(3),], }); static const routeName = '/'; final List<SampleItem> items; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(CustomAppLocalizations.of(context).sampleItemListViewTitle), actions: [ IconButton( onPressed: () {Navigator.restorablePushNamed(context, SettingsView.routeName,);}, icon: const Icon(Icons.settings),), ], ), // To work with lists that may contain a large number of items, it’s best // to use the ListView.builder constructor. // // In contrast to the default ListView constructor, which requires // building all Widgets up front, the ListView.builder constructor lazily // builds Widgets as they’re scrolled into view. body: ListView.builder( itemBuilder: (BuildContext context, int index,) {final item = items[index]; return ListTile( leading: const CircleAvatar(foregroundImage: AssetImage('assets/images/flutter_logo.png')), title: Text(CustomAppLocalizations.of(context).listTileTitle(item.id)), onTap: () {Navigator.restorablePushNamed(context, SampleItemDetailsView.routeName,);}, ); }, itemCount: items.length, restorationId: 'sampleItemListView', ), ); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib/src
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib/src/localization/l10n.dart
// GENERATED CODE - DO NOT MODIFY BY HAND import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import 'intl/messages_all.dart'; // ************************************************************************** // Generator: Flutter Intl IDE plugin // Made by Localizely // ************************************************************************** // ignore_for_file: non_constant_identifier_names, lines_longer_than_80_chars // ignore_for_file: join_return_with_assignment, prefer_final_in_for_each // ignore_for_file: avoid_redundant_argument_values, avoid_escaping_inner_quotes class CustomAppLocalizations { CustomAppLocalizations(); static CustomAppLocalizations? _current; static CustomAppLocalizations get current { assert(_current != null, 'No instance of CustomAppLocalizations was loaded. Try to initialize the CustomAppLocalizations delegate before accessing CustomAppLocalizations.current.'); return _current!; } static const AppLocalizationDelegate delegate = AppLocalizationDelegate(); static Future<CustomAppLocalizations> load(Locale locale) { final name = (locale.countryCode?.isEmpty ?? false) ? locale.languageCode : locale.toString(); final localeName = Intl.canonicalizedLocale(name); return initializeMessages(localeName).then((_) { Intl.defaultLocale = localeName; final instance = CustomAppLocalizations(); CustomAppLocalizations._current = instance; return instance; }); } static CustomAppLocalizations of(BuildContext context) { final instance = CustomAppLocalizations.maybeOf(context); assert(instance != null, 'No instance of CustomAppLocalizations present in the widget tree. Did you add CustomAppLocalizations.delegate in localizationsDelegates?'); return instance!; } static CustomAppLocalizations? maybeOf(BuildContext context) { return Localizations.of<CustomAppLocalizations>( context, CustomAppLocalizations); } /// `App` String get title { return Intl.message( 'App', name: 'title', desc: 'Title for the App', args: [], ); } /// `SampleItem {value}` String listTileTitle(int value) { return Intl.message( 'SampleItem $value', name: 'listTileTitle', desc: 'ListTile title', args: [value], ); } /// `Sample Items` String get sampleItemListViewTitle { return Intl.message( 'Sample Items', name: 'sampleItemListViewTitle', desc: 'Sample Item List View Title', args: [], ); } /// `Item Details` String get sampleItemDetailsViewTitle { return Intl.message( 'Item Details', name: 'sampleItemDetailsViewTitle', desc: 'Sample Item Detials view Title', args: [], ); } /// `Settings` String get settingsViewTitle { return Intl.message( 'Settings', name: 'settingsViewTitle', desc: 'Settings View Title', args: [], ); } /// `System Theme` String get settingsSystemTheme { return Intl.message( 'System Theme', name: 'settingsSystemTheme', desc: 'Settings System Theme', args: [], ); } /// `Light Theme` String get settingsLightTheme { return Intl.message( 'Light Theme', name: 'settingsLightTheme', desc: 'Settings Light Theme', args: [], ); } /// `Dark Theme` String get settingsDarkTheme { return Intl.message( 'Dark Theme', name: 'settingsDarkTheme', desc: 'Settings Dark Theme', args: [], ); } /// `More Information Here` String get sampleItemDetailsViewDetail { return Intl.message( 'More Information Here', name: 'sampleItemDetailsViewDetail', desc: 'Sample Item Detials View Detail', args: [], ); } } class AppLocalizationDelegate extends LocalizationsDelegate<CustomAppLocalizations> { const AppLocalizationDelegate(); List<Locale> get supportedLocales { return const <Locale>[ Locale.fromSubtags(languageCode: 'en'), Locale.fromSubtags(languageCode: 'de'), ]; } @override bool isSupported(Locale locale) => _isSupported(locale); @override Future<CustomAppLocalizations> load(Locale locale) => CustomAppLocalizations.load(locale); @override bool shouldReload(AppLocalizationDelegate old) => false; bool _isSupported(Locale locale) { for (var supportedLocale in supportedLocales) { if (supportedLocale.languageCode == locale.languageCode) { return true; } } return false; } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib/src/localization
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib/src/localization/intl/messages_en.dart
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart // This is a library that provides messages for a en locale. All the // messages from the main program should be duplicated here with the same // function name. // Ignore issues from commonly used lints in this file. // ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new // ignore_for_file:prefer_single_quotes,comment_references, directives_ordering // ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases // ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes // ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes import 'package:intl/intl.dart'; import 'package:intl/message_lookup_by_library.dart'; final messages = new MessageLookup(); typedef String MessageIfAbsent(String messageStr, List<dynamic> args); class MessageLookup extends MessageLookupByLibrary { String get localeName => 'en'; static String m0(value) => "SampleItem ${value}"; final messages = _notInlinedMessages(_notInlinedMessages); static Map<String, Function> _notInlinedMessages(_) => <String, Function>{ "listTileTitle": m0, "sampleItemDetailsViewDetail": MessageLookupByLibrary.simpleMessage("More Information Here"), "sampleItemDetailsViewTitle": MessageLookupByLibrary.simpleMessage("Item Details"), "sampleItemListViewTitle": MessageLookupByLibrary.simpleMessage("Sample Items"), "settingsDarkTheme": MessageLookupByLibrary.simpleMessage("Dark Theme"), "settingsLightTheme": MessageLookupByLibrary.simpleMessage("Light Theme"), "settingsSystemTheme": MessageLookupByLibrary.simpleMessage("System Theme"), "settingsViewTitle": MessageLookupByLibrary.simpleMessage("Settings"), "title": MessageLookupByLibrary.simpleMessage("App") }; }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib/src/localization
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib/src/localization/intl/messages_de.dart
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart // This is a library that provides messages for a de locale. All the // messages from the main program should be duplicated here with the same // function name. // Ignore issues from commonly used lints in this file. // ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new // ignore_for_file:prefer_single_quotes,comment_references, directives_ordering // ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases // ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes // ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes import 'package:intl/intl.dart'; import 'package:intl/message_lookup_by_library.dart'; final messages = new MessageLookup(); typedef String MessageIfAbsent(String messageStr, List<dynamic> args); class MessageLookup extends MessageLookupByLibrary { String get localeName => 'de'; static String m0(value) => "Musterartikel ${value}"; final messages = _notInlinedMessages(_notInlinedMessages); static Map<String, Function> _notInlinedMessages(_) => <String, Function>{ "listTileTitle": m0, "sampleItemDetailsViewDetail": MessageLookupByLibrary.simpleMessage("Weitere Informationen Hier"), "sampleItemDetailsViewTitle": MessageLookupByLibrary.simpleMessage("Artikeldetails"), "sampleItemListViewTitle": MessageLookupByLibrary.simpleMessage("Beispielartikel"), "settingsDarkTheme": MessageLookupByLibrary.simpleMessage("Dunkles Thema"), "settingsLightTheme": MessageLookupByLibrary.simpleMessage("Licht Thema"), "settingsSystemTheme": MessageLookupByLibrary.simpleMessage("System Thema"), "settingsViewTitle": MessageLookupByLibrary.simpleMessage("Einstellungen"), "title": MessageLookupByLibrary.simpleMessage("App") }; }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib/src/localization
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/lib/src/localization/intl/messages_all.dart
// DO NOT EDIT. This is code generated via package:intl/generate_localized.dart // This is a library that looks up messages for specific locales by // delegating to the appropriate library. // Ignore issues from commonly used lints in this file. // ignore_for_file:implementation_imports, file_names, unnecessary_new // ignore_for_file:unnecessary_brace_in_string_interps, directives_ordering // ignore_for_file:argument_type_not_assignable, invalid_assignment // ignore_for_file:prefer_single_quotes, prefer_generic_function_type_aliases // ignore_for_file:comment_references import 'dart:async'; import 'package:flutter/foundation.dart'; import 'package:intl/intl.dart'; import 'package:intl/message_lookup_by_library.dart'; import 'package:intl/src/intl_helpers.dart'; import 'messages_de.dart' as messages_de; import 'messages_en.dart' as messages_en; typedef Future<dynamic> LibraryLoader(); Map<String, LibraryLoader> _deferredLibraries = { 'de': () => new SynchronousFuture(null), 'en': () => new SynchronousFuture(null), }; MessageLookupByLibrary? _findExact(String localeName) { switch (localeName) { case 'de': return messages_de.messages; case 'en': return messages_en.messages; default: return null; } } /// User programs should call this before using [localeName] for messages. Future<bool> initializeMessages(String localeName) { var availableLocale = Intl.verifiedLocale( localeName, (locale) => _deferredLibraries[locale] != null, onFailure: (_) => null); if (availableLocale == null) { return new SynchronousFuture(false); } var lib = _deferredLibraries[availableLocale]; lib == null ? new SynchronousFuture(false) : lib(); initializeInternalMessageLookup(() => new CompositeMessageLookup()); messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor); return new SynchronousFuture(true); } bool _messagesExistFor(String locale) { try { return _findExact(locale) != null; } catch (e) { return false; } } MessageLookupByLibrary? _findGeneratedMessagesFor(String locale) { var actualLocale = Intl.verifiedLocale(locale, _messagesExistFor, onFailure: (_) => null); if (actualLocale == null) return null; return _findExact(actualLocale); }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/test/unit_test.dart
// This is an example unit test. // // A unit test tests a single function, method, or class. To learn more about // writing unit tests, visit // https://flutter.dev/docs/cookbook/testing/unit/introduction import 'package:flutter_test/flutter_test.dart'; void main() { group('Plus Operator', () { test('should add two numbers together', () { expect(1 + 1, 2,); },); },); }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/buildvariants_demo/test/widget_test.dart
// This is an example Flutter widget test. // // To perform an interaction with a widget in your test, use the WidgetTester // utility in the flutter_test package. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. // // Visit https://flutter.dev/docs/cookbook/testing/widget/introduction for // more information about Widget testing. import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; void main() { group('MyWidget', () { testWidgets('should display a string of text', (WidgetTester tester) async { // Define a Widget const myWidget = MaterialApp( home: Scaffold( body: Text('Hello'), ), ); // Build myWidget and trigger a frame. await tester.pumpWidget(myWidget); // Verify myWidget shows some text expect(find.byType(Text), findsOneWidget,); },); },); }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/catcher_two_demo
mirrored_repositories/flutter_bytes_devops/code_infrastructure/catcher_two_demo/lib/main.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:catcher_2/catcher_2.dart'; import 'package:catcher_two_demo/src/app_logging.dart'; import 'package:catcher_two_demo/src/catcher_two_options.dart'; import 'package:catcher_two_demo/src/my_app.dart'; import 'package:catcher_two_demo/src/settings/settings_controller.dart'; import 'package:catcher_two_demo/src/settings/settings_service.dart'; void main() async { // Set up the SettingsController, which will glue user settings to multiple // Flutter Widgets. final settingsController = SettingsController(SettingsService()); // Load the user's preferred theme while the splash screen is displayed. // This prevents a sudden theme change when the app is first displayed. await settingsController.loadSettings(); // init app logging AppLogging(); // Run the app and pass in the SettingsController. The app listens to the // SettingsController for changes, then passes it further down to the // SettingsView. Catcher2( rootWidget: MyApp(settingsController: settingsController), releaseConfig: releaseOptions, debugConfig: debugOptions, ); }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/catcher_two_demo/lib
mirrored_repositories/flutter_bytes_devops/code_infrastructure/catcher_two_demo/lib/src/my_app.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'package:catcher_two_demo/src/localization/l10n.dart'; import 'package:catcher_two_demo/src/sample_feature/sample_item_details_view.dart'; import 'package:catcher_two_demo/src/sample_feature/sample_item_list_view.dart'; import 'package:catcher_two_demo/src/settings/settings_controller.dart'; import 'package:catcher_two_demo/src/settings/settings_view.dart'; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; /// The Widget that configures your application. class MyApp extends StatelessWidget { const MyApp({ super.key, required this.settingsController, }); final SettingsController settingsController; @override Widget build(BuildContext context) { // Glue the SettingsController to the MaterialApp. // // The ListenableBuilder Widget listens to the SettingsController for changes. // Whenever the user updates their settings, the MaterialApp is rebuilt. return ListenableBuilder( listenable: settingsController, builder: (BuildContext context, Widget? child,) { return MaterialApp( onGenerateRoute: (RouteSettings routeSettings) { return MaterialPageRoute<void>( builder: (BuildContext context) { switch (routeSettings.name) { case SettingsView.routeName: return SettingsView(controller: settingsController); case SampleItemDetailsView.routeName: return const SampleItemDetailsView(); case SampleItemListView.routeName: default: return const SampleItemListView();} }, settings: routeSettings, ); }, onGenerateTitle: (BuildContext context) => AppLocalizations.of(context)!.appTitle, theme: ThemeData(), darkTheme: ThemeData.dark(), themeMode: settingsController.themeMode, localizationsDelegates: const [ CustomAppLocalizations.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, ], supportedLocales: CustomAppLocalizations.delegate.supportedLocales, debugShowCheckedModeBanner: false, restorationScopeId: 'app', ); }, ); } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/catcher_two_demo/lib
mirrored_repositories/flutter_bytes_devops/code_infrastructure/catcher_two_demo/lib/src/app_logging.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // ignore_for_file: unused_local_variable import 'dart:developer'; import 'package:logging/logging.dart'; import 'package:logging_appenders/logging_appenders.dart'; /// The app Global logger. final appLogger = Logger("LoggingDemo"); /// AppLogging class initializes the logging set up at object creation. /// To call it is just AppLogging() within the main function block. /// /// Note, this an obseverable log that operates in all modes including /// release which means we do not use print but instead use log to output. /// /// @author Fredrick Allan Grott. class AppLogging { factory AppLogging() { return _appLogging; } AppLogging._internal() { _init(); } static final AppLogging _appLogging = AppLogging._internal(); void _init() { // disable hierarchical logger hierarchicalLoggingEnabled = false; Logger.root.level = Level.ALL; // stack traces are expensive so we turn this on for // severe and above recordStackTraceAtLevel = Level.SEVERE; // just so during a log level change that we know about it. // log is used instead of print as this is for observable // logging even in release mode Logger.root.onLevelChanged.listen((event) { log('${event?.name} changed'); }); // now to get the log output Logger.root.onRecord.listen((record) { if (record.error != null && record.stackTrace != null) { log( '${record.level.name}: ${record.loggerName}: ${record.time}: ${record.message}: ${record.error}: ${record.stackTrace}', ); log( 'level: ${record.level.name} loggerName: ${record.loggerName} time: ${record.time} message: ${record.message} error: ${record.error} exception: ${record.stackTrace}', ); } else if (record.error != null) { log( 'level: ${record.level.name} loggerName: ${record.loggerName} time: ${record.time} message: ${record.message} error: ${record.error}', ); } else { log( 'level: ${record.level.name} loggerName: ${record.loggerName} time: ${record.time} message: ${record.message}', ); } }); // Appenders set up for color logs PrintAppender(formatter: const ColorFormatter()).attachToLogger(Logger.root); // Any appendeing logs to 3rd party observable logging services // would be here using the logging appenders other appenders } }
0
mirrored_repositories/flutter_bytes_devops/code_infrastructure/catcher_two_demo/lib
mirrored_repositories/flutter_bytes_devops/code_infrastructure/catcher_two_demo/lib/src/custom_catcher_two_logger.dart
// Copyright 2023 Fredrick Allan Grott. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. import 'dart:developer'; import 'package:catcher_2/catcher_2.dart'; /// CustomCatcherTwoLogger where the Dart developer log /// method is used to output the correct log message. Have to use /// log instead of print for observable logs as print is stripped /// in release mode. /// /// @author Fredrick Allan Grott. class CustomCatcherTwoLogger extends Catcher2Logger { @override void info(String message) { log('Custom Catcher Logger | Info | $message'); } @override void fine(String message) { log('Custom Catcher Logger | Fine | $message'); } @override void warning(String message) { log('Custom Catcher Logger | Warning | $message'); } @override void severe(String message) { log('Custom Catcher Logger | Severe | $message'); } }
0