Question: I have to design a database where I have to store `Test Name` for each `Filename` and Each `Test Name` can run on several `Builds` and can either `Pass` or `Fail`.
There is 1-1 relationship between `Filename` & `Test Name`, which means there is one 1 file for 1 test. But each test can run on many builds and can have different outputs.

My approach is:
Table 1: **FileAndTestMap**

```
+----------+----------+
| Testname | Filename |
+----------+----------+
| 1        | A.txt    |
+----------+----------+
| 2        | Er.txt   |
+----------+----------+

```

Table 2: **Build**

```
+------+--------------+
| S No | Build Number |
+------+--------------+
| 1    | Build_123    |
+------+--------------+
| 2    | Build_234    |
+------+--------------+

```

Table 3: **Build\_XXX** *(For each build)*

```
+----------+----------+--------+
| TestName | Executed | Passed |
+----------+----------+--------+
| 1        | Y        | Y      |
+----------+----------+--------+
| 2        | N        | N      |
+----------+----------+--------+

```

I do not like this design and need a better approach to this. Any help is appreciated.

Answer: 
Add a Globalkey of the Scaffold state and use that
to display snack bar as below,

```
GlobalKey<ScaffoldState> scaffoldState;

Scaffold {
key: scaffoldState,
....

scaffoldState.currentState.showSnackBar(new SnackBar(content: new Text('Hello!')));

```
This is even simpler. **Tried it.** Create the FloatingActionButton as a **separate Stateless Widget.** **Call this Stateless Widget from the Scaffold.**

```
class Abc extends StatelessWidget
{
   Widget build(BuildContext context)
   {
      return Scaffold(
         appBar:AppBar(title:Text("Long List View")),
         body:SomeOtherWidget(),
         floatingActionButton:MyFAB()  
      );
   }
}

class MyFAB extends StatelessWidget
{
    Widget build(BuildContext context)
    {
       return FloatingActionButton(
            onPressed:(){
                showSnackBarHandler(context);
            },
            child:Icon(Icons.add),
            tooltip:"Press to Add More"
       );
    }
}

void showSnackBarHandler(BuildContext context){

var snackBar = SnackBar(
    content:Text("Hello")
);

Scaffold.of(context).showSnackBar(snackBar);

}

```